private void Awake() { //if we don't have an [_instance] set yet if (!_instance) { _instance = this; } //otherwise, if we do, kill this thing else { Destroy(this.gameObject); } DontDestroyOnLoad(this.gameObject); }
protected void InitDestinationController() { //This is necessary since we are overriding NetworkStart and the code then will be executed on proprietary and non process if (!networkObject.IsOwner) { return; } //Set up camera for GPConquest view DestinationCamera = FindMainCamera(FindObjectsOfType <Camera>()); DestinationCamera.gameObject.GetComponent <Transform>().SetParent(transform); //Gets a reference to the user account informations UsersContainer userInformations = FindObjectOfType <UsersContainer>(); CurrentUserInformations = userInformations.UserInfos; //Selected UMA SelectedUma = userInformations.UserInfos.selectedUma; //Assign the color networkObject.destNetColor = UnityEngine.Random.ColorHSV(); //Giant mode : Makes the avator bigger than normal (about 60 meters) in order to fit the GPConquest's scene concept if (isGiantMode) { //The assigning of the dimensions of the cursor change based on the choosen dimension networkObject.destCursorDims = new Vector3(10, 10, 10); UpdateDestinationAttributes(new Vector3(0, 100, -70), Quaternion.AngleAxis(-50.0f, Vector3.left), 50.0f, networkObject.destCursorDims, CurrentUserInformations, networkObject.destNetColor); } else //Normal mode { networkObject.destCursorDims = new Vector3(0.4f, 0.4f, 0.4f); UpdateDestinationAttributes(new Vector3(0, 6.45f, -6), Quaternion.AngleAxis(-40.0f, Vector3.left), 10.0f, networkObject.destCursorDims, CurrentUserInformations, networkObject.destNetColor); } //Create the map TileGen = gameObject.GetComponent <tileGen>(); StartCoroutine(TileGen.StartTiling()); //Spawn the avator on the network var avatorController = NetworkManager.Instance.InstantiatePlayerAvatorController(0, transform.position); avatorController.networkStarted += AvatorController_networkStarted; networkObject.SendRpc(RPC_INIT_NET_DESTINATION, Receivers.AllBuffered, PlayerName, SelectedUma); }