Beispiel #1
0
        public override void Drop()
        {
            _eMyState = State.Alone;

            if (_CollidingObject != null)
            {
                GameObjectManager manager = GameObjectManager.Instance;
                if (_CollidingObject is PersonFlock)
                {
                    manager.RemoveObject(this);
                    ((PersonFlock)_CollidingObject).AddPerson(this);
                }
                else if (_CollidingObject is Person)
                {
                    // Create a flock from the two people who just collided

                    manager.RemoveObject(this);
                    manager.RemoveObject(_CollidingObject);

                    _eMyState = State.Limbo;
                    ((Person)_CollidingObject)._eMyState = State.Limbo;

                    PersonFlock flock = new PersonFlock(this.Location);
                    flock.AddPerson(this);
                    flock.AddPerson((Person)_CollidingObject);
                    flock.Location = this.Location;
                    manager.AddObject(flock);
                    GameObjectManager.Instance.NumGroupsFormed++;

                    if (_CollidingObject.EatingObject != null)
                    {
                        _CollidingObject.EatingObject.StopEating(_CollidingObject);
                        _CollidingObject.EatingObject = null;
                    }
                }

                _CollidingObject = null;
            }
        }
Beispiel #2
0
 public void AddedToFlock(PersonFlock aFlock)
 {
     ParentFlock = aFlock;
     _eMyState = State.Flocking;
 }