Beispiel #1
0
        private void MoveToPosition(Vector3 position)
        {
            if (mDMono != null && !NetworkOwnershipComponent.IsGameObjectLocallyOwned(mDMono.gameObject, _network))
            {
                return;
            }

            if (enemyController != null && enemyController.TargetingComponent != null)
            {
                enemyController.TargetingComponent.SetMovementTargetNoRPC(position);
            }
        }
Beispiel #2
0
    public void SetMovementTarget(Vector3 target, bool isNull = false, bool shouldIssueCommand = true, bool isNeedShowReticle = true, bool force = false)
    {
        if (!force)
        {
            if (!NetworkOwnershipComponent.IsGameObjectLocallyOwned(gameObject, _network))
            {
                return;
            }
        }
        if (force)
        {
            EB.Debug.Log("Start SetMovementTarget by transfer dart");
        }

        if (!isNull)
        {
            bool isValidNewTarget = !_movementTarget.HasValue;
            if (_movementTarget.HasValue)
            {
                Vector3 toTarget = target - _movementTarget.Value;
                isValidNewTarget = toTarget.sqrMagnitude > MinDistForNewMovementTargetSq;
            }

            if (isValidNewTarget)
            {
                SetMoveTargetRPC(target, shouldIssueCommand);
                // Hotfix_LT.Messenger.Raise<Vector3>(Hotfix_LT.EventName.PlayerMoveSyncManagerMove, target);
                //GlobalUtils.CallStaticHotfix("Hotfix_LT.MessengerAdapter", "PlayerMoveSyncManagerMove", target);
                if (_viewRPC != null)
                {
                    _viewRPC.RPC("SetMoveTargetRPC", EB.RPCMode.Others, target, shouldIssueCommand);
                }
            }
        }
        else
        {
            ClearMoveTargetRPC();
            // Hotfix_LT.Messenger.Raise<Vector3>(Hotfix_LT.EventName.PlayerMoveSyncManagerMove, gameObject.transform.position);
            //GlobalUtils.CallStaticHotfix("Hotfix_LT.MessengerAdapter", "PlayerMoveSyncManagerMove", gameObject.transform.position);
            if (_viewRPC != null)
            {
                _viewRPC.RPC("ClearMoveTargetRPC", EB.RPCMode.Others);
            }
        }

        if (isNeedShowReticle && OnMovementTargetChangeRequest != null)
        {
            OnMovementTargetChangeRequest(target, isNull);
        }
    }
Beispiel #3
0
    /// <summary>
    /// �������ڵ��Ѿ�����Ŀ�ĵ�ֹͣ�ƶ� ����Ҫ����������Ϣ
    /// </summary>
    /// <param name="shouldIssueCommand"></param>
    public void StopMoveInDestination(bool shouldIssueCommand = true)
    {
        if (!NetworkOwnershipComponent.IsGameObjectLocallyOwned(gameObject, _network))
        {
            return;
        }

        ClearMoveTargetRPC();
        if (_viewRPC != null)
        {
            _viewRPC.RPC("ClearMoveTargetRPC", EB.RPCMode.Others);
        }

        if (OnMovementTargetChangeRequest != null)
        {
            OnMovementTargetChangeRequest(Vector3.zero, true);
        }
    }
Beispiel #4
0
    public void SetAttackTarget(GameObject target, bool shouldIssueCommand = true)
    {
        if (/*(GameStateManager.Instance.State != eGameState.Overworld) &&*/ !NetworkOwnershipComponent.IsGameObjectLocallyOwned(gameObject, _network))
        {
            return;
        }

        if (target != null)
        {
            SetMovementTargetNoRPC(Vector3.zero, true);
            SetAttackTargetFromRPC(target, shouldIssueCommand);
        }
        else
        {
            ClearAttackTargetRPC();

            if (_viewRPC != null)
            {
                _viewRPC.RPC("ClearAttackTargetRPC", EB.RPCMode.Others);
            }
        }
    }