void OnTriggerEnter2D(Collider2D other)
 {
     attacked = true;
     if (other.gameObject.tag == "Player")
     {
         if(attacked && allive && TimeToAttack)
         {
             EnSCR.audio.Play();
             playerSCR = other.GetComponent<characterControllerScript>();
             playerSCR.TakeDmg(dmg);
             attacked = false;
             EnSCR.attack = false;
         }
         //Debug.Log("WOW!");
     }
 }
 void OnTriggerEnter2D(Collider2D other)
 {
     attacked = true;
     if (other.gameObject.tag == "Player")
     {
         if (attacked && allive && TimeToAttack)
         {
             EnSCR.audio.Play();
             playerSCR = other.GetComponent <characterControllerScript>();
             playerSCR.TakeDmg(dmg);
             attacked     = false;
             EnSCR.attack = false;
         }
         //Debug.Log("WOW!");
     }
 }
Example #3
0
    void OnTriggerEnter2D(Collider2D other)
    {
        //DestroyObject (this);
        //Debug.Log ("boob bay");
        if (other.gameObject.tag == "Player")
        {
            hit    = true;
            player = other.GetComponent <characterControllerScript>();
            player.TakeDmg(3);
            //var shotTransform = Instantiate(boooom) as Transform;
            //shotTransform.position = transform.position;
            DestroyObject(gameObject, 0.01f);
        }
        if (other.gameObject.tag == "ground")
        {
            hit = true;


            DestroyObject(gameObject, 0.01f);
            //Destroy(this);
        }
    }