Ejemplo n.º 1
0
    void OnPlayerDeath()
    {
        if (GlobalVariables.Instance.NumberOfPlayers > 0)
        {
            foreach (var p in GlobalVariables.Instance.AlivePlayersList)
            {
                PlayersGameplay s = p.GetComponent <PlayersGameplay>();

                if (s.GetType() != typeof(AIGameplay) && !s.GetType().IsSubclassOf(typeof(AIGameplay)))
                {
                    return;
                }
            }

            ShowPassFightButton();
        }
    }
Ejemplo n.º 2
0
    public void UpdateGamepadList()
    {
        gamepadsList.Clear();
        bool oneGamepadUnplugged = false;

        foreach (GameObject p in GlobalVariables.Instance.EnabledPlayersList)
        {
            if (p == null)
            {
                continue;
            }

            PlayersGameplay script = p.GetComponent <PlayersGameplay>();

            if (script.GetType() == typeof(AIGameplay) || script.GetType().IsSubclassOf(typeof(AIGameplay)))
            {
                continue;
            }

            //Unplugged
            if (script.controllerNumber != 0 && script.controllerNumber != -1 && script.controllerNumber != -2)
            {
                gamepadsList.Add(new PlayerGamepad());
                gamepadsList[gamepadsList.Count - 1].PlayerName = script.playerName;

                if (script.rewiredPlayer.controllers.joystickCount == 0)
                {
                    gamepadsList[gamepadsList.Count - 1].GamepadIsPlugged = false;
                    oneGamepadUnplugged = true;
                }
                else
                {
                    gamepadsList[gamepadsList.Count - 1].GamepadIsPlugged = true;
                }
            }
        }

        OneGamepadUnplugged = oneGamepadUnplugged;

        if (oneGamepadUnplugged && OnGamepadDisconnected != null)
        {
            OnGamepadDisconnected();
        }
    }
Ejemplo n.º 3
0
    void SetupStats()
    {
        settingUp = true;

        //Players Stats
        playersStats.Clear();

        foreach (GameObject g in GlobalVariables.Instance.Players)
        {
            if (g == null)
            {
                break;
            }

            PlayersGameplay playerScript = g.GetComponent <PlayersGameplay>();

            if (!GlobalVariables.Instance.EnabledPlayersList.Contains(g))
            {
                continue;
            }

            playersStats.Add(playerScript.playerName.ToString(), new PlayerStats());

            for (int i = 0; i < Enum.GetValues(typeof(WhichStat)).Cast <int>().Max() + 1; i++)
            {
                playersStats[playerScript.playerName.ToString()].playersStats.Add(((WhichStat)i).ToString(), 0);
            }

            if (playerScript.GetType() == typeof(AIGameplay) || playerScript.GetType().IsSubclassOf(typeof(AIGameplay)))
            {
                playersStats[playerScript.playerName.ToString()].isBot = true;
            }
        }

        //Total Players Stats
        playersTotalStats.Clear();

        foreach (GameObject g in GlobalVariables.Instance.Players)
        {
            if (g == null)
            {
                break;
            }

            PlayersGameplay playerScript = g.GetComponent <PlayersGameplay>();

            if (!GlobalVariables.Instance.EnabledPlayersList.Contains(g))
            {
                continue;
            }

            playersTotalStats.Add(playerScript.playerName.ToString(), new PlayerStats());

            for (int i = 0; i < Enum.GetValues(typeof(WhichStat)).Cast <int>().Max() + 1; i++)
            {
                playersTotalStats[playerScript.playerName.ToString()].playersStats.Add(((WhichStat)i).ToString(), 0);
            }

            if (playerScript.GetType() == typeof(AIGameplay) || playerScript.GetType().IsSubclassOf(typeof(AIGameplay)))
            {
                playersTotalStats[playerScript.playerName.ToString()].isBot = true;
            }
        }


        //Total Stats
        totalStats.Clear();

        for (int i = 0; i < Enum.GetValues(typeof(WhichStat)).Cast <int>().Max() + 1; i++)
        {
            if (!totalExcludeStats.Contains((WhichStat)i))
            {
                totalStats.Add(((WhichStat)i).ToString(), 0);
            }
        }

        //Most Stats
        mostStats.Clear();

        for (int i = 0; i < Enum.GetValues(typeof(WhichStat)).Cast <int>().Max() + 1; i++)
        {
            mostStats.Add(((WhichStat)i).ToString(), new Stats());
            mostStats[((WhichStat)i).ToString()].whichPlayer = WhichPlayer.None;
        }

        //Least Stats
        leastStats.Clear();

        for (int i = 0; i < Enum.GetValues(typeof(WhichStat)).Cast <int>().Max() + 1; i++)
        {
            leastStats.Add(((WhichStat)i).ToString(), new Stats());
            leastStats[((WhichStat)i).ToString()].whichPlayer = WhichPlayer.None;
        }

        GetPlayersEvents();

        settingUp = false;
    }