示例#1
0
    //##############################################################################################
    // The endpoint for external scripts to register a delegate that gets called when this bullet
    // is destroyed
    //##############################################################################################
    public void RegisterOnBulletDestroyedDelegate(OnBulletDestroyed d)
    {
        if (bulletDestroyedDelegates == null)
        {
            bulletDestroyedDelegates = new List <OnBulletDestroyed>();
        }

        bulletDestroyedDelegates.Add(d);
    }
示例#2
0
    /// <summary>
    /// Esta função não utiliza o retorno do evento pois eventualmente o colisor e o "colidido" vem trocados.
    /// Algo a se aprimorar em uma futura iteração
    /// <summary>
    public void EnableNextPlayer(OnBulletDestroyed obj)
    {
        //Caso o indice do proximo jogador seja maior que a quantidade de jogadores, o proximo jogador é o primeiro da lista (0)
        int nextPlayerIndex = currentPlayerIndex + 1 >= Players.Count ? 0 : currentPlayerIndex + 1;

        for (int i = 0; i < Players.Count; i++)
        {
            if (i == nextPlayerIndex)
            {
                Players[i].MyTurn(true);
            }
            else
            {
                Players[i].MyTurn(false);
            }
        }

        currentPlayerIndex = nextPlayerIndex;
    }