예제 #1
0
    public void AssignData()
    {
        Scene scene = SceneManager.GetActiveScene();

        if (scene.name != "MainMenuP1" && scene.name != "MainMenuP2" && scene.name != "MainMenuP3" &&
            scene.name != "MainMenuP4" && scene.name != "MainMenuTV")
        {
            manager = GameObject.Find("PlayerManager").GetComponent <PlayersReady>();
        }

        if (scene.name == "PlaceUnitsP1" || scene.name == "WaitingP1")
        {
            if (manager.p1Ready == true)
            {
                UpdatePlayerOne(ReadyTrue);
            }
            else if (manager.p1Ready == false)
            {
                UpdatePlayerOne(ReadyFalse);
            }
        }

        if (scene.name == "PlaceUnitsP2" || scene.name == "WaitingP2")
        {
            if (manager.p2Ready == true)
            {
                UpdatePlayerTwo(ReadyTrue);
            }
            else if (manager.p2Ready == false)
            {
                UpdatePlayerTwo(ReadyFalse);
            }
        }

        if (scene.name == "PlaceUnitsP3" || scene.name == "WaitingP3")
        {
            if (manager.p3Ready == true)
            {
                UpdatePlayerThree(ReadyTrue);
            }
            else if (manager.p3Ready == false)
            {
                UpdatePlayerThree(ReadyFalse);
            }
        }

        if (scene.name == "PlaceUnitsP4" || scene.name == "WaitingP4")
        {
            if (manager.p4Ready == true)
            {
                UpdatePlayerFour(ReadyTrue);
            }
            else if (manager.p4Ready == false)
            {
                UpdatePlayerFour(ReadyFalse);
            }
        }
    }
예제 #2
0
    public void ReturnPlayer()
    {
        Scene scene = SceneManager.GetActiveScene();

        manager = GameObject.Find("PlayerManager").GetComponent <PlayersReady>();

        if (scene.name != "PlaceUnitsP1" || scene.name != "WaitingP1")
        {
            if (PlayerOneIsReady.Equals(ReadyTrue))
            {
                manager.p1Ready = true;
            }
            else if (PlayerOneIsReady.Equals(ReadyFalse))
            {
                manager.p1Ready = false;
            }
        }

        if (scene.name != "PlaceUnitsP2" || scene.name != "WaitingP2")
        {
            if (PlayerTwoIsReady.Equals(ReadyTrue))
            {
                manager.p2Ready = true;
            }
            else if (PlayerTwoIsReady.Equals(ReadyFalse))
            {
                manager.p2Ready = false;
            }
        }

        if (scene.name != "PlaceUnitsP3" || scene.name != "WaitingP3")
        {
            if (PlayerThreeIsReady.Equals(ReadyTrue))
            {
                manager.p3Ready = true;
            }
            else if (PlayerThreeIsReady.Equals(ReadyFalse))
            {
                manager.p3Ready = false;
            }
        }

        if (scene.name != "PlaceUnitsP4" || scene.name != "WaitingP4")
        {
            if (PlayerFourIsReady.Equals(ReadyTrue))
            {
                manager.p4Ready = true;
            }
            else if (PlayerFourIsReady.Equals(ReadyFalse))
            {
                manager.p4Ready = false;
            }
        }
    }