SetMarioProperties() public method

public SetMarioProperties ( ) : void
return void
コード例 #1
0
        public override void Intersection(Collision c, GraphicObject g)
        {
            base.Intersection(c, g);

            switch (g.OT)
            {
            case ObjectType.OT_Mario:
            {
                // Handle collision with Mario
                if (Move != PiranaMove.PM_None) // Only if the pirana is out of its pipe
                {
                    Mario m = (Mario)g;
                    if (!m.Blinking)
                    {
                        if (m.Type == Mario.MarioType.MT_Big || m.Type == Mario.MarioType.MT_Fire)
                        {
                            m.Type = Mario.MarioType.MT_Small;
                            m.StartBlinking();
                            m.SetMarioProperties();
                        }
                    }
                }
            }
            break;
            }
        }
コード例 #2
0
        public override void Intersection(Collision c, GraphicObject g)
        {
            base.Intersection(c, g);

            switch (g.OT)
            {
            case ObjectType.OT_BlockQuestion:
            {
                int a = 1;
            } break;

            case ObjectType.OT_Goomba:
            {
                DirX *= -1;
                OnWalk(null, null);
                ((MonsterGoomba)g).DirX *= -1;
                ((MonsterGoomba)g).OnWalk(null, null);
            } break;

            case ObjectType.OT_Mario:
            {
                Mario m = (Mario)g;
                if (c.Dir != CollisionDirection.CD_Down)
                {
                    if (!m.Blinking)
                    {
                        if (m.Type == Mario.MarioType.MT_Big || m.Type == Mario.MarioType.MT_Fire)
                        {
                            m.Type = Mario.MarioType.MT_Small;
                            m.StartBlinking();
                            m.SetMarioProperties();
                        }
                    }
                }
            } break;
            }
        }
コード例 #3
0
        public override void Intersection(Collision c, GraphicObject g)
        {
            base.Intersection(c, g);
            switch (g.OT)
            {
            case ObjectType.OT_SolidBlock:
                goto case ObjectType.OT_PipeUp;

            case ObjectType.OT_BlockQuestion:
                goto case ObjectType.OT_Grass;

            case ObjectType.OT_Brick:
                goto case ObjectType.OT_Grass;

            case ObjectType.OT_Grass:
            {
                StartFireBall();
            } break;

            case ObjectType.OT_PipeUp:
            {
                Started = false;
                Visible = false;
            } break;

            case ObjectType.OT_Goomba:
            {
                if (Type == FireBallType.FT_Mario)
                {
                    ((MonsterGoomba)g).GoombaFallDie();

                    Started = false;
                    Visible = false;
                }
            } break;

            case ObjectType.OT_Koopa:
            {
                if (Type == FireBallType.FT_Mario)
                {
                    ((MonsterKoopa)g).SetKoopaState(MonsterKoopa.KoopaState.KS_Shield);

                    Started = false;
                    Visible = false;
                }
            } break;

            case ObjectType.OT_Pirana:
            {
                if (Type == FireBallType.FT_Mario &&
                    ((MonsterPiranah)g).Move != MonsterPiranah.PiranaMove.PM_None)            // Only kill pirana if it's out of its pipe
                {
                    ((MonsterPiranah)g).Visible = false;
                    ((MonsterPiranah)g).Live    = false;
                }
            } break;

            // Handle fireball hitting Mario
            case ObjectType.OT_Mario:
            {
                if (Type != FireBallType.FT_Mario)       // Make sure it isn't Mario's fireball
                {
                    Mario m = (Mario)g;
                    if (!m.Blinking)
                    {
                        if (m.Type == Mario.MarioType.MT_Big || m.Type == Mario.MarioType.MT_Fire)
                        {
                            m.Type = Mario.MarioType.MT_Small;
                            m.StartBlinking();
                            m.SetMarioProperties();
                        }
                    }
                }
            } break;
            }
        }
コード例 #4
0
        public override void Intersection(Collision c, GraphicObject g)
        {
            base.Intersection(c, g);

            switch (g.OT)
            {
            case ObjectType.OT_Brick:
            {
                if (State == KoopaState.KS_ShieldMoving)
                {
                    if (c.Dir == CollisionDirection.CD_Left || c.Dir == CollisionDirection.CD_Right)
                    {
                        ((BlockBrick)g).BreakBrick();
                    }
                }
            } break;

            case ObjectType.OT_Goomba:
            {
                if (State == KoopaState.KS_ShieldMoving)
                {
                    ((MonsterGoomba)g).GoombaFallDie();
                }
                if (State == KoopaState.KS_Walking)
                {
                    ((MonsterGoomba)g).DirX *= -1;
                    ((MonsterGoomba)g).newx += 5 * ((MonsterGoomba)g).DirX;

                    ((MonsterGoomba)g).OnWalk(null, null);
                    DirX *= -1;
                    OnWalk(null, null);
                }
                if (State == KoopaState.KS_Shield)
                {
                    ((MonsterGoomba)g).DirX *= -1;
                    ((MonsterGoomba)g).newx += 5 * ((MonsterGoomba)g).DirX;
                    ((MonsterGoomba)g).OnWalk(null, null);
                }
            } break;

            case ObjectType.OT_Mario:
            {
                if (State == KoopaState.KS_Shield && ReturningTime >= 3)
                {
                    if (c.Dir == CollisionDirection.CD_Left)
                    {
                        DirX = -1;
                    }

                    if (c.Dir == CollisionDirection.CD_Right)
                    {
                        DirX = 1;
                    }

                    SetKoopaState(KoopaState.KS_ShieldMoving);
                }

                // Size-down mario when colliding with a koopa
                if (State != KoopaState.KS_Shield)         // but not in shield state
                {
                    if (!(State == KoopaState.KS_ShieldMoving &&    // Or that he's just set in motion
                          (DirX == -1 && c.Dir == CollisionDirection.CD_Left) || (DirX == 1 && c.Dir == CollisionDirection.CD_Right)))
                    {
                        Mario m = (Mario)g;
                        if (c.Dir != CollisionDirection.CD_Down)
                        {
                            if (!m.Blinking)
                            {
                                if (m.Type == Mario.MarioType.MT_Big || m.Type == Mario.MarioType.MT_Fire)
                                {
                                    m.Type = Mario.MarioType.MT_Small;
                                    m.StartBlinking();
                                    m.SetMarioProperties();
                                }
                            }
                        }
                    }
                }
                break;
            }
            }
        }