void FreeServant()
    {
        if (npcCmpt == null || leaderCmpt == null)
        {
            return;
        }

        if (Pathea.PeGameMgr.IsMulti)
        {
            if (null != npcCmpt)
            {
                leaderCmpt.OnFreeNpc(npcCmpt.Entity.Id);
            }
        }
        else
        {
            leaderCmpt.RemoveServant(npcCmpt);
        }
    }
Beispiel #2
0
            public static bool SetFollower(this PeEntity entity, bool bFlag, int index = -1)
            {
                ServantLeaderCmpt masterCmpt = PeCreature.Instance.mainPlayer.GetCmpt <ServantLeaderCmpt>();
                NpcCmpt           npcCmpt    = entity.NpcCmpt;

                if (!bFlag)
                {
                    return(masterCmpt.RemoveServant(npcCmpt));
                }
                else
                {
                    //set floower succeed talk
                    entity.NpcCmpt.AddTalkInfo(ENpcTalkType.Conscribe_succeed, ENpcSpeakType.TopHead);
                    if (index == -1)
                    {
                        return(masterCmpt.AddServant(npcCmpt));
                    }
                    return(masterCmpt.AddServant(npcCmpt, index));
                }
            }