Example #1
0
        private void DeleteFlockingActor()
        {
//			int ran = Random.Range (0, count - 1);
            FlockingController randomactor = _flock.ToArray()[0];

            Destroy(randomactor.gameObject);
            _flock.Dequeue();
            count -= 1;
        }
Example #2
0
        //private List<FlockingController> allActors;

        private FlockingController CreateFlockingActor()
        {
            FlockingController newActor = Instantiate <FlockingController>(_flockingActorPrefab);

            newActor.gameObject.name    = "Flocking Actor";
            newActor.transform.position = new Vector3(Random.Range(-SPAWN_RANGE, SPAWN_RANGE), Random.Range(-SPAWN_RANGE, SPAWN_RANGE), 0.0f);
            newActor.GetComponent <OrientedActor>().initialVelocity = Random.onUnitSphere * Random.Range(5.0f, newActor.GetComponent <IActor>().MaxSpeed);
            newActor.gameObject.SetActive(true);
            newActor.GetComponent <FlockingController> ().flocking = FlockingController.flockStatus;
            //newActor.GetComponent<FlockingController> ().pursuer = FindObjectOfType<SimpleActor> ();
            count += 1;
            //	allActors.Add (newActor);
            return(newActor);
        }
Example #3
0
        private void ShowDebug(bool debug)
        {
            FlockingController randomactor = _flock.ToArray() [Random.Range(0, count - 1)];

            if (debug)
            {
                randomactor.DrawNeighborLine(true);
                lastactor = randomactor;
            }
            if (!debug)
            {
                lastactor.DrawNeighborLine(false);
            }
        }