Beispiel #1
0
        public override void DoAction(PEActionParam para = null)
        {
            if (null == trans || null == move)
            {
                return;
            }
            PEActionParamN paramN       = para as PEActionParamN;
            PeEntity       targetEntity = EntityMgr.Instance.Get(paramN.n);

            if (null != targetEntity)
            {
                m_TargetMotion = targetEntity.motionMgr;
            }
            else
            {
                return;
            }

            if (null != m_TargetMotion)
            {
                m_TargetAction = m_TargetMotion.GetAction <Action_Handed>();
            }
            else
            {
                return;
            }

            m_TargetTrans = targetEntity.peTrans;
            if (null == m_TargetTrans)
            {
                return;
            }

            if (null == m_MoveAction)
            {
                m_MoveAction = motionMgr.GetAction <Action_Move>();
            }

            m_AnimMatch = false;
            motionMgr.SetMaskState(PEActionMask.Hand, true);
            PEActionParamN param = PEActionParamN.param;

            param.n = motionMgr.Entity.Id;
            m_TargetMotion.DoActionImmediately(PEActionType.Handed, param);
            m_EndAction   = false;
            m_StartTime   = Time.time;
            m_CurTryCount = 0;
            if (PeGameMgr.IsMulti && entity == PeCreature.Instance.mainPlayer)
            {
                targetEntity.netCmpt.network.RPCServer(EPacketType.PT_NPC_RequestAiOp, (int)EReqType.Hand, entity.Id);
            }
        }
Beispiel #2
0
        private void AddMoveSelectionResponder(Action_Move move, GameObject go)
        {
            var collider = go.AddComponent <BoxCollider2D>();

            collider.size = Vector2.one;

            var input = go.AddComponent <InputResponder>();

            input.OnStopClick += (_input, mPos) =>
            {
                CurrentPiece = null;
                move.DoAction();
            };
        }