Beispiel #1
0
 public void ReachPoint(PeEntity npc)
 {
     if (GameUI.Instance != null && GameUI.Instance.mNPCTalk != null)
     {
         GameUI.Instance.mNPCTalk.NpcReachToTalk(npc);
     }
 }
Beispiel #2
0
        public void OnGUI()
        {
            if (!_initialized)
            {
                return;
            }

            guiMgr.DrawGUI();

            if (s_ShowTools)
            {
                mNPCid = GUI.TextArea(new Rect(100, 130 + 140, 80, 20), mNPCid);
                if (GUI.Button(new Rect(10, 130 + 140, 70, 20), "EntityId"))
                {
                    OBJECT obj;
                    obj.type  = OBJECT.OBJECTTYPE.WorldObject;
                    obj.Group = 0;
                    obj.Id    = System.Convert.ToInt32(mNPCid);
                    Pathea.PeEntity entity = PeScenarioUtility.GetEntity(obj);
                    if (entity != null)
                    {
                        Vector3 pos = PeCreature.Instance.mainPlayer.position;
                        pos.z += 2;
                        pos.y += 1;

                        entity.peTrans.position      = pos;
                        entity.NpcCmpt.FixedPointPos = pos;
                    }
                }
            }
        }
Beispiel #3
0
        public PeEntity CreateNpc(int id, int protoId, Vector3 pos, Quaternion rot, Vector3 scl)
        {
            if (Pathea.WorldInfoMgr.Instance.IsNonRecordAutoId(id))
            {
                throw new System.Exception("id:" + id + " is non record id, can not used here. use PeEntityCreator.Instance.CreateMonster()");
            }

            PeEntity entity = PeEntityCreator.Instance.CreateNpc(id, protoId, pos, rot, scl);

            if (entity == null)
            {
                return(null);
            }


            PeEntity robot = PeEntityCreator.Instance.CreateNpcRobot(id, protoId, pos, rot, scl);

            if (robot != null)
            {
                mList.Add(robot.Id);
            }


            mList.Add(id);
            return(entity);
        }
    public bool RequestGetOnTrain(int routeId, int entityId)
    {
        if (!GameConfig.IsMultiMode)
        {
            return(DoGetOnTrain(entityId, routeId));
        }
        else
        {
            Pathea.PeEntity entity = Pathea.EntityMgr.Instance.Get(entityId);
            if (null == entity)
            {
                Debug.LogError("cant find entity:" + entityId);
                return(false);
            }

            Pathea.MotionMgrCmpt mmc = entity.GetCmpt <Pathea.MotionMgrCmpt>();
            if (null == mmc)
            {
                Debug.LogError("no Pathea.RailPassengerCmpt");
                return(false);
            }
            if (mmc.CanDoAction(Pathea.PEActionType.GetOnTrain))
            {
                if (null != PlayerNetwork.mainPlayer)
                {
                    PlayerNetwork.mainPlayer.RPCServer(EPacketType.PT_InGame_Railway_GetOnTrain, routeId, entityId);
                }
            }

            return(true);
        }
    }
Beispiel #5
0
        /******************************************************
         * 基地仓库给特定npc补给(从仓库移除,添加到NPC背包)
         * ***************************************************/
        public static bool CsStorageSupply(PeEntity npc, CSAssembly assembly, int protoId, int count)
        {
            if (assembly == null || assembly.Storages == null || npc.packageCmpt == null)
            {
                return(false);
            }

            int curCount = CSUtils.GetItemCounFromFactoryAndAllStorage(protoId, assembly);

            if (curCount > count)
            {
                if (CSUtils.CountDownItemFromAllStorage(protoId, count, assembly))
                {
                    return(npc.packageCmpt.Add(protoId, count));
                }
            }
            else if (curCount > 0)
            {
                if (CSUtils.CountDownItemFromAllStorage(protoId, curCount, assembly))
                {
                    return(npc.packageCmpt.Add(protoId, curCount));
                }
            }
            return(false);
        }
