// 判断条件
 public override bool?Check()
 {
     if (player.type == OBJECT.OBJECTTYPE.Player && item.type == OBJECT.OBJECTTYPE.ItemProto)
     {
         Pathea.PeEntity entity = PeScenarioUtility.GetEntity(player);
         if (entity != null && entity.packageCmpt != null)
         {
             int num = 0;
             if (item.isSpecificPrototype)
             {
                 num = entity.packageCmpt.GetItemCount(item.Id);             //某种item
             }
             else if (item.isAnyPrototypeInCategory)
             {
                 num = entity.packageCmpt.GetCountByEditorType(item.Group);  //某大类item
             }
             else if (item.isAnyPrototype)
             {
                 num = entity.packageCmpt.GetAllItemsCount();                //全部item
             }
             if (Utility.Compare(num, count, comp))
             {
                 return(true);
             }
         }
     }
     return(false);
 }
        // 判断条件
        public override bool?Check()
        {
            Transform trans1 = PeScenarioUtility.GetObjectTransform(obj1);
            Transform trans2 = PeScenarioUtility.GetObjectTransform(obj2);

            if (trans1 == null || trans2 == null)
            {
                return(false);
            }

            Vector3 directrix = trans2.position - trans1.position;
            Vector3 forward   = trans1.forward;
            Vector3 right     = trans1.right;

            directrix.y = forward.y = right.y = 0;
            switch (axis)
            {
            case EAxis.Left: return(Utility.Compare(Vector3.Angle(-right, directrix), amt, comp));

            case EAxis.Right: return(Utility.Compare(Vector3.Angle(right, directrix), amt, comp));

            case EAxis.Down: return(true);

            case EAxis.Up: return(true);

            case EAxis.Backward: return(Utility.Compare(Vector3.Angle(-forward, directrix), amt, comp));

            case EAxis.Forward: return(Utility.Compare(Vector3.Angle(forward, directrix), amt, comp));
            }
            return(false);
        }
 // 判断条件
 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);
 }
示例#4
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;
                    }
                }
            }
        }
示例#5
0
        // 执行动作
        // 若为瞬间动作,返回true;
        // 若为持续动作,该函数会每帧被调用,直到返回true
        public override bool Logic()
        {
            //TODO: 获取到世界边界参数,才能做clamp操作
            Pathea.PeEntity entity = PeScenarioUtility.GetEntity(obj);
            if (entity != null && entity.peTrans != null)
            {
                if (pos != Vector3.zero)
                {
                    if (func_pos == EFunc.Plus || func_pos == EFunc.Minus)
                    {
                        entity.peTrans.position = LocalToWorld(entity.peTrans, pos, func_pos);
                    }
                    else
                    {
                        entity.peTrans.position = LocalToWorld(entity.peTrans, pos, EFunc.SetTo);
                    }
                }

                if (rot != Vector3.zero)
                {
                    Quaternion q = Quaternion.identity;
                    q.eulerAngles           = Calculate(entity.peTrans.rotation.eulerAngles, rot, func_rot);
                    entity.peTrans.rotation = q;
                }
            }
            return(true);
        }
        // 判断条件
        public override bool?Check()
        {
            Transform trans = PeScenarioUtility.GetObjectTransform(obj);

            if (trans == null)
            {
                return(range.type == DIRRANGE.DIRRANGETYPE.Anydirection);
            }

            switch (axis)
            {
            case EAxis.Left: return(range.Contains(-trans.right));

            case EAxis.Right: return(range.Contains(trans.right));

            case EAxis.Down: return(range.Contains(-trans.up));

            case EAxis.Up: return(range.Contains(trans.up));

            case EAxis.Backward: return(range.Contains(-trans.forward));

            case EAxis.Forward: return(range.Contains(trans.forward));
            }
            return(false);
        }
        // 执行动作
        // 若为瞬间动作,返回true;
        // 若为持续动作,该函数会每帧被调用,直到返回true
        public override bool Logic()
        {
            if (Pathea.PeGameMgr.IsMulti)
            {
                byte[] data = PETools.Serialize.Export(w =>
                {
                    BufferHelper.Serialize(w, obj);
                });

                PlayerNetwork.RequestServer(EPacketType.PT_Custom_CancelOrder, data);
            }
            else
            {
                Pathea.PeEntity entity = PeScenarioUtility.GetEntity(obj);
                if (entity != null && entity.requestCmpt != null)
                {
                    if (entity.requestCmpt.Contains(Pathea.EReqType.Dialogue))
                    {
                        entity.requestCmpt.RemoveRequest(Pathea.EReqType.Dialogue);
                    }
                    if (entity.requestCmpt.Contains(Pathea.EReqType.MoveToPoint))
                    {
                        entity.requestCmpt.RemoveRequest(Pathea.EReqType.MoveToPoint);
                    }
                    if (entity.requestCmpt.Contains(Pathea.EReqType.FollowTarget))
                    {
                        entity.requestCmpt.RemoveRequest(Pathea.EReqType.FollowTarget);
                    }
                }
            }

            return(true);
        }
        // 判断条件
        public override bool?Check()
        {
            if (Pathea.PeGameMgr.IsSingle)
            {
                Transform trans1 = PeScenarioUtility.GetObjectTransform(obj1);
                Transform trans2 = PeScenarioUtility.GetObjectTransform(obj2);
                if (trans1 == null || trans2 == null)
                {
                    return(false);
                }
                float d = Vector3.Distance(trans1.position, trans2.position);
                return(Utility.Compare(d, dist, comp));
            }
            else if (Pathea.PeGameMgr.IsMulti)
            {
                bool?result = ReqCheck();
                if (result != null)
                {
                    Debug.Log("Distance 3D result = " + result);
                }
                return(result);
            }

            return(false);
        }
