示例#1
0
 void Update()
 {
     if (storageScript == null)
     {
         storageScript = GameObject.Find("RPS_Storage").GetComponent <RPS_Storage>();
     }
     if (knockOutManager == null)
     {
         knockOutManager = GameObject.Find("KnockOutManager");
     }
 }
示例#2
0
    // CountdownVeloDrome countdownVeloDrome;

    /*public GameObject knockOutUI;
     * public GameObject knockOutManager;
     * public GameObject knockOutButton;
     * public KnockoutModeManager knockManagerList;
     */

    /// <summary>
    /// Start is called on the frame when a script is enabled just before
    /// any of the Update methods is called the first time.
    /// </summary>
    void Start()
    {
        serverWindow   = GameObject.Find("DemoUI/NetworkPanel");
        messageWindow  = GameObject.Find("DemoUI/MessagePanel");
        connectionText = GameObject.Find("DemoUI/NetworkMessage").GetComponent <Text>();
        username       = GameObject.Find("DemoUI/NetworkPanel/PlayerNameInputField").GetComponent <InputField>();
        roomName       = GameObject.Find("DemoUI/NetworkPanel/RoomNameInputField").GetComponent <InputField>();
        roomList       = GameObject.Find("DemoUI/NetworkPanel/RoomListInputField").GetComponent <InputField>();
        messagesLog    = GameObject.Find("DemoUI/MessagePanel/MessageLog").GetComponent <InputField>();
        pairScreen     = GameObject.Find("DemoUI/Pairing");
        SPPlayer       = GameObject.Find("Bicycle");
        //  knockOutUI = GameObject.Find("DemoUI/KnockOutModeUI");
        //  knockOutButton = GameObject.Find("DemoUI/NetworkPanel/KnockOutModeButton");
        //RPS
        /*RPS_Storage*/ storageScript = GameObject.Find("RPS_Storage").GetComponent <RPS_Storage>();
        //  knockOutUI.SetActive (false);
        //  knockOutButton.SetActive(false);
        TimeAttackCountdown = GameObject.Find("CountDownManager");



        GameObject rootGO = GameObject.Find("SpawnPointers");

        spawnPoints = new Transform[rootGO.transform.childCount];

        for (int i = 0; i < rootGO.transform.childCount; i++)
        {
            spawnPoints[i] = rootGO.transform.GetChild(i);
        }
        messages = new Queue <string>(messageCount);

        if (PlayerPrefs.HasKey(nickNamePrefKey))
        {
            // username.text = PlayerPrefs.GetString(nickNamePrefKey);
            ProfileSessionManager.GetUsername();
            username.text = ProfileSessionManager.curName.ToString();
        }
        PhotonNetwork.AutomaticallySyncScene = true;
        PhotonNetwork.ConnectUsingSettings();
        connectionText.text = "Connecting to lobby...";
    }
示例#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);
            }
        }
    }