Esempio n. 1
0
        public override Entity Create(Point position, Enum id)
        {
            MarioContext mc = new MarioContext(Level, position, this);

            mc.PowerUpStates.CurrentState = (PowerUpEnum)id;
            return(mc);
        }
Esempio n. 2
0
 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));
 }
Esempio n. 3
0
 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));
 }
Esempio n. 4
0
 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;
 }
Esempio n. 5
0
        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)
Esempio n. 6
0
 public WalkingState(MarioContext context) : base(context)
 {
 }
Esempio n. 7
0
 public StandingState(MarioContext context) : base(context)
 {
 }
Esempio n. 8
0
 public FlagState(MarioContext context) : base(context)
 {
 }
Esempio n. 9
0
 public DeathState(MarioContext context) : base(context)
 {
 }
Esempio n. 10
0
 public CrouchingState(MarioContext context) : base(context)
 {
 }
Esempio n. 11
0
 public JumpingState(MarioContext context) : base(context)
 {
 }
Esempio n. 12
0
 protected ActionState(MarioContext context) : base(context)
 {
 }
Esempio n. 13
0
 public FireState(MarioContext context, Sprite[] sprites)
     : base(context, sprites)
 {
 }
Esempio n. 14
0
 public SuperState(MarioContext context, Sprite[] sprites)
     : base(context, sprites, new Bounds(context, Color.Yellow, new Vector2(0, 0), new Vector2(16, 32)))
 {
 }
Esempio n. 15
0
 protected MarioState(MarioContext context)
 {
     this.Context = context;
 }