Ejemplo n.º 1
0
    protected override void OnSelectedNode(ANode node)
    {
        base.OnSelectedNode(node);

        var nodeView = node.GetComponent <PhotonView>();

        if (nodeView == null)
        {
            return;
        }

        // Preparing payload
        Byterizer byterizer = new Byterizer();

        byterizer.Push(_PhotonView.ViewID);
        byterizer.Push(nodeView.ViewID);
        byte[] data = byterizer.GetBuffer();

        // Raising Net Event
        PhotonNetwork.RaiseEvent((byte)NetworkedGameEvents.ON_SELECTED_NODE, data, _RaiseEventOptions, _SendOptions);
    }
Ejemplo n.º 2
0
    private IEnumerator MovingToNode(Vector3 positionToMoveTo)
    {
        _Mover.SetDestination(positionToMoveTo);

        while (Vector3.Distance(transform.position, _TargetNode.SpotToStandIn.position) >= _MinimumDistanceBeforeStoppingFromNode)
        {
            yield return(null);
        }

        _TargetCookingStation = _TargetNode.GetComponent <CookingStation>();
        if (_TargetCookingStation != null)
        {
            // Invoking the near cooking station event only if the hero is controlled locally
            if (IsLocal)
            {
                _HeroNearCookingStationEvent.Invoke(_TargetCookingStation);
            }

            _TargetCookingStation.PickUpCookedFood(OwnerID, IsLocal);
        }

        //_Mover.StopMoving();
        _TargetNode = null;
    }