public void RemoveWaypoint(WaypointClass waypoint) { for (int i = 0; i < waypointList.Count; ++i) { if (waypointList[i] == waypoint) { waypointList.Remove(waypointList[i]); } } }
// Use this for initialization void Start() { WaypointScript = GameObject.Find("MainGame").GetComponent <WaypointClass>(); //Initialise FearMachine Variables TheFearMachine.EnemyGO = "Fear Machine"; TheFearMachine.CurrentPosition = GameObject.Find(TheFearMachine.EnemyGO).transform.position; TheFearMachine.CurrentWaypoint = 10; TheFearMachine.CurrentDirection = new Vector2(0, -1); TheFearMachine.CurrentMaxSpeed = TheFearMachine.OriginalMaxSpeed; TheFearMachine.BoundingBoxSize = BoundingSquareRadius; }
// Use this for initialization void Start() { BehaviourTreeScript = GameObject.Find("MainGame").GetComponent <AIRacerBehaviourTree>(); WaypointScript = GameObject.Find("MainGame").GetComponent <WaypointClass>(); for (int i = 0; i < AIRacerList.Length; i++) { AIRacerList[i].StatusAilment = "Normal"; AIRacerList[i].Lap = 1; AIRacerList[i].CalculatedRank = 0; AIRacerList[i].CurrentPosition = GameObject.Find(DriverGOList[i]).transform.position; AIRacerList[i].CurrentWaypoint = 0; AIRacerList[i].CurrentDirection = new Vector2(0, 1); AIRacerList[i].DriverGO = DriverGOList[i]; AIRacerList[i].CurrentMaxSpeed = AIRacerList[i].OriginalMaxSpeed; AIRacerList[i].RubberbandingSpeed = AIRacerList[i].OriginalMaxSpeed * 2f; CalculatedRanksList[i] = AIRacerList[i].CalculatedRank; } }
// Start is called before the first frame update void Start() { Ray CastToGround = new Ray(transform.position, Vector3.down); RaycastHit hit; if (Physics.Raycast(CastToGround, out hit)) { //Getting the variables var tempWaypointmanager = GameObject.FindGameObjectWithTag("WaypointManager"); var accessingVar = tempWaypointmanager.GetComponent <WaypointManager>(); //Creating a new waypoint WaypointClass newWaypoint = new WaypointClass(); //Setting the position newWaypoint.SetRayCast(hit.point); newWaypoint.SetPos(transform.position); //Adding into the list accessingVar.AddWaypoint(newWaypoint); } }
public void AddWaypoint(WaypointClass waypoint) { waypointList.Add(waypoint); }