コード例 #1
0
    void Start()
    {
        marioStates = new MarioStates();
        _rigidbody  = GetComponent <Rigidbody2D>();

        AdjustScale();
        UpdateMarioHeight();
    }
コード例 #2
0
ファイル: MarioState.cs プロジェクト: FrankHYB/MarioGame
 public void Dead()
 {
     if (!marioIsInvincible)
     {
         //dead overrides pretty much everything
         CurrentSprite = new Sprites.MarioDeadSprite();
         CurrentState = MarioStates.Dead;
     }
 }
コード例 #3
0
ファイル: Game.cs プロジェクト: eddiecityu/T-Academy-1
 public Game(int level, int subLevel, MarioStates playerstate, int coins, int points, int lives)
 {
     this.Level    = level;
     this.SubLevel = subLevel;
     this.State    = playerstate;
     this.Coins    = coins;
     this.Lives    = lives;
     this.Score    = points;
 }
コード例 #4
0
ファイル: Memento.cs プロジェクト: viktorD1m1trov/T-Academy
 public Memento(int mainLevel, int subLevel, MarioStates conditionOfMario, int livesCount, int score, int coins)
 {
     this.Level = mainLevel;
     this.SubLevel = subLevel;
     this.State = conditionOfMario;
     this.Lives = livesCount;
     this.Score = score;
     this.Coins = coins;
 }
コード例 #5
0
ファイル: Game.cs プロジェクト: viktorD1m1trov/T-Academy
 public Game(int level, int subLevel, MarioStates playerstate, int coins, int points, int lives)
 {
     this.Level = level;
     this.SubLevel = subLevel;
     this.State = playerstate;
     this.Coins = coins;
     this.Lives = lives;
     this.Score = points;
 }
コード例 #6
0
 public Memento(int mainLevel, int subLevel, MarioStates conditionOfMario, int livesCount, int score, int coins)
 {
     this.Level    = mainLevel;
     this.SubLevel = subLevel;
     this.State    = conditionOfMario;
     this.Lives    = livesCount;
     this.Score    = score;
     this.Coins    = coins;
 }
コード例 #7
0
ファイル: MarioState.cs プロジェクト: FrankHYB/MarioGame
 public void Crouch()
 {
     if (CurrentState != MarioStates.Dead)
     {
         CurrentState = MarioStates.Crouching;
         if (marioHasFire)
             CurrentSprite = new Sprites.MarioFireCrouchingSprite();
         else if (marioIsLarge)
             CurrentSprite = new Sprites.MarioLargeCrouchingSprite();
     }
 }
コード例 #8
0
ファイル: MarioState.cs プロジェクト: FrankHYB/MarioGame
 public MarioState(Mario mario, Camera cam)
 {
     //assume that we're starting in a small standing mario state untill the first command comes.
     CurrentSprite = new Sprites.MarioSmallStandingSprite();
     facing = SpriteEffects.None;
     marioIsLarge = false;
     marioHasFire = false;
     marioHasStar = false;
     marioIsInvincible = false;
     invincibleCounter = 0;
     myMario = mario;
     CurrentState = MarioStates.Standing;
     camera = cam;
     hitCounter = Constants.hitTimeout;
     itemCounter = Constants.itemTimeout;
     starDrawCounter = 0;
 }
コード例 #9
0
ファイル: MarioState.cs プロジェクト: FrankHYB/MarioGame
 private void reloadSprite()
 {
     switch (CurrentState)
     {
         case MarioStates.Crouching:
             Crouch();
             break;
         case MarioStates.Dead:
             Dead();
             break;
         case MarioStates.Jumping:
             Jump();
             break;
         case MarioStates.ShootingFireball:
             ShootFireball();
             break;
         case MarioStates.Sliding:
             Slide();
             break;
         case MarioStates.Standing:
             Stand();
             break;
         case MarioStates.Walking:
             CurrentState = MarioStates.Standing; //have to take it out of walking state to force a sprite reload.
             Walk();
             break;
     }
 }
コード例 #10
0
ファイル: MarioState.cs プロジェクト: FrankHYB/MarioGame
 public void Walk()
 {
     if (CurrentState != MarioStates.Walking && CurrentState != MarioStates.Dead)
     {
         CurrentState = MarioStates.Walking;
         if (marioHasFire)
             CurrentSprite = Sprites.SpriteFactory.MarioFireWalking;
         else if (marioIsLarge)
             CurrentSprite = Sprites.SpriteFactory.MarioLargeWalking;
         else
             CurrentSprite = Sprites.SpriteFactory.MarioSmallWalking;
     }
 }
コード例 #11
0
ファイル: MarioState.cs プロジェクト: FrankHYB/MarioGame
 public void Stand()
 {
     if (CurrentState != MarioStates.Dead)
     {
         CurrentState = MarioStates.Standing;
         if (marioHasFire)
             CurrentSprite = new Sprites.MarioFireStandingSprite();
         else if (marioIsLarge)
             CurrentSprite = new Sprites.MarioLargeStandingSprite();
         else
             CurrentSprite = new Sprites.MarioSmallStandingSprite();
     }
 }
コード例 #12
0
ファイル: MarioState.cs プロジェクト: FrankHYB/MarioGame
 // Nothing currently calls this because we don't have a sprite that shows him throwing a fireball
 public void ShootFireball()
 {
     if (CurrentState != MarioStates.Dead && marioHasFire)
     {
         CurrentState = MarioStates.ShootingFireball;
         CurrentSprite = new Sprites.MarioFireBallingSprite();
     }
 }
コード例 #13
0
ファイル: MarioState.cs プロジェクト: FrankHYB/MarioGame
 public void Jump()
 {
     //because crouch jumping /is/ a thing, crouch overrides jump as far as displayed sprite.
     if (CurrentState != MarioStates.Dead && CurrentState != MarioStates.Crouching)
     {
         CurrentState = MarioStates.Jumping;
         if (marioHasFire)
             CurrentSprite = new Sprites.MarioFireJumpingSprite();
         else if (marioIsLarge)
             CurrentSprite = new Sprites.MarioLargeJumpingSprite();
         else
             CurrentSprite = new Sprites.MarioSmallJumpingSprite();
     }
 }
コード例 #14
0
ファイル: MarioState.cs プロジェクト: FrankHYB/MarioGame
 public void ShootFireball()
 {
     if (CurrentState != MarioStates.Dead && marioHasFire)
     {
         CurrentState = MarioStates.shootingFireball;
         CurrentSprite = new Sprites.MarioFireBallingSprite();
         Fireball fireball = new Fireball(myMario.xPosition, myMario.yPosition, camera);
         fireball.shoot();
     }
 }