Example #1
0
    /// <summary>
    ///	If collided with player, all enemies.Agro = true.
    ///	If collided with enemy, added to m_actors
    /// </summary>
    /// <param name="other">
    ///	A Collider. The Collider that has entered the room
    /// </param>
    private void OnTriggerEnter(Collider other)
    {
        // check if player
        Robbo robbo = other.GetComponent <Robbo>();

        if (robbo)
        {
            foreach (EnemyActor e in m_actors)
            {
                e.Agro = true;
            }
            return;
        }
        // check if enemy
        EnemyActor enemy = other.GetComponent <EnemyActor>();

        if (enemy && !m_actors.Exists(e => e == enemy))
        {
            enemy.Room = this;
            m_actors.Add(enemy);
        }
    }
Example #2
0
 // Start is called before the first frame update
 void Start()
 {
     m_player = FindObjectOfType <Robbo>();
     m_offset = transform.position - m_player.transform.position;
 }