Exemple #1
0
    // If enemy enters the range of attack
    private void OnCollisionEnter(Collision col)
    {
        if ((target != null) && !target.Equals(null))
        {
            var target_tag = target.getGameObject().tag;
            var col_tag    = col.collider.gameObject.tag;

            if (((col_tag == "Enemy") && (target_tag == "Unit")) || ((col_tag == "Building") && (target_tag == "Building")))
            {
                target.ReceiveDamage(damage);
            }
        }
    }
Exemple #2
0
 public void Shoot(CanReceiveDamage target, float damage)
 {
     this.target          = target;
     this.target_position = target.getGameObject().transform.position;
     this.damage          = damage;
 }