public void SpriteAnimationFinished() { if (thrown) { transitionSet.ToIdle(player); } else { transitionSet.ToBarrelThrown(player); player.Sprite.AnimationDelegate = this; thrown = true; int direction = -1; if (player.FacingRight) { direction *= -1; } player.HorizontalImpulse = 0.0f; DKThrownBarrel thrownBarrel = new DKThrownBarrel(); thrownBarrel.HorizontalImpulse *= direction; thrownBarrel.Body.BottomCenter = player.Body.BottomCenter + new Microsoft.Xna.Framework.Vector2(0, THROW_DISPLACEMENT); WorldManager.Instance.AddObject(thrownBarrel); } }
public DKThrowBarrelBrokenState(DKThrownBarrel item) { this.item = item; //Cant move an object with no body, will need another movmement scheme if we implement //item.Body.ApplyImpulse(new Vector2(-2, -1)); PhysicsWorld.Instance.DestroyBody(this.item.Body); WorldManager.Instance.RemoveObject(this.item); }
public EnemyDieByBarrelCommand(IGameObject enemyObj, IGameObject barrelObj) { enemy = (IEnemy)enemyObj; barrel = (DKThrownBarrel)barrelObj; }
public DKThrownBarrelRollState(DKThrownBarrel item) { this.item = item; item.Sprite = ItemSpriteFactory.Instance.CreateDKBarrelRollSprite(); SoundPool.PlaySound(Sound.CollectibleBarrelRoll); }