private void OnDestroy() { if (photonView.IsMine) { GuestManager.GetInstance().ReturnCounter(_currentTarget); } }
public override void OnMasterClientSwitched(Player newMasterClient) { base.OnMasterClientSwitched(newMasterClient); if (PhotonNetwork.LocalPlayer == newMasterClient) { Debug.Log("This Client is Master Client"); Transform tr = GuestManager.GetInstance().transform.Find(_serializeTargetNameCache); _currentTarget = new CounterData(tr.position, tr.GetComponent <BurgerTrayController>(), _serializeTargetNameCache); photonView.TransferOwnership(newMasterClient); _navMeshAgent.enabled = true; _navMeshAgent.isStopped = true; } }
private void Start() { _defaultPosition = transform.position; if (photonView.IsMine) { _currentState = GuestBehaviourState.EnterToCounter; _currentTarget = GuestManager.GetInstance().GetCounterFromQueue(); _navMeshAgent.enabled = true; _navMeshAgent.SetDestination(_currentTarget.CounterPosition - Vector3.right); _targetRecipeCode = RecipeManager.GetInstance().GetRandomRecipeCode(); GuestTextRenderer.text = _targetRecipeCode; _currentTarget.CounterComponent.SetTargetRecipeCode(_targetRecipeCode); GuestImageRenderer.sprite = RecipeManager.RecipeImageHash[_targetRecipeCode]; } else { photonView.RPC("_RequestRecipeCode", photonView.Owner, null); } }