Пример #1
0
    void Start()
    {
        GameObject[] players = GameObject.FindGameObjectsWithTag("Player");

        foreach (GameObject p in players)
        {
            //Debug.Log(p);
            if (p.GetComponent <PlayerController>().isMine())
            {
                player        = p.GetComponent <PlayerController>();
                playerStamina = p.GetComponent <StaminaHandling>();
                break;
            }
        }

        if (PhotonNetwork.IsMasterClient)
        {
            //Debug.Log("Yes");
            currTime = (float)PhotonNetwork.Time;
            Hashtable timerProp = new Hashtable()
            {
                { "GameTimer", currTime }
            };
            PhotonNetwork.CurrentRoom.SetCustomProperties(timerProp);
        }
        else
        {
            if (PhotonNetwork.CurrentRoom.CustomProperties["GameTimer"] != null)
            {
                currTime = (float)PhotonNetwork.CurrentRoom.CustomProperties["GameTimer"];
            }
        }
    }
Пример #2
0
 public void refInit()
 {
     _rb             = GetComponent <Rigidbody>();
     stamina         = GetComponent <StaminaHandling>();
     anim            = GetComponent <Animator>();
     camBase         = GameObject.FindGameObjectWithTag("MainCamera").GetComponent <CameraController>();
     cam             = camBase.gameObject.transform.GetChild(0).gameObject.GetComponent <Camera>();
     col             = GetComponent <CapsuleCollider>();
     weapon          = GetComponent <ShootingHandling>();
     networkedPlayer = GetComponent <NetworkController>();
     _audio          = GetComponent <AudioManager>();
 }