Esempio n. 1
0
    public void SetLevelHero(int levelvoulu)
    {
        Sprite sprtTemp;
        int    coefFacingRight = -1;

        if (moveScript.getFacingRight())
        {
            coefFacingRight = 1;
        }
        if (levelvoulu == 1)
        {
            levelHero = 1;
            attackScript.setPv(level1pv);
            attackScript.setPuissance(level1puissance);
            moveScript.setJumpForce(level1JumpForce);
            this.transform.localScale = new Vector2(1.5f * coefFacingRight, 1f);
        }
        else if (levelvoulu == 2)
        {
            levelHero = 2;
            attackScript.setPv(level2pv);
            attackScript.setPuissance(level2puissance);
            moveScript.setJumpForce(level2JumpForce);
            this.transform.localScale = new Vector2(2.5f * coefFacingRight, 1.75f);
        }
        else
        {
            levelHero = 3;
            attackScript.setPv(level3pv);
            attackScript.setPuissance(level3puissance);
            moveScript.setJumpForce(level3JumpForce);
            this.transform.localScale = new Vector2(4 * coefFacingRight, 3);
        }
    }
Esempio n. 2
0
 public int monsterIsHit(int puissancehero)
 {
     push = true;
     spillBlood();
     soundmonstre.playHit(getMType());
     if (direction_epee.getFacingRight())
     {
         rigidbody2D.AddForce(new Vector2(puissancehero * 5 - puissance / 3, puissancehero * 5 - puissance / 3), ForceMode2D.Impulse);
     }
     else
     {
         rigidbody2D.AddForce(new Vector2(-puissancehero * 5 - puissance / 3, puissancehero * 5 - puissance / 3), ForceMode2D.Impulse);
     }
     pv -= puissancehero;
     if (pv <= 0)
     {
         Destroy(this.gameObject);
         return(typeMonstre);
     }
     return(0);
 }