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); }
public void EnteringPlayerCell(Body playerBody) { _state = VirusCellState.SuckedIn; Strategy = new StationaryStrategy(); Body.CollidesWith = Category.All & ~Category.Cat10 & ~Category.Cat5; Body.Mass = 1; CreatePlayerJoint(playerBody); }
public void Dropped() { if (IsGrabbed()) { _state = VirusCellState.Normal; Body.Mass = 2.2f; Body.CollidesWith = Category.All; } }
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; }
public void Grabbed() { _state = VirusCellState.Grabbed; Body.Mass = 0.1f; }
public void Consumed() { _state = VirusCellState.Consumed; Body.CollidesWith = Category.All & ~Category.Cat5; RemovePlayerJoint(); }