public int MarioPowerUp(IMarioPowerUpState p, int m)//bit shifting to correct combination of 2 states { switch (p) { case MarioStandardState _: break; case MarioSuperState _: m = m << 4; break; case MarioFireState _: m = m << 8; break; case MarioDeadState _: m = (int)Mario.Dead; break; case MarioInvincibleState _: m = m >> 4; break; } return(m); }
public Sprite MarioSprite(IMarioPowerUpState power, IMarioActionState action, bool Facing, Vector2 loc) { int type = MarioSpriteType(action, Facing); type = MarioPowerUp(power, type); return(BuildSprite((Mario)type, loc)); }
public void Enter(IMarioPowerUpState previousState) { CurrentState = this; Vector2 speed = Mario.SpriteVelocity; Mario.Sprite = Mario.Factory.MarioSprite(CurrentState, Mario.ActionState, Mario.Facing, Mario.SpritePosition); Mario.SpriteVelocity = speed; }
public Mario( IWorld world, Point location, IListener <IGameObject> listener, IListener <ISoundable> soundListener) : base( world, location, listener, new Point(), 32) { listener.Subscribe(this); soundListener.Subscribe(this); SoundEventArgs = new SoundArgs(); powerUpState = new Standard(this); movementState = new Standing(this); protectionState = new ProtectionStates.Normal(this); UpdateSprite(); }