Beispiel #6
0
 public void OnTargetDiscover(PeEntity target)
 {
     if (m_Target != null && target != null)
     {
         m_Target.OnTargetDiscover(target);
     }
 }
Beispiel #7
0
        public static bool TakeOffEquip(Pathea.PeEntity entity)
        {
            if (entity == null || entity.motionEquipment == null || entity.motionEquipment.PEHoldAbleEqObj == null)
            {
                return(false);
            }

            if (entity.equipmentCmpt == null)
            {
                return(false);
            }

            EquipmentCmpt.Receiver receiver = entity.packageCmpt;
            if (GameConfig.IsMultiMode)
            {
                if (entity.equipmentCmpt.TryTakeOffEquipment(entity.motionEquipment.PEHoldAbleEqObj, true, receiver))
                {
                    PlayerNetwork.mainPlayer.RequestNpcTakeOffEquip(entity.Id, entity.motionEquipment.PEHoldAbleEqObj.instanceId, -1);
                    return(true);
                }
            }
            else
            {
                return(entity.equipmentCmpt.TakeOffEquipment(entity.motionEquipment.PEHoldAbleEqObj, true, receiver));
            }
            return(false);
        }
Beispiel #8
0
 public void DispatchBeEnemyEnterEvent(PeEntity attacker)
 {
     if (OnBeEnemyEnter != null)
     {
         OnBeEnemyEnter(attacker);
     }
 }
Beispiel #9
0
 public void DispatchBeEnemyExitEvent(PeEntity attacker)
 {
     if (OnBeEnemyExit != null)
     {
         OnBeEnemyExit(attacker);
     }
 }
Beispiel #10
0
 public void DispatchEnemyAchieveEvent(PeEntity enemy)
 {
     if (OnEnemyAchieve != null)
     {
         OnEnemyAchieve(enemy);
     }
 }
Beispiel #11
0
 public void DispatchEnemyLostEvent(PeEntity enemy)
 {
     if (OnEnemyLost != null)
     {
         OnEnemyLost(enemy);
     }
 }
Beispiel #12
0
 public void DispatchEnemyEnterEvent(PeEntity enemy)
 {
     if (OnEnemyEnter != null)
     {
         OnEnemyEnter(enemy);
     }
 }
Beispiel #13
0
    // Update is called once per frame
    void Update()
    {
        if (Application.isEditor)
        {
            //UpdateTest();
        }

        //lz-2016.11.03 有数据的情况下保证每一帧都有显示有效数据
        m_CurFrameHasShow = false;
        while (!m_CurFrameHasShow && null != m_HPEventData) //lz-2016.11.07 有可能会变空
        {
            HPChangeEventData data = m_HPEventData.Pop();
            //lz-2016.11.03 因为这里是用栈处理的,只显示最新的,如果堆积超时的就不要了
            if (null == data || Time.realtimeSinceStartup - data.m_AddTime >= m_DataOutTime)
            {
                m_CurFrameHasShow = true;
            }
            else
            {
                if (null != data.m_Transfrom && null != data.m_Self)
                {
                    Pathea.PeEntity entity = data.m_Self.GetComponent <Pathea.PeEntity>();
                    //lz-2016.11.03 entity没有死,并且Transfrom还存在的时候才显示HPChange效果
                    if (null != entity && !entity.IsDeath())
                    {
                        if (ShowHPChange(data.m_HPChange, data.m_Transfrom.position, data.m_Proto))
                        {
                            m_CurFrameHasShow = true;
                        }
                    }
                }
            }
        }
    }
