Exemple #1
0
    public void TakeDamage(HitEventData data)
    {
        if (data.victim == gameObject && isAlive)
        {
            //hit recover for 0.5s
            agent.isStopped = true;
            Invoke("agentStart", 0.1f);

            //change the direction
            Vector3 damageVector    = data.shooter.transform.position - transform.position;
            Vector2 damageDirection = new Vector2(damageVector.x, damageVector.z).normalized;
            animator.SetFloat("Horizontal", damageDirection.x);
            animator.SetFloat("Vertical", damageDirection.y);

            animator.SetTrigger("Hit");

            hp -= data.tama.GetComponent <Tama>().damage *GameObject.Find("Player").GetComponent <PlayerController>().attack;
            hitpoints.localScale = new Vector3(hp / HP_MAX, 1, 1);

            audioSource.PlayOneShot(hittingClip, hittingVolume);
            if (hp <= 0)
            {
                Die();
            }
        }
    }
Exemple #2
0
    public void DeathZoneHit(HitEventData data)
    {
        if (progressBar.timer > 0)
        {
            TakeDamage();
        }

        if (progressBar.timer <= 0)
        {
            DeathTrigger();
        }
    }
Exemple #3
0
    public void TakeDamage(HitEventData data)
    {
        if (data.victim == gameObject && isAlive)
        {
            hp -= data.tama.GetComponent <Tama>().damage *GameObject.Find("Player").GetComponent <PlayerController>().ATK;
            hitpoints.localScale = new Vector3(hp / HP_MAX, 1, 1);

            if (hp <= 0)
            {
                Die();
            }
        }
    }
    void TakeDamage(HitEventData data)
    {
        if (data.victim == gameObject && hp > 0)
        {
            Vector3 damageVector    = data.shooter.transform.position - transform.position;
            Vector2 damageDirection = new Vector2(damageVector.x, damageVector.z).normalized;
            animator.SetFloat("Horizontal", damageDirection.x);
            animator.SetFloat("Vertical", damageDirection.y);
            animator.SetTrigger("Hit");

            ds4.Vibrate(0, 1, 0.2f);
            ds4.Vibrate(1, 1, 0.2f);

            audioSource.PlayOneShot(hitting, hittingVolume);

            hp -= data.meleeDamage / defence;

            StateSetup();
        }
    }
Exemple #5
0
    // GESTIONE EVENTI

    #region Eventi
    void TrapHit(HitEventData hit)
    {
        //aggiornare il livello di salute del giocatore,
        //quindi aggiornare il GUI manager
        //Debug.Log(hit.victim.ToString());
    }
Exemple #6
0
 public void ResetCombo(HitEventData data)
 {
     comboCount          = 0;
     comboCountText.text = "";
 }