示例#9
0
 void OnNetResponse(int scenarioId)
 {
     if (PeScenarioUtility.IsObjectContainEntity(obj, scenarioId))
     {
         Post();
     }
 }
示例#10
0
 void OnNetResponse(int scenarioId, int casterScenarioId, float value)
 {
     if (PeScenarioUtility.IsObjectContainEntity(obj, scenarioId) &&
         PeScenarioUtility.IsObjectContainEntity(atk, casterScenarioId))
     {
         Post();
     }
 }
示例#11
0
 // 判断条件
 public override bool?Check()
 {
     Pathea.PeEntity entity = PeScenarioUtility.GetEntity(player);
     if (entity != null && Pathea.CustomGameData.Mgr.Instance.curGameData.WorldIndex == worldId)
     {
         return(true);
     }
     return(false);
 }
        // 判断条件
        public override bool?Check()
        {
            Transform trans = PeScenarioUtility.GetObjectTransform(obj);

            if (trans == null)
            {
                return(range.type == RANGE.RANGETYPE.Anywhere);
            }

            return(range.Contains(trans.position));
        }
示例#13
0
 void OnResponse(SkillSystem.SkEntity sk)
 {
     Pathea.PeEntity entity = sk.GetComponent <Pathea.PeEntity>();
     if (entity == null)
     {
         return;
     }
     if (PeScenarioUtility.IsObjectContainEntity(obj, entity))
     {
         Post();
     }
 }
示例#14
0
 // 判断条件
 public override bool?Check()
 {
     if (player.type == OBJECT.OBJECTTYPE.Player)
     {
         Pathea.PeEntity entity = PeScenarioUtility.GetEntity(player);
         if (entity != null && entity.motionEquipment != null)
         {
             return((entity.motionEquipment.Weapon != null) == state);
         }
     }
     return(!state);
 }
