void Start() { for (int i = 0; i < flockSize; i++) { BoidFlocking boid = Instantiate(boidprefab, transform.position, transform.rotation) as BoidFlocking; boid.transform.parent = transform; boid.transform.localPosition = new Vector3( Random.value * GetComponent <Collider>().bounds.size.x, Random.value * GetComponent <Collider>().bounds.size.y, Random.value * GetComponent <Collider>().bounds.size.z) - GetComponent <Collider>().bounds.extents; boid.controller = this; boids.Add(boid); } }
public void PutBoidsOnTree(PeachTreeLandingPtsCtrler peachTree) { boids.Clear(); foreach (Landable landable in peachTree.landablePts) { Transform landingPtTrans = landable.getTrans(); BoidFlocking boid = Instantiate(prefab, landingPtTrans.position, landingPtTrans.rotation) as BoidFlocking; boid.transform.parent = transform; boid.controller = this; landable.TargetBy(boid); boid.EnterState(BoidFlocking.State.perching); boids.Add(boid); } perchingTree = peachTree; }
public void StartATL(ThirdPersonUserControl player, CurvySpline spline, Crosshair crosshair) { _boids = new List <BoidFlocking>(); for (int i = 0; i < flockSize; i++) { Vector3 position = new Vector3( Random.value * 10.0f, Random.value * 10.0f, Random.value * 10.0f ); BoidFlocking boid = Instantiate(prefab, transform.position, transform.rotation) as BoidFlocking; boid.transform.parent = transform; boid.transform.localPosition = position; boid.GetComponent <BoidFlocking> ().StartATL(i, this, player, spline, crosshair); _boids.Add(boid); } }
public void RandomGenerateBoidInsideCollider(BoidFlocking.State initState) { Collider collider = GetComponent <Collider>(); Debug.Assert(collider != null, "no collider on this gameObject"); boids.Clear(); for (int i = 0; i < flockSize; i++) { BoidFlocking boid = Instantiate(prefab, transform.position, transform.rotation) as BoidFlocking; boid.transform.parent = transform; boid.transform.localPosition = new Vector3( Random.value * collider.bounds.size.x, Random.value * collider.bounds.size.y, Random.value * collider.bounds.size.z) - collider.bounds.extents; boid.controller = this; boid.EnterState(initState); boids.Add(boid); } }
void Start() { for (int i = 0; i < flockSize; i++) { BoidFlocking boid = Instantiate(prefab, transform.position, transform.rotation) as BoidFlocking; boid.transform.parent = transform; boid.transform.localPosition = new Vector3( Random.value * collider.bounds.size.x, Random.value * collider.bounds.size.y, Random.value * collider.bounds.size.z) - collider.bounds.extents; boid.rigidbody.velocity = new Vector3( Random.value * maxSpeed, Random.value * maxSpeed, Random.value * maxSpeed); boid.rigidbody.velocity *= 0.8f; boid.target = new Vector3(collider.bounds.center.x, collider.bounds.center.y, collider.bounds.center.z); boid.mTargetAttraction = targetAttraction; boids.Add(boid); } }
public void RemoveBoid(BoidFlocking boid) { _boids.Remove(boid); Destroy(boid.gameObject); }
public void TargetBy(BoidFlocking boid) { boids.Add(boid); boid.SetTarget(transform); }
public void Release(BoidFlocking boid) { boid.landingPt = null; boids.Remove(boid); }
public void Release(BoidFlocking boid) { Debug.Assert(boid == this.boid); boid.landingPt = null; this.boid = null; }
public void TargetBy(BoidFlocking boid) { boid.SetTarget(transform); this.boid = boid; }
public void RemoveBoid(BoidFlocking _b) { boids.Remove(_b); GameObject.Destroy(_b.gameObject); flockSize = boids.Count; }