Exemplo n.º 1
0
    // 3
    void OnTriggerExit2D(Collider2D other)
    {
        if (other.gameObject.tag.Equals("Enemy"))
        {
            enemiesInRange.Remove(other.gameObject);
            EnemyDelegateDestruction del =
                other.gameObject.GetComponent <EnemyDelegateDestruction>();
            del.enemyDelegate -= OnEnemyDestroy;

            if (selectionCircle.gameObject.activeSelf)
            {
                selectionCircle.gameObject.GetComponent <SpriteRenderer>().color = new Color(0f, 0f, 1f, 0.50f); // Set to red trabsparent
            }
        }
    }
Exemplo n.º 2
0
 void OnTriggerEnter2D(Collider2D other)
 {
     if (other.gameObject.tag.Equals("Enemy"))
     {
         enemiesInRange.Add(other.gameObject);
         EnemyDelegateDestruction del =
             other.gameObject.GetComponent <EnemyDelegateDestruction>();
         del.enemyDelegate += OnEnemyDestroy;
         if (selectionCircle.gameObject.activeSelf)
         {
             //Change the alpha to keep it transparent
             selectionCircle.gameObject.GetComponent <SpriteRenderer>().color = new Color(1f, 0f, 0f, 0.50f); // Set to red trabsparent
         }
     }
 }