示例#15
0
        // 执行动作
        // 若为瞬间动作,返回true;
        // 若为持续动作,该函数会每帧被调用,直到返回true
        public override bool Logic()
        {
            if (Pathea.PeGameMgr.IsMulti)
            {
                byte[] data = PETools.Serialize.Export(w =>
                {
                    BufferHelper.Serialize(w, player);
                    BufferHelper.Serialize(w, item);
                    w.Write(count);
                    w.Write((byte)func);
                });

                PlayerNetwork.RequestServer(EPacketType.PT_Custom_ModifyPackage, data);
            }
            else
            {
                if (player.type == OBJECT.OBJECTTYPE.Player && item.type == OBJECT.OBJECTTYPE.ItemProto && item.isSpecificPrototype)
                {
                    Pathea.PeEntity entity = PeScenarioUtility.GetEntity(player);
                    if (entity != null && entity.packageCmpt != null)
                    {
                        int num    = entity.packageCmpt.GetItemCount(item.Id);
                        int result = Utility.Function(num, count, func);
                        if (result > 0)
                        {
                            entity.packageCmpt.Set(item.Id, result);
                        }
                        else
                        {
                            entity.packageCmpt.Destory(item.Id, num);
                            if (result < 0)
                            {
                                Debug.LogWarning(string.Format("Items whose protoID is {0} are not enough.", item.Id));
                            }
                        }

                        if (result - num > 0)
                        {
                            ItemAsset.ItemProto proto = ItemAsset.ItemProto.Mgr.Instance.Get(item.Id);
                            if (proto == null)
                            {
                                return(true);
                            }

                            string msg = proto.GetName() + " X " + (result - num).ToString();
                            new PeTipMsg(msg, proto.icon[0], PeTipMsg.EMsgLevel.Norm, PeTipMsg.EMsgType.Misc);
                        }
                    }
                }
            }
            return(true);
        }
示例#16
0
        // 判断条件
        public override bool?Check()
        {
            PeEntity entity = PeScenarioUtility.GetEntity(obj);

            if (entity != null && entity.skEntity != null)
            {
                if (Utility.Compare(entity.skEntity.GetAttribute((int)stat), amt, comp))
                {
                    return(true);
                }
            }
            return(false);
        }
 // 判断条件
 public override bool?Check()
 {
     if (player.type == OBJECT.OBJECTTYPE.Player)
     {
         Pathea.PeEntity entity = PeScenarioUtility.GetEntity(player);
         if (entity != null && entity.motionMgr != null)
         {
             if (entity.motionMgr.IsActionRunning(Pathea.PEActionType.Sleep) == state)
             {
                 return(true);
             }
         }
     }
     return(false);
 }
示例#18
0
        // 在此初始化参数
        protected override void OnCreate()
        {
            missionId = Utility.ToEnumInt(parameters["mission"]);
            player    = Utility.ToObject(parameters["player"]);

            if (PeCustomScene.Self != null &&
                PeCustomScene.Self.scenario != null)
            {
                int curr_player = PeCustomScene.Self.scenario.playerId;
                owner = PeScenarioUtility.OwnerCheck(curr_player, curr_player, player);
            }
            else
            {
                owner = false;
            }
        }
示例#19
0
        // 执行动作
        // 若为瞬间动作,返回true;
        // 若为持续动作,该函数会每帧被调用,直到返回true
        public override bool Logic()
        {
            if (Pathea.PeGameMgr.IsMulti)
            {
                byte[] data = PETools.Serialize.Export(w =>
                {
                    BufferHelper.Serialize(w, obj);
                    BufferHelper.Serialize(w, range);
                });

                PlayerNetwork.RequestServer(EPacketType.PT_Custom_Kill, data);
            }
            else
            {
                if (obj.isPrototype)
                {
                    if (obj.type == OBJECT.OBJECTTYPE.MonsterProto)
                    {
                        foreach (var item in Pathea.EntityMgr.Instance.All)
                        {
                            if (item.commonCmpt.entityProto.proto != Pathea.EEntityProto.Monster)
                            {
                                continue;
                            }
                            if (!PeScenarioUtility.IsObjectContainEntity(obj, item))
                            {
                                continue;
                            }
                            if (!range.Contains(item.position))
                            {
                                continue;
                            }
                            item.SetAttribute(Pathea.AttribType.Hp, 0, false);
                        }
                    }
                }
                else
                {
                    Pathea.PeEntity entity = PeScenarioUtility.GetEntity(obj);
                    if (null != entity && range.Contains(entity.position))
                    {
                        entity.SetAttribute(Pathea.AttribType.Hp, 0, false);
                    }
                }
            }
            return(true);
        }
示例#20
0
 // 判断条件
 public override bool?Check()
 {
     Pathea.PeEntity self     = PeScenarioUtility.GetEntity(obj1);
     Pathea.PeEntity attacker = PeScenarioUtility.GetEntity(obj2);
     if (self == null || attacker == null || attacker.target == null)
     {
         return(false);
     }
     if (attacker.target.HasHatred(self))
     {
         return(state);
     }
     else
     {
         return(!state);
     }
 }
