private void EnterToCounter()
    {
        if (_navMeshAgent.isStopped)
        {
            _navMeshAgent.isStopped = false;
            _navMeshAgent.SetDestination(_currentTarget.CounterPosition);
        }

        if (Vector3.Distance(transform.position, _navMeshAgent.destination) < Mathf.Epsilon)
        {
            _navMeshAgent.isStopped = true;
            _currentState           = GuestBehaviourState.WaitForFood;
        }
    }
    private void WaitForFood()
    {
        _isAte = _currentTarget.CounterComponent.IsAvailableRecipeCode();
        if (_isAte)
        {
            if (MultiPlayGameManager.GetInstance() != null)
            {
                MultiPlayGameManager.GetInstance().AddPlayerScore(_targetRecipeCode.Length * 1000);
            }

            _navMeshAgent.isStopped = false;
            _navMeshAgent.SetDestination(_defaultPosition);
            _currentState = GuestBehaviourState.ExitToDefaultPosition;
        }
    }
 public void OnPhotonSerializeView(PhotonStream stream, PhotonMessageInfo info)
 {
     if (stream.IsWriting)
     {
         stream.SendNext(transform.position);
         stream.SendNext(transform.rotation);
         stream.SendNext(_currentTarget.CounterName);
         stream.SendNext(_currentState);
         stream.SendNext(GuestImageRenderer.enabled);
         stream.SendNext(GuestTextRenderer.enabled);
     }
     else
     {
         _serializePosition         = (Vector3)stream.ReceiveNext();
         _serializeRotation         = (Quaternion)stream.ReceiveNext();
         _serializeTargetNameCache  = (string)stream.ReceiveNext();
         _currentState              = (GuestBehaviourState)stream.ReceiveNext();
         GuestImageRenderer.enabled = (bool)stream.ReceiveNext();
         GuestTextRenderer.enabled  = (bool)stream.ReceiveNext();
     }
 }
    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);
        }
    }