protected void UpdateAvatorAttributes(DestinationController _destinationController) { DestinationControllerReference = _destinationController; gameObject.name = _destinationController.gameObject.name + " avator - " + networkObject.NetworkId; SelectedUma = _destinationController.SelectedUma; CharacterController.center = new Vector3(0, 1.0f, 0); CurrentUserInfo = _destinationController.CurrentUserInformations; DestinationTransform = _destinationController.gameObject.GetComponent <Transform>(); CameraOnDestination = _destinationController.DestinationCamera; _destinationController.AvatorController = this; GameEntityRegister = _destinationController.GameEntityRegister; }
// Use this for initialization void Start() { if (destination == null) { DestinationController[] playersInTheScene = FindObjectsOfType <DestinationController>(); foreach (DestinationController dst in playersInTheScene) { if (dst.networkObject.NetworkId.Equals(playerNetworkId)) { destination = dst; destinationTransform = destination.GetComponent <Transform>(); } } } }
public void InitAvatorController(DestinationController _destinationController) { //Update shared attributes according the choosen size of the avator if (_destinationController.isGiantMode) { UpdateAvatorNetAttrbs(new Vector3(25, 25, 25), _destinationController.networkObject.NetworkId, 0.5f, 0.6f); } else { UpdateAvatorNetAttrbs(new Vector3(1, 1, 1), _destinationController.networkObject.NetworkId, 0.7f, 0.6f); } //Setups the AvatorController attributes that cames from the DestinationController UpdateAvatorAttributes(_destinationController); //When the destination controller is destroyed, destroy also the realated Avator. _destinationController.networkObject.onDestroy += NetworkObject_onDestroy; //Setup and spawn the UMA character CreateAndSpawnUMA(SelectedUma); //Create the Player Entity in the network var playerEntityModelBehavior = NetworkManager.Instance.InstantiatePlayerEntityModel(0, transform.position); playerEntityModelBehavior.networkStarted += PlayerEntityModelBehavior_networkStarted; networkObject.SendRpc(RPC_UPDATE_AVATOR_ON_NETWORK, Receivers.AllBuffered, SelectedUma); }