示例#21
0
        // 执行动作
        // 若为瞬间动作,返回true;
        // 若为持续动作,该函数会每帧被调用,直到返回true
        public override bool Logic()
        {
            if (Pathea.PeGameMgr.IsMulti)
            {
                byte[] data = PETools.Serialize.Export(w => { BufferHelper.Serialize(w, spawn); });
                PlayerNetwork.RequestServer(EPacketType.PT_Custom_DisableSpawn, data);
            }
            else
            {
                if (!PeScenarioUtility.EnableSpawnPoint(spawn, false))
                {
                    Debug.LogWarning("Diable spawn point error");
                }
            }

            return(true);
        }
示例#22
0
 void OnResponse(SkillSystem.SkEntity self, SkillSystem.SkEntity caster, float value)
 {
     if (self == null || caster == null)
     {
         return;
     }
     Pathea.PeEntity selfEntity   = self.GetComponent <Pathea.PeEntity>();
     Pathea.PeEntity casterEntity = caster.GetComponent <Pathea.PeEntity>();
     if (selfEntity == null || casterEntity == null)
     {
         return;
     }
     if (PeScenarioUtility.IsObjectContainEntity(obj, selfEntity) &&
         PeScenarioUtility.IsObjectContainEntity(atk, casterEntity))
     {
         Post();
     }
 }
示例#23
0
        void OnResponse(object sender, EntityMgr.RMouseClickEntityEvent e)
        {
            if (e.entity == null)
            {
                return;
            }

            if (PeScenarioUtility.IsObjectContainEntity(obj, e.entity))
            {
                Post();
            }
            //if (obj.isAnyNpo && e.entity != null)
            //    Post();
            //else
            //{
            //    PeEntity entity = PeScenarioUtility.GetEntity(obj);
            //    if (entity == e.entity)
            //        Post();
            //}
        }
        // 执行动作
        // 若为瞬间动作,返回true;
        // 若为持续动作,该函数会每帧被调用,直到返回true
        public override bool Logic()
        {
            if (Pathea.PeGameMgr.IsMulti)
            {
                byte[] data = PETools.Serialize.Export(w =>
                {
                    BufferHelper.Serialize(w, obj);
                });

                PlayerNetwork.RequestServer(EPacketType.PT_Custom_RemoveSpecObject, data);
            }
            else
            {
                if (PeScenarioUtility.RemoveObject(obj))
                {
                    Debug.LogWarning("Remove Spec Object Error!");
                }
            }

            return(true);
        }
示例#25
0
 void OnDamage(SkillSystem.SkEntity self, SkillSystem.SkEntity caster, float value)
 {
     if (PeCreature.Instance != null && PeCreature.Instance.mainPlayer != null)
     {
         PeEntity p            = PeCreature.Instance.mainPlayer;
         PeEntity targetEntity = self.GetComponent <Pathea.PeEntity>();
         PeEntity casterEntity = caster.GetComponent <Pathea.PeEntity>();
         if (targetEntity == null || casterEntity != p)
         {
             return;
         }
         float hp = targetEntity.GetAttribute(AttribType.Hp);
         if (hp <= 0 && hp + value > 0)
         {
             if (PeScenarioUtility.IsObjectContainEntity(monster, targetEntity))
             {
                 _current++;
             }
         }
     }
 }
示例#26
0
        // 执行动作
        // 若为瞬间动作,返回true;
        // 若为持续动作,该函数会每帧被调用,直到返回true
        public override bool Logic()
        {
            if (Pathea.PeGameMgr.IsMulti)
            {
                byte[] data = PETools.Serialize.Export(w =>
                {
                    BufferHelper.Serialize(w, obj);
                    BufferHelper.Serialize(w, range);
                    w.Write(amt);
                });

                PlayerNetwork.RequestServer(EPacketType.PT_Custom_CreateObject, data);
            }
            else
            {
                if (!PeScenarioUtility.CreateObjects(amt, obj, range))
                {
                    Debug.LogWarning("Create objects faild!");
                }
            }
            return(true);
        }
