Example #1
0
        void Start()
        {
            CameraWork _cameraWork = this.gameObject.GetComponent <CameraWork>();

            if (_cameraWork != null)
            {
                if (photonView.IsMine)
                {
                    _cameraWork.OnStartFollowing();
                }
                else
                {
                    UnityEngine.Debug.LogError("<Color=Red><a>Missing</a></Color> CameraWork Component on playerPrefab.", this);
                }
            }

            distToGround = GetComponent <Collider>().bounds.extents.y;
        }
Example #2
0
        /// <summary>
        /// MonoBehaviour method called on GameObject by Unity during initialization phase.
        /// </summary>
        public void Start()
        {
            if (photonView.IsMine)
            {
                CameraWork _cameraWork = gameObject.GetComponent <CameraWork>();

                if (_cameraWork != null)
                {
                    _cameraWork.OnStartFollowing();
                }
                else
                {
                    Debug.LogError("<Color=Red><b>Missing</b></Color> CameraWork Component on player Prefab.", this);
                }
            }

            // Create the UI
            if (this.playerUiPrefab != null)
            {
                if (photonView.IsMine)
                {
                    GameObject _uiGo = Instantiate(this.playerUiPrefab);
                    if (InputScheme == "Runner")
                    {
                        _uiGo.GetComponent <PlayerUI>().bfollow = true;
                    }
                    _uiGo.SendMessage("SetTarget", this, SendMessageOptions.RequireReceiver);
                }
            }
            else
            {
                Debug.LogWarning("<Color=Red><b>Missing</b></Color> PlayerUiPrefab reference on player Prefab.", this);
            }

            #if UNITY_5_4_OR_NEWER
            // Unity 5.4 has a new scene management. register a method to call CalledOnLevelWasLoaded.
            UnityEngine.SceneManagement.SceneManager.sceneLoaded += OnSceneLoaded;
            #endif
        }