Example #1
0
    private void DestroyStrongpoint(int winner, int looser)
    {
        int cardsToDestroy = Mathf.CeilToInt(powerLevel[winner] - powerLevel[looser]);

        if (cardsToDestroy > cards[looser].Count)
        {
            bool found = false;
            //destroy strongpoint
            for (int i = 0; i < strongpoints.Length; i++)
            {
                if ((int)strongpoints[i].side == looser)
                {
                    for (int j = 0; j < strongpoints[i].points.Length; j++)
                    {
                        if (strongpoints[i].points[j].enabled == true)
                        {
                            found = true;
                            strongpoints[i].points[j].DestroyStrongpoint();
                            gameplayState.TurretDestroyed(looser);
                            break;
                        }
                    }
                    break;
                }
            }

            if (found == false)
            {
                //end game, nexus destroyed
                gameplayState.EndGame(winner);
            }
        }
    }