示例#27
0
        // 执行动作
        // 若为瞬间动作,返回true;
        // 若为持续动作,该函数会每帧被调用,直到返回true
        public override bool Logic()
        {
            if (Pathea.PeGameMgr.IsMulti)
            {
                byte[] data = PETools.Serialize.Export(w =>
                {
                    BufferHelper.Serialize(w, obj);
                    w.Write(name);
                });

                PlayerNetwork.RequestServer(EPacketType.PT_Custom_StartAnimation, data);
            }
            else
            {
                Pathea.PeEntity entity = PeScenarioUtility.GetEntity(obj);
                if (null == entity)
                {
                    return(true);
                }

                if (obj.isCurrentPlayer)
                {
                    playerAniming = true;
                    entity.animCmpt.AnimEvtString += OnAnimString;
                }

                string type = name.Split('_')[name.Split('_').Length - 1];
                if (type == "Once")
                {
                    entity.animCmpt.SetTrigger(name);
                }
                else if (type == "Muti")
                {
                    entity.animCmpt.SetBool(name, true);
                }
            }

            return(true);
        }
 // 执行动作
 // 若为瞬间动作,返回true;
 // 若为持续动作,该函数会每帧被调用,直到返回true
 public override bool Logic()
 {
     Pathea.PeEntity entity = PeScenarioUtility.GetEntity(obj);
     if (entity != null)
     {
         if ((entity.proto == Pathea.EEntityProto.Npc ||
              entity.proto == Pathea.EEntityProto.RandomNpc ||
              entity.proto == Pathea.EEntityProto.Monster) &&
             entity.requestCmpt != null)
         {
             if (cmd == ECommand.MoveTo)
             {
                 entity.requestCmpt.Register(Pathea.EReqType.MoveToPoint, LocalToWorld(entity.peTrans, pos, func), 1f, true, Pathea.SpeedState.Run);
             }
             else if (cmd == ECommand.FaceAt)
             {
                 entity.requestCmpt.Register(Pathea.EReqType.Dialogue, "", LocalToWorld(entity.peTrans, pos, func));
             }
         }
     }
     return(true);
 }
        // 执行动作
        // 若为瞬间动作,返回true;
        // 若为持续动作,该函数会每帧被调用,直到返回true
        public override bool Logic()
        {
            if (Pathea.PeGameMgr.IsMulti)
            {
                byte[] data = PETools.Serialize.Export(w =>
                {
                    BufferHelper.Serialize(w, obj);
                    BufferHelper.Serialize(w, tar);
                    w.Write((byte)cmd);
                });

                PlayerNetwork.RequestServer(EPacketType.PT_Custom_OrderTarget, data);
            }
            else
            {
                Pathea.PeEntity entity = PeScenarioUtility.GetEntity(obj);
                Pathea.PeEntity target = PeScenarioUtility.GetEntity(tar);
                if (entity != null && target != null)
                {
                    if ((entity.proto == Pathea.EEntityProto.Npc ||
                         entity.proto == Pathea.EEntityProto.RandomNpc ||
                         entity.proto == Pathea.EEntityProto.Monster) &&
                        entity.requestCmpt != null)
                    {
                        if (cmd == ECommand.MoveTo)
                        {
                            entity.requestCmpt.Register(Pathea.EReqType.FollowTarget, target.Id);
                        }
                        else if (cmd == ECommand.FaceAt)
                        {
                            entity.requestCmpt.Register(Pathea.EReqType.Dialogue, "", target.peTrans);
                        }
                    }
                }
            }

            return(true);
        }
示例#30
0
        // 执行动作
        // 若为瞬间动作,返回true;
        // 若为持续动作,该函数会每帧被调用,直到返回true
        public override bool Logic()
        {
            if (Pathea.PeGameMgr.IsMulti)
            {
                byte[] data = PETools.Serialize.Export(w =>
                {
                    BufferHelper.Serialize(w, obj);
                });

                PlayerNetwork.RequestServer(EPacketType.PT_Custom_StopAnimation, data);
            }
            else
            {
                Pathea.PeEntity entity = PeScenarioUtility.GetEntity(obj);
                if (null == entity)
                {
                    return(true);
                }
                //TODO:把ParametersBool设置为false(等待动作表)
                entity.animCmpt.SetTrigger("Custom_ResetAni");
            }

            return(true);
        }