new public bool OnCollision(Fixture f1, Fixture f2, Physics.Dynamics.Contacts.Contact c) { // Check if f2 is player if (f2 == SolitudeScreen.ship.Player.PlayerFixture) { SolitudeScreen.ship.Player.oxygen -= Settings.maulerDamage; } return(true); }
public override bool OnCollision(Fixture f1, Fixture f2, Physics.Dynamics.Contacts.Contact c) { f2.Body.AngularVelocity = 0f; f2.Body.LinearVelocity = Vector2.Zero; if (f2 == SolitudeScreen.ship.Player.PlayerFixture) { IsColliding = true; SolitudeScreen.ship.Player.onWall = true; } return(true); }
public bool OnCollision(Fixture f1, Fixture f2, Physics.Dynamics.Contacts.Contact c) { if (f2 == SolitudeScreen.ship.Player.PlayerFixture) { if (DateTime.Now - lastCollided >= TimeSpan.FromSeconds(1)) { lastCollided = DateTime.Now; SolitudeScreen.ship.Player.oxygen -= 50; } } return(true); }
public new bool OnCollision(Fixture f1, Fixture f2, Physics.Dynamics.Contacts.Contact c) { if (f2 != senderFixture) { if (f2 == SolitudeScreen.ship.Player.PlayerFixture) { SolitudeScreen.ship.Player.oxygen -= Settings.BulletDamage; } world.RemoveBody(body); SolitudeScreen.ship.contents.Remove(this); } return(true); }
new public bool OnCollision(Fixture f1, Fixture f2, Physics.Dynamics.Contacts.Contact c) { // Check if f2 is player if (f2 == SolitudeScreen.ship.Player.PlayerFixture && type != WallType.Smooth) { if (type == WallType.HandHold) //grab on to wall { SolitudeScreen.ship.Player.body.LinearVelocity = Vector2.Zero; SolitudeScreen.ship.Player.body.AngularVelocity = 0f; SolitudeScreen.ship.Player.onWall = true; SolitudeScreen.ship.Player.standingOn = this; } else if (SolitudeScreen.ship.Player.hasGloves && type == WallType.Grip) // grab if player has gloves { SolitudeScreen.ship.Player.body.LinearVelocity = Vector2.Zero; SolitudeScreen.ship.Player.body.AngularVelocity = 0f; SolitudeScreen.ship.Player.onWall = true; SolitudeScreen.ship.Player.standingOn = this; } else if (SolitudeScreen.ship.Player.hasBoots && type == WallType.Metal) // grab if player has boots { SolitudeScreen.ship.Player.body.LinearVelocity = Vector2.Zero; SolitudeScreen.ship.Player.body.AngularVelocity = 0f; SolitudeScreen.ship.Player.onWall = true; SolitudeScreen.ship.Player.standingOn = this; } else //otherwise { switch (type) //switch because player info is irrelevant { case WallType.Cold: break; case WallType.Hot: SolitudeScreen.ship.Player.oxygen -= 100; break; case WallType.Spike: break; } } } // Check if f2 is other item (ie block) return(true); }
public virtual bool OnCollision(Fixture f1, Fixture f2, Physics.Dynamics.Contacts.Contact c) { f2.Body.AngularVelocity = 0f; f2.Body.LinearVelocity = Vector2.Zero; return(true); }