// Use this for initialization void Start() { //AStar Calculated Path pathArray = new ArrayList(); startPos = this.transform; FindPath(); //Set previous path count //prevPathCount = pathArray.Count; curPathindex = 0;//init this.intervalTime = goalPos.GetComponent <AStarNavigation>().intervalTime; this.Speed = goalPos.GetComponent <AStarNavigation>().Speed; //flock origin ref boidOrigin = this.GetComponent <BoidOrigin>(); }
Animator anim;//Debug purpose only(Can delete if want) // Use this for initialization void Start() { //AStar Calculated Path pathArray = new ArrayList(); startPos = this.transform; FindPath(); curPathindex = 0; //init this.intervalTime = goalPos.GetComponent <AStarOrigin>().intervalTime; //set interval time to equal Flock origin's interval astar time this.Speed = goalPos.GetComponent <AStarOrigin>().Speed; //set speed to equal to flock origin's speed boidStats = this.GetComponent <Boid>(); this.initialSpeed = this.Speed; //save regular speed boidOriginStats = goalPos.GetComponent <BoidOrigin>(); }
// Start is called before the first frame update void Start() { this.transform.rotation = Quaternion.Euler(Vector3.zero);//reset rotation to zero otherBoids = new List <GameObject>(); flockOriginStats = flockOrigin.GetComponent <BoidOrigin>(); //Sets object tag as Boid if (this.tag.ToLower() == "untagged") { this.tag = "Boid"; } if (Leader.tag.ToLower() == "untagged") { Leader.tag = "Boid"; } //Retrieve all other boid gameobjects otherBoids.AddRange(GameObject.FindGameObjectsWithTag(this.tag)); otherBoids.Remove(this.gameObject); flockSpeed = flockOrigin.GetComponent <AStarOrigin>().Speed; adjustSpeed = flockSpeed + boidSpeed; SetBoidSpeed(); movementDir = Leader.transform.position - flockOrigin.transform.position; }