Ejemplo n.º 1
0
    public void TakeDamage(int damage, HandleDamageColliders.DamageType damageType)
    {
        if (!gettingHit)
        {
            switch (damageType)
            {
            case HandleDamageColliders.DamageType.melee:
                StartCoroutine(CloseImmortality(0.3f));
                break;

            case HandleDamageColliders.DamageType.range:     // knockback attack
                handleMovement.AddVelocityOnCharacter(
                    ((!lookRight) ? Vector3.right * 1 : Vector3.right * -1) + Vector3.up
                    , 0.5f
                    );

                StartCoroutine(CloseImmortality(1));
                break;
            }

            health -= damage;
            EventSystemUI.current.ChangeHealth(playerId, health); //update UI
            gettingHit = true;
        }
    }
Ejemplo n.º 2
0
    public void TakeDamage(int damage, HandleDamageColliders.DamageType damageType)
    {
        if (!gettingHit)
        {
            switch (damageType)
            {
            case HandleDamageColliders.DamageType.light:
                StartCoroutine(CloseImmortality(0.3f));
                break;

            case HandleDamageColliders.DamageType.heavy:
                handleMovement.AddVelocityOnCharacter(
                    ((!lookRight) ? Vector3.right * 1 : Vector3.right * -1) + Vector3.up
                    , 0.5f
                    );

                StartCoroutine(CloseImmortality(1));
                break;
            }

            if (blood != null)
            {
                blood.Emit(30);
            }

            health    -= damage;
            gettingHit = true;
        }
    }
Ejemplo n.º 3
0
    public void TakeDamage(int damage, HandleDamageColliders.DamageType damageType)
    {
        if (!gettingHit && !blocking)
        {
            switch (damageType)
            {
            case HandleDamageColliders.DamageType.light:
                StartCoroutine(CloseImmortality(0.3f));
                break;

            case HandleDamageColliders.DamageType.heavy:
                handleMovement.AddVelocityOnCharacter(
                    ((!lookRight) ? Vector3.right * -1 : Vector3.right), 0.5f
                    );
                StartCoroutine(CloseImmortality(1));
                break;
            }


            health    -= damage;
            gettingHit = true;
            //if(blood != null)
            //{
            foreach (ParticleSystem ps in blood)
            {
                if (ps.gameObject.tag == "Hit")
                {
                    ps.Emit(30);
                }
            }

            StartCoroutine(shake.Shake(.2f, .2f));
            //}
        }

        if (blocking)
        {
            foreach (ParticleSystem ps in blood)
            {
                if (ps.gameObject.tag == "Block")
                {
                    ps.Emit(30);
                }
            }
        }
    }
Ejemplo n.º 4
0
 public void TakeDamage(int damageAmount, HandleDamageColliders.DamageType damageType)
 {
 }