From 4eb7879bf28a150c65533bf3a66892ba6ba8e1fd Mon Sep 17 00:00:00 2001 From: mushgunAX Date: Wed, 2 Nov 2022 11:37:03 +0800 Subject: [PATCH] Revert "Create AIPrototype.cs" This reverts commit b0054d62c6b7450860e5b453539f968aeb1ed45c. --- TempScriptsFolder/AIPrototype.cs | 53 -------------------------------- 1 file changed, 53 deletions(-) delete mode 100644 TempScriptsFolder/AIPrototype.cs diff --git a/TempScriptsFolder/AIPrototype.cs b/TempScriptsFolder/AIPrototype.cs deleted file mode 100644 index c7240806..00000000 --- a/TempScriptsFolder/AIPrototype.cs +++ /dev/null @@ -1,53 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Runtime.CompilerServices; -using System.Text; -using System.Threading.Tasks; -using SHADE; - -public class AIPrototype : Script -{ - //This object's relevant components - private Transform transform; - - [SerializeField] - [Tooltip("The list of waypoints that the object will move around on")] - private Vector3[] waypoints; - - [SerializeField] - [Tooltip("How fast the object moves about waypoints")] - private float moveSpeed; - - //To cycle depending on the length of waypoints - private int currentTargetWaypointIndex; - - public AIPrototype(GameObject gameObj) : base(gameObj) { } - - protected override void awake() - { - transform = GetComponent(); - if (transform == null) - { - Debug.LogError("Transform is NULL!"); - } - - currentTargetWaypointIndex = 0; - } - - protected override void update() - { - //Head towards the next target - transform.GlobalPosition += (waypoints[currentTargetWaypointIndex] - transform.GlobalPosition) * moveSpeed * (float)Time.DeltaTime; - - //Cycle to next waypoint if near enough - if ((waypoints[currentTargetWaypointIndex] - transform.GlobalPosition).GetSqrMagnitude() < 1.0f) - { - ++currentTargetWaypointIndex; - if (currentTargetWaypointIndex == waypoints.Length) - { - currentTargetWaypointIndex = 0; //Recycle - } - } - } -} \ No newline at end of file