Esempio n. 1
0
    void OnDamaged()
    {
        //Health Down
        gameManager.HealthDown();

        //Change Layer (Immortal Active)
        gameObject.layer = LayerMask.NameToLayer("PlayerDamaged");

        //Change Color
        sprite.color = Color.red;

        //Reaction Force
        float ReactDir = rigid.velocity.normalized.x * -1;

        rigid.AddForce(new Vector2(ReactDir, 1) * Time.deltaTime * ReactPower, ForceMode2D.Impulse);

        //Animation
        anim.SetTrigger("doDamaged");

        //Sound
        PlayeSound(audioDamaged);

        Invoke("OffDamaged", 1);
    }