Пример #1
0
        public override bool ObjectCollision(FarseerPhysics.Dynamics.Fixture f1, FarseerPhysics.Dynamics.Fixture f2, FarseerPhysics.Dynamics.Contacts.Contact contact)
        {
            Object o1, o2;

            o1 = f1.Body.UserData;
            o2 = f2.Body.UserData;
            GoodCell goodCell;

            if (o2 is GoodCell)
            {
                goodCell = (GoodCell)o2;
            }
            else if (o2 is PlayerCell)
            {
                return(false);
            }
            else
            {
                return(true);
            }

            // If cell resistance is low enough, enter the cell and go towards the center
            if (IsNormal() && goodCell.VirusCollide(this))
            {
                _state = VirusCellState.Assimilating;
                Body.IgnoreCollisionWith(goodCell.Body);
                _targetCell        = goodCell;
                Strategy           = new VirusAssimilateStrategy(goodCell);
                Body.LinearDamping = 10;
            }

            return(true);
        }
Пример #2
0
 private void HandleFriendly(Point currentPoint, Color dotColor, Color[] colorData, Level level)
 {
     Point position = GetCenterPoint(currentPoint, dotColor, colorData);
     GoodCell goodCell = new GoodCell(PlayWindow, PointToPosition(position));
     level.AddFriendly(goodCell);
 }
Пример #3
0
        public override bool ObjectCollision(FarseerPhysics.Dynamics.Fixture f1, FarseerPhysics.Dynamics.Fixture f2, FarseerPhysics.Dynamics.Contacts.Contact contact)
        {
            Object o1, o2;
            o1 = f1.Body.UserData;
            o2 = f2.Body.UserData;
            GoodCell goodCell;
            if (o2 is GoodCell)
                goodCell = (GoodCell)o2;
            else if (o2 is PlayerCell)
                return false;
            else
                return true;

            // If cell resistance is low enough, enter the cell and go towards the center
            if (IsNormal() && goodCell.VirusCollide(this))
            {
                _state = VirusCellState.Assimilating;
                Body.IgnoreCollisionWith(goodCell.Body);
                _targetCell = goodCell;
                Strategy = new VirusAssimilateStrategy(goodCell);
                Body.LinearDamping = 10;
            }

            return true;
        }
Пример #4
0
        private void TestInit()
        {
            World = new World(Vector2.Zero);

            _objectList = new List<ActiveGameObject>();

            _player = new PlayerCell(this, new Vector2(0));

            GoodCell goodCell = new GoodCell(this, new Vector2(300, 100));
            GoodCellList.Add(goodCell);
            _objectList.Add(goodCell);
            _objectList.Add(new Virus(this, new Vector2(200, -200)));

            //Vertices vertices = new Vertices();
            //vertices.Add(new Vector2(-300, -200));
            //vertices.Add(new Vector2(-200, -150));
            //vertices.Add(new Vector2(-100, -200));
            //vertices.Add(new Vector2(-160, -300));
            //vertices.Add(new Vector2(-240, -300));

            //_wallList.Add(new Wall(vertices, Wall.WallType.Outer, this));

            Vertices vertices = new Vertices();
            vertices.Add(new Vector2(-200, 200));
            vertices.Add(new Vector2(-150, 225));
            vertices.Add(new Vector2(-100, 200));
            vertices.Add(new Vector2(-125, 250));
            vertices.Add(new Vector2(-100, 300));
            vertices.Add(new Vector2(-150, 275));
            vertices.Add(new Vector2(-200, 300));
            vertices.Add(new Vector2(-175, 250));

            _wallList.Add(new Wall(vertices, Wall.WallType.Outer, this));
        }
Пример #5
0
 public void RemoveGoodCell(GoodCell goodCell)
 {
     GoodCellList.Remove(goodCell);
     _removeList.Add(goodCell);
     goodCell.UpForRemoval = true;
 }
Пример #6
0
 public void RegisterGoodCell(GoodCell goodCell)
 {
     _addList.Add(goodCell);
 }