Example #1
0
 void Start()
 {
     knockoutModeManager = GameObject.Find("KnockOutManager").GetComponent <KnockoutModeManager>();
     won    = GameObject.Find("DemoUI/KnockOutModeUI/WonKnockOut");
     lost   = GameObject.Find("DemoUI/KnockOutModeUI/LostKnockOut");
     button = GameObject.Find("DemoUI/KnockOutModeUI/CloseKnockOut");
 }
Example #2
0
    void Update()
    {
        if (knockoutModeManager == null)
        {
            knockoutModeManager = GameObject.Find("KnockOutManager").GetComponent <KnockoutModeManager>();
        }
        if (won == null)
        {
            won = GameObject.Find("DemoUI/KnockOutModeUI/WonKnockOut");
        }
        if (lost == null)
        {
            lost = GameObject.Find("DemoUI/KnockOutModeUI/LostKnockOut");
        }
        if (button == null)
        {
            button = GameObject.Find("DemoUI/KnockOutModeUI/CloseKnockOut");
        }

        //Calls
        TicketCheck();
    }
Example #3
0
    // Start is called before the first frame update
    void Start()
    {
        //  RPS_Storage storageScript = GameObject.Find("RPS_Storage").GetComponent<RPS_Storage>();
        storageScript    = GameObject.Find("RPS_Storage").GetComponent <RPS_Storage>();
        knockOutManager  = GameObject.Find("KnockOutManager");
        knockManagerList = GameObject.Find("KnockOutManager").GetComponent <KnockoutModeManager>();

        if (!GetComponent <PhotonView>().IsMine)
        {
            Destroy(GetComponent <SplineFollower>());
            Destroy(GetComponent <BicyclePowerSim>());
            Destroy(GetComponent <BicycleSplineController>());
            Destroy(GetComponent <WaypointProgressTracker>());
            Destroy(GetComponent <EVP.VehicleCameraController>());
            Destroy(GetComponent <BikeFrontLight>());
            Destroy(GetComponent <AzureAudioDayNightController>());
            //  Destroy(GetComponent<RPS_Inspector>());
            //  Destroy(GetComponent<RPS_Position>());
            //  Destroy(GetComponent<RPS_Lap>());
            //  Destroy(GetComponent<RPS_LapUI>());
            //  Destroy(GetComponent<EndOfRace>());
            Destroy(GetComponent <RPS_ScreenUI>());

            tag = "OtherPlayer";

            for (int i = 0; i < localScripts.Length; i++)
            {
                localScripts[i].enabled = false;
            }
            for (int i = 0; i < localObject.Length; i++)
            {
                localObject[i].SetActive(false);
            }

            smoothSync = GetComponent <SmoothSyncPUN2>();

            if (smoothSync)
            {
                // Set up a validation method to check incoming States to see if cheating may be happening.
                smoothSync.validateStateMethod = validateStateOfPlayer;
            }

            // otherplayer = GameObject.FindGameObjectWithTag("OtherPlayer");

            wait();
            Debug.Log("Ok Wait 2 seconds!");


            RPS_Position posScript = (RPS_Position)otherplayer.GetComponent <RPS_Position>() as RPS_Position;
            Debug.Log("RPS Adder2");

            //Add the other Players to the List for Knockout
            test = GameObject.FindGameObjectWithTag("OtherPlayer").GetComponent <PlayerTicket>();
            knockManagerList.players.Add(test);
            //  knockManagerList.AddPlayerCount();
            //  Debug.Log("AddPlayerCount +1");

            /*   wait();
             * for (int i = 0; i < knockManagerList.players.Count; i++)
             * {
             *     if (knockManagerList.players[i] != null)
             *         knockManagerList.playerCount += 1;
             * }
             */
            //remove duplicates
            // knockManagerList.players = knockManagerList.players.Distinct().ToList();
            Debug.Log("testOtherPlayerForKnockOutMode");

            //  knockOutManager.GetComponent<KnockoutModeManager>().AddOthers();
            //  Debug.Log("AddOtherNetWorkScript");

            // add the position to the storageScript
            if (!storageScript.positionScript.Contains(posScript))
            {
                storageScript.positionScript.Add(posScript);
            }
        }
    }