Exemplo n.º 1
0
    void OnCollisionEnter2D(Collision2D col)
    {
        if(col.gameObject.CompareTag("knight"))
        {
            kh = col.gameObject.GetComponent<KnightsHealth>();
            if(kh != null)
            {
                StopCoroutine(DestroySelf());
                Destroy (gameObject);
                kh.health--;
            }
            if(kh.health <= 0)
            {
                StopCoroutine(DestroySelf());
                Destroy (gameObject);
                asource.Play();
                Destroy (col.gameObject);
                Instantiate(BloodSplatter,col.transform.position,Quaternion.identity);
                gv.KnightsKilled++;
                gv.KnightsLeft--;
                //gv.numSpawned--;
                //Debug.Log("inside MoveFireball "+(gv.KnightsLeft - gv.numSpawned));
            }

        }
    }
Exemplo n.º 2
0
 void OnCollisionEnter2D(Collision2D col)
 {
     if (col.gameObject.CompareTag("knight"))
     {
         kh = col.gameObject.GetComponent <KnightsHealth>();
         if (kh != null)
         {
             StopCoroutine(DestroySelf());
             Destroy(gameObject);
             kh.health--;
         }
         if (kh.health <= 0)
         {
             StopCoroutine(DestroySelf());
             Destroy(gameObject);
             asource.Play();
             Destroy(col.gameObject);
             Instantiate(BloodSplatter, col.transform.position, Quaternion.identity);
             gv.KnightsKilled++;
             gv.KnightsLeft--;
             //gv.numSpawned--;
             //Debug.Log("inside MoveFireball "+(gv.KnightsLeft - gv.numSpawned));
         }
     }
 }