Exemple #1
0
 void Update()
 {
     //Debug.Log(health.ToString());
     if (health <= 0)
     {
         destructible.DestroyObject();
         //Destroy(gameObject);
     }
 }
    void OnTriggerEnter2D(Collider2D collider)
    {
        Attackable target = collider.GetComponent <Attackable>();

        if (target)
        {
            RaycastHit2D hit = Physics2D.Linecast(transform.position, target.transform.position);
            target.DealDamage(Damage.Value, hit, creator);
        }

        destructible.DestroyObject();
    }