예제 #1
0
    /// <summary>
    /// Chamado a cada frame se o <see cref="MonoBehaviour"/> está ativo
    /// </summary>
    public void Update()
    {
        Allies.RemoveAll(c => c.State == StateCharacter.Die);
        Enemies.RemoveAll(c => c.State == StateCharacter.Die);

        foreach (var ally in Allies)
        {
            ally.Target = Enemies.OrderBy(c => c.Self.DistanceTo(ally.Self)).FirstOrDefault();
        }

        foreach (var enemy in Enemies)
        {
            enemy.Target = Allies.OrderBy(c => c.Self.DistanceTo(enemy.Self)).FirstOrDefault();
        }
    }