protected override void OnEnter(RemoteBlackBoard blackBoard)
        {
            m_sDistance = 0;
            m_cRemote   = blackBoard.remote;
            var remoteTargetType = blackBoard.remote.remoteData.remoteTarget;

            switch (remoteTargetType)
            {
            case RemoteTargetType.Target:
                m_sTargetPosition = m_cRemote.target.curPosition;
                break;

            case RemoteTargetType.TargetForward:
                m_sTargetPosition = m_cRemote.curPosition + m_cRemote.targetForward * m_cActionData.maxDistance;
                break;

            case RemoteTargetType.TargetPosition:
                m_sTargetPosition = m_cRemote.targetPosition;
                break;
            }
            m_cPointMove.Clear();
            m_cPointMove.OnMoveStart += OnStartMove;
            m_cPointMove.OnMove      += OnMove;
            m_cPointMove.OnMoveStop  += OnStopMove;
            m_cPointMove.OnWillMove  += OnWillMove;
            m_cPointMove.Move(m_cRemote.curPosition, m_sTargetPosition, m_cActionData.speed);
            m_eCurActionResult = BTActionResult.Running;
        }
        public override BTActionResult OnRun(RemoteBlackBoard blackBoard)
        {
            m_cPointMove.OnUpdate(blackBoard.deltaTime);
            Remote remote = blackBoard.remote;

            if (remote.remoteData.remoteTarget == RemoteTargetType.Target)
            {
                var nextTargetPosition = remote.target.curPosition;
                if (nextTargetPosition != m_sTargetPosition)
                {
                    m_sTargetPosition = nextTargetPosition;
                    m_cPointMove.Move(remote.curPosition, m_sTargetPosition, m_cActionData.speed);
                    m_eCurActionResult = BTActionResult.Running;
                }
            }

            return(m_eCurActionResult);
        }
Beispiel #3
0
        public override BTActionResult OnRun(RemoteBlackBoard blackBoard)
        {
            Remote   remote       = blackBoard.remote;
            TSVector bornPosition = remote.curPosition;
            TSVector bornForward  = remote.curForward;

            if (!string.IsNullOrEmpty(m_cActionData.hangPoint))
            {
                remote.GetHangPoint(m_cActionData.hangPoint, out bornPosition, out bornForward);
            }
            TSVector targetForward = remote.targetForward;

            if (m_cActionData.useHangPoint)
            {
                targetForward = bornForward;
            }
            BattleScene.Instance.CreateRemote(m_cActionData.remoteId, remote.campId, bornPosition, targetForward, remote.targetAgentId, remote.targetAgentType, remote.targetPosition, targetForward);
            return(BTActionResult.Ready);
        }
Beispiel #4
0
        public void Init(uint id, int configId, int campId, TSVector position, TSVector forward, uint targetAgentId, AgentObjectType targetAgentType, TSVector targetPosition, TSVector targetForward)
        {
            m_nId                = id;
            m_nConfigId          = configId;
            m_nCampId            = campId;
            this.gameObject.name = "remote_" + m_nId + "_" + m_nConfigId;
            m_cRemoteTree        = RemoteTreePool.Instance.GetRemoteTree(m_nConfigId);
            m_cRemoteData        = m_cRemoteTree.data as RemoteData;
            m_cAgentObj          = new AgentRemote(this);
            SetPosition(position);
            SetViewPosition(position);
            m_sLastPosition = position;
            SetForward(forward);
            SetViewForward(forward);
            m_sLastForward = forward;
            if (m_cBlackBoard == null)
            {
                m_cBlackBoard = new RemoteBlackBoard(this);
            }

            m_cTarget         = AgentObject.GetAgentObject(targetAgentId, targetAgentType);
            m_sTargetPosition = targetPosition;
            m_sTargetForward  = targetForward;
            m_cView           = SceneEffectPool.Instance.CreateEffect(m_cRemoteData.remotePath, false, this.transform);
            m_cLerpView       = gameObject.AddComponentOnce <LerpMoveView>();
            m_cLerpView.Init();
            m_cLerpView.StopMove();

            m_cHangPoint = gameObject.AddComponentOnce <HangPoint>();
            string remoteFullPath = PathTool.GetSceneEffectPath(m_cRemoteData.remotePath);

            m_cHangPoint.Init(remoteFullPath);
            //暂时不支持表现挂点(特效上挂特效)
            m_cHangPoint.InitHangView(null);

            m_cCollider = ObjectPool <GameCollider> .Instance.GetObject();

            m_cCollider.Init(remoteFullPath);
            m_cCollider.Update(curPosition, curForward);
        }
 public virtual BTActionResult OnRun(RemoteBlackBoard blackBoard)
 {
     return(BTActionResult.Running);
 }
 public virtual void OnExit(RemoteBlackBoard blackBoard)
 {
 }
 protected virtual void OnEnter(RemoteBlackBoard blackBoard)
 {
 }
 public override void OnExit(RemoteBlackBoard blackBoard)
 {
     m_cPointMove.Clear();
     m_cRemote = null;
     base.OnExit(blackBoard);
 }