Exemplo n.º 1
0
        //在NPC有MoveToPointrequest时候,玩家传送时多人处理:controler丢失直接让NPC传送到需求点
        public void RequsetProtect()
        {
            if (Contains(EReqType.MoveToPoint))
            {
                if (Entity != null && Entity.NpcCmpt != null)
                {
                    RQMoveToPoint request = GetRequest(EReqType.MoveToPoint) as RQMoveToPoint;
                    if (request != null)
                    {
                        Vector3 pos = request.position;
                        StroyManager.Instance.EntityReach(Entity, true);
                        Entity.NpcCmpt.Req_Remove(EReqType.MoveToPoint);
                        Entity.NpcCmpt.Req_Translate(pos);
                    }
                }
            }

            if (Contains(EReqType.TalkMove))
            {
                if (Entity != null && Entity.NpcCmpt != null)
                {
                    RQTalkMove request = GetRequest(EReqType.TalkMove) as RQTalkMove;
                    if (request != null)
                    {
                        Vector3 pos = request.position;
                        Entity.NpcCmpt.Req_Remove(EReqType.TalkMove);
                        Entity.NpcCmpt.Req_Translate(pos);
                    }
                }
            }

            if (Contains(EReqType.FollowTarget))
            {
                if (Entity != null && Entity.NpcCmpt != null)
                {
                    RQFollowTarget request = GetRequest(EReqType.FollowTarget) as RQFollowTarget;
                    if (request != null)
                    {
                        PeEntity target = EntityMgr.Instance.Get(request.id);
                        if (target != null)
                        {
                            Vector3 pos = target.position;
                            Entity.NpcCmpt.Req_Remove(EReqType.FollowTarget);
                            Entity.NpcCmpt.Req_Translate(pos, true, false);
                            Entity.NpcCmpt.Req_FollowTarget(target.Id, request.targetPos, request.dirTargetID, request.tgtRadiu);
                        }
                    }
                }
            }
        }
Exemplo n.º 2
0
        public Request Register(EReqType type, params object[] objs)
        {
            Request request = null;

            switch (type)
            {
            case EReqType.Dialogue:
                request = new RQDialogue(objs);
                break;

            case EReqType.Idle:
                request = new RQIdle(objs);
                break;

            case EReqType.Animation:
                request = new RQAnimation(objs);
                break;

            case EReqType.MoveToPoint:
                request = new RQMoveToPoint(objs);
                break;

            case EReqType.TalkMove:
                request = new RQTalkMove(objs);
                break;

            case EReqType.FollowPath:
                request = new RQFollowPath(objs);
                break;

            case EReqType.FollowTarget:
                request = new RQFollowTarget(objs);
                break;

            case EReqType.Salvation:
                request = new RQSalvation(objs);
                break;

            case EReqType.Translate:
                request = new RQTranslate(objs);
                break;

            case EReqType.Rotate:
                request = new RQRotate(objs);
                break;

            case EReqType.Attack:
                request = new RQAttack();
                break;

            case EReqType.PauseAll:
                request = new RQPauseAll();
                break;

            case EReqType.UseSkill:
                request = new RQUseSkill();
                break;
            }

            if (!CalculateRelation(request))
            {
                return(null);
            }

            AddRequest(request);
            return(request);
        }