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 static int MarioSpriteType(IMarioActionState a, bool Facing) //bit adding to find correct action state enum. { int buildMario = 0x010; //default to crouching switch (a) { case Falling _: buildMario += 0x030; break; case Idling _: buildMario += 0x020; break; case Jumping _: buildMario += 0x030; break; case Running _: buildMario += 0x040; break; } if (Facing)//right { buildMario += 0x050; } return(buildMario); }
public override void Enter(IMarioActionState preState) { CurrentState = this; PreviousState = preState; Mario.Sprite = Mario.Factory.MarioSprite(Mario.PowerState, CurrentState, Mario.Facing, Mario.SpritePosition); if (Mario.Facing) { Mario.SpriteVelocity = new Vector2(3, 0); } else { Mario.SpriteVelocity = new Vector2(-3, 0); } //if (Mario.Facing&&(int)velocity.X==0)//right //{ // Mario.SpriteVelocity = new Vector2(3, 0); //} //else if ((int) velocity.X == 0) //left //{ // Mario.SpriteVelocity = new Vector2(-3, 0); //} //else //{ // Mario.SpriteVelocity = new Vector2(velocity.X, 0); //} }
public MarioHoldingShellState(Mario context, AbstractKoopa koopa, IMarioActionState state) : base(context) { Previous = state; koopa.Held = true; _koopa = koopa; koopa.Collidable = false; }
public override void Enter(IMarioActionState preState) { PreviousState = preState.PreviousState;//should be idle CurrentState = this; Mario.Sprite = Mario.Factory.MarioSprite(Mario.PowerState, PreviousState, Mario.Facing, Mario.SpritePosition); Mario.SpriteVelocity = Mario.Pipe.WarpVelocity; Mario.Sounds.PlaySound(EventSoundEffects.EventSounds.PipeTravel); }
public override void Enter(IMarioActionState preState) { CurrentState = this; PreviousState = preState; if (!(Mario.PowerState is MarioStandardState)) { Mario.Sprite = Mario.Factory.MarioSprite(Mario.PowerState, CurrentState, Mario.Facing, Mario.SpritePosition); } }
public override void Enter(IMarioActionState preState) { Mario.Sounds.PlaySound(Mario.Jumping); CurrentState = this; PreviousState = preState; Vector2 velocity = Mario.SpriteVelocity; Mario.Sprite = Mario.Factory.MarioSprite(Mario.PowerState, CurrentState, Mario.Facing, Mario.SpritePosition); Mario.SpriteVelocity = new Vector2(velocity.X, -5); }
public override void Enter(IMarioActionState preState) { CurrentState = this; PreviousState = preState; if (preState is Jumping) { PreviousState = preState.PreviousState; } Velocity = Mario.SpriteVelocity; Mario.Sprite = Mario.Factory.MarioSprite(Mario.PowerState, CurrentState, Mario.Facing, Mario.SpritePosition); Mario.SpriteVelocity = new Vector2(Velocity.X, 5); }
public virtual void SetPrevious(IMarioActionState newPrevious) { Previous = newPrevious; }
public MarioActionStateJump(Mario context, IMarioActionState state) : base(context) { Previous = state; }
public void Falling() { CurrentState.ExitState(); CurrentState = new Falling(Mario); CurrentState.Enter(this); }
public void Idle() { CurrentState.ExitState(); CurrentState = new Idling(Mario); CurrentState.Enter(this); }
public virtual void Enter(IMarioActionState preState) { CurrentState = this; PreviousState = preState; Mario.Sprite = Mario.Factory.MarioSprite(Mario.PowerState, CurrentState, Mario.Facing, Mario.SpritePosition); }