Exemple #1
0
        //void DoFollow(FollowCmpt f)
        //{
        //    if (null == f)
        //    {
        //        return;
        //    }

        //    PeTrans trans = Entity.peTrans;

        //    f.Follow(trans);
        //}

        //void DoDefollow(FollowCmpt f)
        //{
        //    if (null == f)
        //    {
        //        return;
        //    }

        //    f.Defollow();
        //}
        public override void Awake()
        {
            base.Awake();
            mInstance            = this;
            mFollowers           = new NpcCmpt[MaxFollower];
            mpeEntity            = GetComponent <PeEntity>();
            FreeNpcEventHandler += PlayerNetwork.RequestDismissNpc;
        }
Exemple #2
0
        public override void Start()
        {
            base.Start();
            Invoke("InitFollower", 0.5f);

            //lw2017.1.16:初始化servantLeaderCmpt时玩家Entity可能未被初始化好
            if (PeCreature.Instance.mainPlayer != null)
            {
                mInstance = PeCreature.Instance.mainPlayer.GetCmpt <ServantLeaderCmpt>();
            }

            if (PeEventGlobal.Instance != null && PeEventGlobal.Instance.DestroyEvent != null)
            {
                PeEventGlobal.Instance.DestroyEvent.AddListener(OnFollowerEntityDestroy);
            }
        }
Exemple #3
0
 void AttachEvent()
 {
     Pathea.Action_Fell actionFell = Pathea.PeCreature.Instance.mainPlayer.motionMgr.GetAction <Pathea.Action_Fell>();
     if (null != actionFell)
     {
         mAttached             = true;
         actionFell.startFell += StartFell;
         actionFell.endFell   += EndFell;
         actionFell.hpChange  += SetSliderValue;
     }
     Pathea.ServantLeaderCmpt servantLeaderCmpt = Pathea.PeCreature.Instance.mainPlayer.GetCmpt <Pathea.ServantLeaderCmpt>();
     if (null != servantLeaderCmpt)
     {
         servantLeaderCmpt.changeEventor.Subscribe(OnServantChange);
     }
 }
Exemple #4
0
    string DoEntityCmd(int id, string funcName, string[] args)
    {
        Pathea.PeEntity entity = Pathea.EntityMgr.Instance.Get(id);
        if (null == entity)
        {
            return("can't find entity by id:" + id);
        }

        switch (funcName)
        {
        case "servant":
            Pathea.NpcCmpt npcCmpt = entity.GetCmpt <Pathea.NpcCmpt>();
            if (npcCmpt == null)
            {
                return("no NpcCmpt.");
            }

            Pathea.ServantLeaderCmpt leader = Pathea.PeCreature.Instance.mainPlayer.GetCmpt <Pathea.ServantLeaderCmpt>();
            if (leader == null)
            {
                return("no ServantLeaderCmpt");
            }

            leader.AddServant(npcCmpt);
            npcCmpt.SetServantLeader(leader);
            return("ok");

        case "start_skill":
            int targetId;
            if (!int.TryParse(args[0], out targetId))
            {
                return("get target id failed");
            }
            Pathea.PeEntity      targetEntity = Pathea.EntityMgr.Instance.Get(targetId);
            Pathea.SkAliveEntity skillCmpt    = targetEntity.GetCmpt <Pathea.SkAliveEntity>();
            if (null == skillCmpt)
            {
                return("target have no SkillCmpt");
            }
            int skillId;
            if (!int.TryParse(args[1], out skillId))
            {
                return("get skill id failed");
            }
            skillCmpt.StartSkill(skillCmpt, skillId);
            return("ok");

        case "Kill":
            Pathea.PeEntity killEntity = Pathea.EntityMgr.Instance.Get(id);
            if (killEntity == null)
            {
                return("get entity failed with id : " + id);
            }
            killEntity.SetAttribute(Pathea.AttribType.Hp, 0.0f, false);
            return("ok");

        //case "SetBool":
        //    string animationName = args[0];
        //    bool value;
        //    if (!bool.TryParse(args[1], out value))
        //    {
        //        return "get value failed";
        //    }

        //    entity.SetBool(animationName, value);
        //    return "ok";
        default:
            return("not implementd cmd");
        }
    }