public override Entity Create(Point position, Enum id) { MarioContext mc = new MarioContext(Level, position, this); mc.PowerUpStates.CurrentState = (PowerUpEnum)id; return(mc); }
public StateList <PowerUpState, PowerUpEnum> CreatePowerUpStates(MarioContext context) { PowerUpState[] powerUpStates = new PowerUpState[powers.Count]; foreach (KeyValuePair <PowerUpEnum, Func <MarioContext, Sprite[], PowerUpState> > t in powers) { powerUpStates[(int)t.Key] = t.Value(context, CreateSprites(t.Key)); } return(new StateList <PowerUpState, PowerUpEnum>(powerUpStates, NORMAL)); }
public StateList <ActionState, ActionEnum> CreateActionStates(MarioContext context) { ActionState[] actionStates = new ActionState[actions.Count]; foreach (KeyValuePair <ActionEnum, Func <MarioContext, ActionState> > t in actions) { actionStates[(int)t.Key] = t.Value(context); } return(new StateList <ActionState, ActionEnum>(actionStates, STANDING)); }
protected PowerUpState(MarioContext context, Sprite[] sprites, Bounds box) : base(context) { this.sprites = sprites; foreach (var s in sprites) { s.Layer = 0.55f; } Context.Solid = true; this.BoundingBox = box; }
public StarState CreateStarState(MarioContext context) { Texture2D texture = Content.Load <Texture2D>("Sprites/StarMario"); Dictionary <ActionEnum, Point[]> animations = new Dictionary <ActionEnum, Point[]>(); Dictionary <ActionEnum, int> delay = new Dictionary <ActionEnum, int>(); animations[DEATH] = new[] { new Point(16, 0) }; delay[FLAG] = 4; animations[WALKING] = new[] { new Point(208, 0), new Point(224, 0), new Point(240, 0) }; animations[STANDING] = new[] { new Point(144, 0) }; animations[JUMPING] = new[] { new Point(176, 0) }; animations[FLAG] = new[] { new Point(128, 0), new Point(112, 0) }; animations[CROUCHING] = new[] { new Point(160, 0) }; Sprite[,] sprites = new Sprite[actions.Count, 3]; Sprite[,] supersprites = new Sprite[actions.Count, 3]; for (int j = 0; j < 3; j++) { (Point[] large, Point[] small)[] anim = animations.OrderBy(p => p.Key)
public WalkingState(MarioContext context) : base(context) { }
public StandingState(MarioContext context) : base(context) { }
public FlagState(MarioContext context) : base(context) { }
public DeathState(MarioContext context) : base(context) { }
public CrouchingState(MarioContext context) : base(context) { }
public JumpingState(MarioContext context) : base(context) { }
protected ActionState(MarioContext context) : base(context) { }
public FireState(MarioContext context, Sprite[] sprites) : base(context, sprites) { }
public SuperState(MarioContext context, Sprite[] sprites) : base(context, sprites, new Bounds(context, Color.Yellow, new Vector2(0, 0), new Vector2(16, 32))) { }
protected MarioState(MarioContext context) { this.Context = context; }