Beispiel #14
0
        public override void DoAction(PEActionParam para = null)
        {
            if (null == viewCmpt)
            {
                return;
            }
            motionMgr.SetMaskState(PEActionMask.Wentfly, true);

            PEActionParamVFNS paramVFNS = para as PEActionParamVFNS;

            Vector3 force = paramVFNS.vec * paramVFNS.f;

            PeEntity entity = EntityMgr.Instance.Get(paramVFNS.n);

            motionMgr.FreezePhyState(GetType(), true);

            if (null != entity)
            {
                Transform hitColTran = entity.biologyViewCmpt.GetRagdollTransform(paramVFNS.str);
                if (null != hitColTran)
                {
                    RagdollHitInfo hitInfo = new RagdollHitInfo();
                    hitInfo.hitTransform = hitColTran;
                    hitInfo.hitPoint     = hitColTran.position;
                    hitInfo.hitForce     = force;
                    hitInfo.hitNormal    = -force.normalized;
                    viewCmpt.ActivateRagdoll(hitInfo, false);
                }
            }
            if (null != phyCtrl)
            {
                phyCtrl.desiredMovementDirection = Vector3.zero;
                phyCtrl.CancelMoveRequest();
            }
        }
Beispiel #15
0
        static bool  IsWantContinueEat(PeEntity entity, out List <AttrPer> AttrPers)
        {
            AttrPers = new List <AttrPer>();
            if (entity == null)
            {
                return(false);
            }

            AttrPer attrper = WantByType(entity, AttribType.Hp, AttribType.HpMax, true);

            if (attrper != null)
            {
                AttrPers.Add(attrper);
            }

            attrper = WantByType(entity, AttribType.Comfort, AttribType.ComfortMax, true);
            if (attrper != null)
            {
                AttrPers.Add(attrper);
            }

            attrper = WantByType(entity, AttribType.Hunger, AttribType.HungerMax, true);
            if (attrper != null)
            {
                AttrPers.Add(attrper);
            }


            return(AttrPers.Count > 0);
        }
Beispiel #16
0
        public bool BeCooperationTarget(PeEntity target)
        {
            for (int i = 0; i < mCooperationLists.Count; i++)
            {
                AtkCooperation atk = mCooperationLists[i] as AtkCooperation;
                if (atk == null)
                {
                    continue;
                }

                if (atk.HasBeTarget(target))
                {
                    atk.SetAtkTarget(target);
                    return(true);
                }
            }

            for (int i = 0; i < mCooperationLists.Count; i++)
            {
                AtkCooperation atk = mCooperationLists[i] as AtkCooperation;
                if (atk == null)
                {
                    continue;
                }

                if (atk.CanBeTarget(target))
                {
                    atk.AddAktTarget(target);
                    return(true);
                }
            }
            return(false);
        }
Beispiel #17
0
 public void OnDamageMember(PeEntity caster, float value)
 {
     if (m_Target != null && caster != null)
     {
         m_Target.OnDamageMember(caster, value);
     }
 }
Beispiel #18
0
 public override bool RemoveOut(PeEntity member)
 {
     RemoveFromCooper(member);
     member.target.SetEnityCanAttack(true); //// used false
     member.NpcCmpt.BattleMgr.SetSelectEnemy(null);
     return(base.RemoveOut(member));
 }
Beispiel #19
0
        //public static bool ChangeEquip(Pathea.PeEntity entity, EeqSelect select)
        //{
        //    List<ItemObject> objs = entity.GetEquipObjs(select);
        //    if (objs.Count > 0 && GameUI.Instance.mServantWndCtrl.ServantIsNotNull)
        //    {
        //        EquipmentCmpt.Receiver receiver = entity.packageCmpt;
        //        if (GameUI.Instance.mServantWndCtrl.EquipItem(objs[0], receiver))
        //        {
        //            return entity.RemoveFromBag(objs[0]);
        //        }
        //    }
        //    return false;
        //}

        public static bool EquipByObj(Pathea.PeEntity entity, ItemObject obj)
        {
            if (obj == null || entity.equipmentCmpt == null)
            {
                return(false);
            }

            EquipmentCmpt.Receiver receiver = entity.packageCmpt;
            if (GameConfig.IsMultiMode)
            {
                if (entity.equipmentCmpt.NetTryPutOnEquipment(obj, true, receiver))
                {
                    entity.netCmpt.RequestUseItem(obj.instanceId);
                    //entity.RemoveFromBag(obj);
                    return(true);
                }
            }
            else
            {
                if (entity.equipmentCmpt.PutOnEquipment(obj, true, receiver))
                {
                    if (SelectItem_N.Instance.ItemObj != null && SelectItem_N.Instance.ItemObj.Equals(obj))
                    {
                        SelectItem_N.Instance.SetItem(null);
                    }

                    entity.RemoveFromBag(obj);
                    return(true);
                }
            }
            return(false);
        }
