Esempio n. 1
0
    //handles the player off platform
    public void PlayerOffPlatform(int playerID)
    {
        int numOfAttachedSecondaries  = 0;
        SumoAssociations sumoStayedOn = new SumoAssociations();

        for (int i = 0; i < sumoAsses.Length; i++)
        {
            if (sumoAsses[i].role == SumoRole.SUMODUDE && sumoAsses[i].playerID != playerID)
            {
                sumoStayedOn = sumoAsses[i];
            }
        }
        int sumoNumber = sumoStayedOn.sumoDudeNumber;

        for (int i = 0; i < sumoAsses.Length; i++)
        {
            if (sumoAsses[i].playerID != playerID && sumoAsses[i].playerID != sumoStayedOn.playerID && sumoAsses[i].sumoDudeNumber != sumoNumber)
            {
                poins[sumoAsses[i].playerID - 1].AddPoins(1);
                numOfAttachedSecondaries++;
                EventManager.ScorePoins(poins[sumoAsses[i].playerID - 1].GetPoinCount(), sumoAsses[i].playerID);
            }
        }
        poins[sumoStayedOn.playerID - 1].AddPoins(3 - numOfAttachedSecondaries);
        //check for a WRASTLED event
        if (3 - numOfAttachedSecondaries == 1)
        {
            Debug.Log("player: " + playerID + ", sumoStayedOn ID: " + sumoStayedOn.playerID);
            EventManager.Wrastled(sumoStayedOn.playerID);
        }

        StartCoroutine(WaitForSwap(playerID));

        if (playerID < 2 && swappedOne)
        {
            EventManager.Swap(playerID);
            swappedOne = false;
        }
        else if (playerID > 1 && swappedTwo)
        {
            EventManager.Swap(playerID);
            swappedTwo = false;
        }
        EventManager.ScorePoins(poins[sumoStayedOn.playerID - 1].GetPoinCount(), sumoStayedOn.playerID);
    }
Esempio n. 2
0
    private void SetupSumo(int index)
    {
        SumoRole role;
        int      sumoNumber;

        //if we are the right side of the controller
        if (index % 2 != 0)
        {
            //determine the role based on the first player role picked for that controller
            if (sumoAsses[index - 1].role == SumoRole.SUMODUDE)
            {
                role = SumoRole.SECONDARY;
                if (index < 2)
                {
                    sumos[0].SetupSecondaryDisplay(2, 0);
                }
                else
                {
                    sumos[1].SetupSecondaryDisplay(4, 0);
                }
            }
            else
            {
                role = SumoRole.SUMODUDE;
                if (index < 2)
                {
                    sumos[0].SetPlayerID(2);
                }
                else
                {
                    sumos[1].SetPlayerID(4);
                }
            }
        }
        else
        {
            int rand = Random.Range(1, 3);
            if (rand == 1)
            {
                role = SumoRole.SUMODUDE;
                if (index < 2)
                {
                    sumos[0].SetPlayerID(1);
                }
                else
                {
                    sumos[1].SetPlayerID(3);
                }
            }
            else
            {
                role = SumoRole.SECONDARY;
                if (index < 2)
                {
                    sumos[0].SetupSecondaryDisplay(1, 0);
                }
                else
                {
                    sumos[1].SetupSecondaryDisplay(3, 0);
                }
            }
        }
        //if we are the second controller, put us on the second sumo
        if (index > 1)
        {
            sumoNumber = 2;
        }
        else
        {
            sumoNumber = 1;
        }
        sumoAsses[index] = new SumoAssociations(role, index + 1, sumoNumber);
    }