示例#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
 public void EnteringPlayerCell(Body playerBody)
 {
     _state            = VirusCellState.SuckedIn;
     Strategy          = new StationaryStrategy();
     Body.CollidesWith = Category.All & ~Category.Cat10 & ~Category.Cat5;
     Body.Mass         = 1;
     CreatePlayerJoint(playerBody);
 }
示例#3
0
 public void Dropped()
 {
     if (IsGrabbed())
     {
         _state            = VirusCellState.Normal;
         Body.Mass         = 2.2f;
         Body.CollidesWith = Category.All;
     }
 }
示例#4
0
文件: Virus.cs 项目: em-mo/sommarhack
        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;
        }
示例#5
0
文件: Virus.cs 项目: em-mo/sommarhack
 public void Grabbed()
 {
     _state = VirusCellState.Grabbed;
     Body.Mass = 0.1f;
 }
示例#6
0
文件: Virus.cs 项目: em-mo/sommarhack
 public void EnteringPlayerCell(Body playerBody)
 {
     _state = VirusCellState.SuckedIn;
     Strategy = new StationaryStrategy();
     Body.CollidesWith = Category.All & ~Category.Cat10 & ~Category.Cat5;
     Body.Mass = 1;
     CreatePlayerJoint(playerBody);
 }
示例#7
0
文件: Virus.cs 项目: em-mo/sommarhack
 public void Dropped()
 {
     if (IsGrabbed())
     {
         _state = VirusCellState.Normal;
         Body.Mass = 2.2f;
         Body.CollidesWith = Category.All;
     }
 }
示例#8
0
文件: Virus.cs 项目: em-mo/sommarhack
 public void Consumed()
 {
     _state = VirusCellState.Consumed;
     Body.CollidesWith = Category.All & ~Category.Cat5;
     RemovePlayerJoint();
 }
示例#9
0
 public void Grabbed()
 {
     _state    = VirusCellState.Grabbed;
     Body.Mass = 0.1f;
 }
示例#10
0
 public void Consumed()
 {
     _state            = VirusCellState.Consumed;
     Body.CollidesWith = Category.All & ~Category.Cat5;
     RemovePlayerJoint();
 }