Beispiel #20
0
        public override void OnMsgLine(params object[] objs)
        {
            ELineMsg msg = (ELineMsg)objs[0];

            switch (msg)
            {
            case ELineMsg.ADD_Target:
            {
                PeEntity target = (PeEntity)objs[1];
                if (!mAtkTargets.Contains(target))
                {
                    AddAktTarget(target);
                    UpdateAtkTarget();
                }
            }
            break;

            case ELineMsg.REMOVE_Target: break;

            default:
                break;
            }

            return;
        }
 // 判断条件
 public override bool?Check()
 {
     if (player.type == OBJECT.OBJECTTYPE.Player && equip.type == OBJECT.OBJECTTYPE.ItemProto)
     {
         Pathea.PeEntity entity = PeScenarioUtility.GetEntity(player);
         if (entity != null && entity.equipmentCmpt != null)
         {
             List <ItemObject> list = entity.equipmentCmpt._ItemList;
             for (int i = 0; i < list.Count; ++i)
             {
                 if (equip.isAnyPrototype)
                 {
                     return(true);
                 }
                 if (equip.isAnyPrototypeInCategory && list[i].protoData.editorTypeId == equip.Group)
                 {
                     return(true);
                 }
                 if (list[i].protoId == equip.Id)
                 {
                     return(true);
                 }
             }
         }
     }
     return(false);
 }
Beispiel #22
0
        public static List <AttrPer> IsNeedEatAttr(PeEntity entity)
        {
            List <AttrPer> _AttrPers = null;

            IsWantEat(entity, out _AttrPers);
            return(_AttrPers);
        }
Beispiel #23
0
 public void ShowSleepWnd(bool show, MonoBehaviour operater = null, PESleep peSleep = null, Pathea.PeEntity character = null, System.Action <float> sleep = null)
 {
     //lz-2016.06.01 不经过菜单直接打开SleepWnd的时候要先打开ItemOP
     if (!isShow)
     {
         Show();
     }
     if (show && operater != null)
     {
         if (!mInit)
         {
             InitWindow();
         }
         mSleepWnd.SetActive(true);
         mMainWnd.SetActive(false);
         InitSleepTime();
         m_PeSleep = peSleep;
         mEntity   = character;
         //mDoSleep = sleep;
         SetOperater(operater);
     }
     else
     {
         mSleepWnd.SetActive(false);
     }
 }
Beispiel #24
0
    public static void OnMonsterAdd(int id, AiNetwork ai, Pathea.PeEntity entity)
    {
        EntityMonsterBeacon mbEntity = Pathea.EntityMgr.Instance.Get(id) as EntityMonsterBeacon;

        if (null != mbEntity)
        {
            mbEntity.OnMonsterCreated(entity);
        }
        else
        {
            if (null != entity)
            {
                Pathea.CommonCmpt cc = entity.GetCmpt <Pathea.CommonCmpt>();
                if (cc != null)
                {
                    AiTowerDefense td = AiTowerDefense.Get <AiTowerDefense>(id);
                    if (null != td)
                    {
                        cc.TDpos = td._pos;
                    }
                }

                Pathea.SkAliveEntity sae = entity.GetCmpt <Pathea.SkAliveEntity>();
                if (sae != null)
                {
                    sae.SetAttribute(Pathea.AttribType.DefaultPlayerID, 8);
                    sae.SetAttribute(Pathea.AttribType.CampID, 26);
                }
            }
        }
    }
