public virtual bool OnCollidedWith(Fixture f, UserControlledCharacter obj, Fixture f2, Contact info) { if (Engine.CameraLock) { Engine.CameraLock = false; } return false; }
public override bool OnCollidedWith(Fixture f1, UserControlledCharacter character, Fixture f2, FarseerPhysics.Dynamics.Contacts.Contact contact) { if (!character.Invulnerable) { character.TakeDamage(25, true, true); Dead = true; } return false; }
public virtual bool OnCollidedWith(Fixture f, UserControlledCharacter obj, Fixture f2, Contact info) { if (!used) { var waver = new Waver(Position - new Vector2(0, PhysicsConstants.PixelsToMeters(800))); levelManager.RegisterEntity(waver); used = true; } return true; }
public virtual bool OnCollidedWith(Fixture f, UserControlledCharacter obj, Fixture f2, Contact info) { if (f2.UserData.Equals("Ladder")) { var bridge = (WireBridge)engineGame.LevelManager.Level.Entities.First(x => x.InstanceId == WireBridgeId); bridge.ElectrifyWire(); return true; } else return false; }
bool DetectedPlayer(Fixture sensor, UserControlledCharacter ch, Fixture f, Contact c) { if (!midLunge) { character = ch; midLunge = true; Physics.IgnoreGravity = false; var force = character.Position - Physics.Position; Physics.ApplyForce((force - Vector2.UnitY * 2) * 400); if (force.X > 0 && WheelSpeed < 0 || force.X < 0 && WheelSpeed > 0) WheelSpeed *= -1; } return c.Enabled; }
public virtual bool OnCollidedWith(Fixture f, UserControlledCharacter obj, Fixture f2, Contact info) { if (!used) { var monster = new TutorialMonster(Position - PhysicsConstants.PixelsToMeters(new Vector2(300, 800)), Vector2.UnitX); levelManager.RegisterEntity(monster); monster.StartChase(); Engine.CameraLock = true; Engine.Camera.MoveCameraTo(new Vector3(-PhysicsConstants.MetersToPixels(obj.Position.X) + 400, -PhysicsConstants.MetersToPixels(obj.Position.Y) + 400, 0)); used = true; } return true; }
public virtual bool OnCollidedWith(Fixture f, UserControlledCharacter obj, Fixture f2, Contact info) { if (!used) { if (!engineGame.ScreenManager.IsInDialogueState() && DialogueId != null) { engineGame.ScreenManager.AddScreen(DialogueScreen.InitializeDialogueBox(new Guid(DialogueId)), null); //this functionality needs to be abstracted out somehow var tutorialTrigger = engineGame.LevelManager.Level.Entities.First(x => x.InstanceId.Equals("movement info")) as TutorialTrigger; tutorialTrigger.Active = true; tutorialTrigger.RecheckCollision(); used = true; } } return true; }
public bool OnCollidedWith(Fixture f, UserControlledCharacter c, Fixture cf, Contact info) { if (!activating && !activated) { Engine.LevelManager.LevelCache.ReplaceOrAdd( "Save", new Save(Engine.LevelManager.LevelPath, SpawnPoint, c.Health, c.Mana, c.Inventory.ToList())); activating = true; } return true; }
protected override void LevelLoaded() { base.LevelLoaded(); if (Character != null) Character.LogLevelSummary(); // backgroundTrack.PlaySound(); Should get baked into the levels, not the timesink game Logger.Info(String.Format("LEVEL TIME(ms): {0}", levelTime)); levelTime = 0f; levelStarted = true; var save = ((Save)LevelManager.LevelCache["Save"]); Logger.Info(String.Format("LEVEL: {0}", save.LevelPath)); Character = new UserControlledCharacter( spawnPoint >= 0 ? LevelManager.Level.SpawnPoints[spawnPoint] : LevelManager.Level.DefaultStart) { Health = loadBecauseDead ? save.PlayerHealth : Character.Health, Mana = loadBecauseDead ? save.PlayerMana : Character.Mana, Inventory = loadBecauseDead ? save.Inventory : Character.Inventory }; Character.Load(Container); LevelManager.RegisterEntity(Character); if (Character.Inventory.Count != 0 && Character.Inventory[0] is EnergyGun) { EnergyGun gun = (EnergyGun)Character.Inventory[0]; gun.Character = Character; LevelManager.RegisterEntity(gun); } spawnPoint = -1; LevelManager.RenderManager.RegisterRenderable(healthBar); LevelManager.RenderManager.RegisterRenderable(manaBar); if (Character != null) { healthBar.UpdateHealth(Character); manaBar.UpdateMana(Character); } }
public void OnSeparation(Fixture f1, UserControlledCharacter c, Fixture f2) { game.LevelManager.RenderManager.UnregisterRenderable(popup); collided = false; }
public bool OnCollidedWith(Fixture f, UserControlledCharacter c, Fixture cf, Contact info) { collided = true; game.LevelManager.RenderManager.RegisterRenderable(popup); return true; }
public bool OnCollidedWith(Fixture f, UserControlledCharacter c, Fixture cf, Contact info) { if (popupTrigger != null && !registered) { engine.LevelManager.RenderManager.RegisterRenderable(popupTrigger); registered = true; } return true; }
public bool OnCollidedWith(Fixture f, UserControlledCharacter c, Fixture cf, Contact info) { c.AddSlideTrigger(this); return true; }
bool OnCollidedWithDetachSensor(Fixture f, UserControlledCharacter c, Fixture cf, Contact info) { if(InputManager.Instance.ActionHeld(InputManager.ButtonActions.DownAction)) { c.CanClimb = null; c.DismountLadder(linearDamping); } return info.Enabled; }
private bool OnCollidedWith(Fixture f1, UserControlledCharacter collidedWith, Fixture f2, Contact contact) { character = collidedWith; return true; }
public void DismountCharacter(UserControlledCharacter c) { c.DismountLadder(linearDamping); }
public void ChargeInitiated(UserControlledCharacter character, GameTime gameTime) { charged = character.Mana > 0; this.character = character; if (charged) Engine.LevelManager.PhysicsManager.GlobalReferenceScale = TIME_SCALE; }
public void OnSeparation(Fixture f1, UserControlledCharacter c, Fixture f2) { character = null; if (popup != null) { engine.LevelManager.RenderManager.UnregisterRenderable(popup); registered = false; } collided = false; }
public void Fire(UserControlledCharacter character, EngineGame world, GameTime gameTime, double holdTime, bool charged) { Character = character; if (timeSinceLastShot >= TIME_BETWEEN_SHOTS * Engine.LevelManager.PhysicsManager.GlobalReferenceScale && !reloading && ammo > 0) { timeSinceLastShot = 0; EnergyBullet bullet = new EnergyBullet( new Vector2(character.Physics.Position.X,// + UserControlledCharacter.X_OFFSET, character.Physics.Position.Y + Y_OFFSET), 20, 20, PhysicsConstants.PixelsToMeters(BULLET_SPEED * character.Direction)); ammo -= 1; if (ammo <= 0) { Reload(); } world.LevelManager.RegisterEntity(bullet); } }
public void ChargeReleased(UserControlledCharacter character, GameTime gameTime) { charged = false; Engine.LevelManager.PhysicsManager.GlobalReferenceScale = 1; }
bool OnCollidedWith(Fixture f, UserControlledCharacter c, Fixture cf, Contact info) { /* rectExit = false; wheelExit = false; wheelExit1 = false; //Enable the character to enter a climbing state thus effecting her input handling if (info.FixtureA.UserData == null && info.FixtureB.UserData == null) { feetTouching = false; } else if ((info.FixtureA.UserData != null && info.FixtureA.UserData.Equals("Rectangle")) || (info.FixtureB.UserData != null && info.FixtureB.UserData.Equals("Rectangle"))) { Physics.IsSensor = true; feetTouching = true; } */ if (info.FixtureA.UserData != null && info.FixtureA.UserData.Equals("Ladder") || info.FixtureB.UserData != null && info.FixtureB.UserData.Equals("Ladder")) { if (!c.Climbing) { linearDamping = c.Physics.LinearDamping; } c.CanClimb = this; return true; } else return false; }
public void ChargeInitiated(UserControlledCharacter character, GameTime gameTime) { }
void OnSeparation(Fixture f1, UserControlledCharacter c, Fixture f2) { if (f2.UserData != null) { /* if (f2.UserData.Equals("Circle")) { c.CanClimb = null; c.Physics.IgnoreGravity = false; c.Physics.LinearDamping = linearDamping; if (wheelExit1) wheelExit = true; else wheelExit1 = true; } else if (f2.UserData.Equals("Rectangle")) { rectExit = true; } if (rectExit && wheelExit && wheelExit1) { c.CanClimb = null; if (c.Climbing) { c.DismountLadder(); } c.Physics.IgnoreGravity = false; c.Physics.LinearDamping = linearDamping; c.Climbing = false; } */ if(f2.UserData.Equals("Ladder")) { if (f1.UserData != null && f1.UserData.Equals("detach")) { } else { c.CanClimb = null; if (c.Climbing) { c.DismountLadder(linearDamping); } } } } /* else if (feetTouching == false) { c.CanClimb = null; c.Physics.LinearDamping = linearDamping; c.Physics.IgnoreGravity = false; } */ }
public void ChargeReleased(UserControlledCharacter character, GameTime gameTime) { }
private void OnSeperatedWith(Fixture f1, UserControlledCharacter e2, Fixture f2) { character = null; }
public void Fire(UserControlledCharacter character, EngineGame world, GameTime gameTime, double holdTime, bool charged) { character.InHold = false; var elapsedTime = Math.Min(gameTime.TotalGameTime.TotalSeconds - holdTime, MAX_GRENADE_HOLD); // linear interp: y = 500 + (x - 0)(1300 - 500)/(MAX_HOLD-0) x = elapsedTime float speed = MIN_GRENADE_INIT_SPEED + (MAX_GRENADE_INIT_SPEED - MIN_GRENADE_INIT_SPEED) / MAX_GRENADE_HOLD * (float)elapsedTime; Vector2 initialVelocity = PhysicsConstants.PixelsToMeters(speed * character.Direction); if (character.Direction.Y == 0) { var rotation = (float)Math.PI / 32; rotation *= character.Direction.X > 0 ? -1 : 1; initialVelocity = Vector2.Transform(initialVelocity, Matrix.CreateRotationZ(rotation)); } TimeGrenade grenade = new TimeGrenade( new Vector2(character.Physics.Position.X,// + UserControlledCharacter.X_OFFSET, character.Physics.Position.Y + UserControlledCharacter.Y_OFFSET), initialVelocity, DEFAULT_FUSE_TIME, DEFAULT_LINGER_TIME); world.LevelManager.RegisterEntity(grenade); }
public void OnSeparation(Fixture f1, UserControlledCharacter c, Fixture f2) { if (popupTrigger != null && !registered) { engine.LevelManager.RenderManager.UnregisterRenderable(popupTrigger); registered = false; } }
public void Use(UserControlledCharacter character, EngineGame world, GameTime gameTime, double holdTime, bool charged) { Fire(character, world, gameTime, holdTime, charged); }
public void OnSeparation(Fixture f1, UserControlledCharacter c, Fixture f2) { c.RemoveSlideTrigger(this); }
protected override bool OnCollidedWith(Fixture f, UserControlledCharacter c, Fixture cf, Contact info) { this.PatrolDirection *= -1; return true; }