Beispiel #25
0
 public void ReachPoint(PeEntity npc)
 {
     if (StroyManager.Instance != null)
     {
         StroyManager.Instance.EntityReach(npc, true);
     }
 }
Beispiel #26
0
 public override void InitEquipment(Pathea.PeEntity entity, ItemAsset.ItemObject itemObj)
 {
     base.InitEquipment(entity, itemObj);
     m_Anim = GetComponentInChildren <Animator>();
     m_View.AttachObject(gameObject, AttachBone);
     SetOpenState(false);
 }
    public override void InitEquipment(Pathea.PeEntity entity, ItemAsset.ItemObject itemObj)
    {
        base.InitEquipment(entity, itemObj);
        m_Equip.SetEnergySheild(this);
        m_EnergyAttr = m_ItemObj.GetCmpt <ItemAsset.Energy>();

        if (null != m_EnergyAttr)
        {
            m_Entity.SetAttribute(AttribType.Shield, m_EnergyAttr.energy.current);
            m_EnergyAttr.SetMax(m_MaxEnergy);
        }
        m_Entity.SetAttribute(AttribType.ShieldMax, m_MaxEnergy);

        lastUsedTime = Time.time;

        m_Time             = new UTimer();
        m_Time.ElapseSpeed = -1f;
        m_Time.Second      = GameConfig.NetUpdateInterval;
        m_LastNetValue     = enCurrent;

        if (!m_Active)
        {
            DeactiveSheild();
        }
    }
Beispiel #28
0
        void OnDamage(SkEntity entity, float damage)
        {
            if (null == Entity.peSkEntity || null == entity)
            {
                return;
            }

            PeEntity peEntity = entity.GetComponent <PeEntity>();

            if (peEntity == Entity)
            {
                return;
            }

            float tansDis  = peEntity.IsBoss ? 128f : 64f;
            int   playerID = (int)Entity.peSkEntity.GetAttribute((int)AttribType.DefaultPlayerID);

            bool canTrans = false;

            if (GameConfig.IsMultiClient)
            {
                if (ForceSetting.Instance.GetForceType(playerID) == EPlayerType.Human)
                {
                    canTrans = true;
                }

                int tarPlayerId = (int)peEntity.GetAttribute(AttribType.DefaultPlayerID);
                if (ForceSetting.Instance.GetForceType(tarPlayerId) == EPlayerType.Human)
                {
                    List <PeEntity> entities = EntityMgr.Instance.GetEntities(peEntity.position, tansDis, tarPlayerId, false, peEntity);
                    for (int i = 0; i < entities.Count; i++)
                    {
                        if (!entities[i].Equals(Entity) && entities[i].target != null)
                        {
                            entities[i].target.TransferHatred(Entity, damage);
                        }
                    }
                }
            }
            else
            {
                if (ForceSetting.Instance.GetForceID(playerID) == 1)
                {
                    canTrans = true;
                }
            }

            if (canTrans)
            {
                List <PeEntity> entities = EntityMgr.Instance.GetEntities(Entity.peTrans.position, tansDis, playerID, false, Entity);
                for (int i = 0; i < entities.Count; i++)
                {
                    if (!entities[i].Equals(Entity) && entities[i].target != null)
                    {
                        entities[i].target.TransferHatred(peEntity, damage);
                    }
                }
            }
        }
Beispiel #29
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;
        }
Beispiel #30
0
        public void  OnAtkTargetDeath(SkillSystem.SkEntity skSelf, SkillSystem.SkEntity skCaster)
        {
            PeEntity self = skSelf.GetComponent <PeEntity>();

            RemoveEnemy(self);
            RomoveAtkTarget(self);
            ClearCooper();
        }