public override void ActionTrigger()
    {
        base.ActionTrigger();
        if (!torchLightState)
        {
            //触发机关
            torchLightState = true;
            if (targetObj)
            {
                targetObj.SetActive(true);
            }
            //保存状态
            SaveDataAction(true);
            //设置任务状态
            INowTaskState iNowTaskState = GameState.Instance.GetEntity <INowTaskState>();
            switch (torchIndex)
            {
            case 1:
                iNowTaskState.CheckNowTask(EnumCheckTaskType.Special, (int)TaskMap.Enums.EnumTaskSpecialCheck.DXMG_TorchLight1);
                break;

            case 2:
                iNowTaskState.CheckNowTask(EnumCheckTaskType.Special, (int)TaskMap.Enums.EnumTaskSpecialCheck.DXMG_TorchLight2);
                break;

            case 3:
                iNowTaskState.CheckNowTask(EnumCheckTaskType.Special, (int)TaskMap.Enums.EnumTaskSpecialCheck.DXMG_TorchLight3);
                break;

            case 4:
                iNowTaskState.CheckNowTask(EnumCheckTaskType.Special, (int)TaskMap.Enums.EnumTaskSpecialCheck.DXMG_TorchLight4);
                break;
            }
        }
    }
Esempio n. 2
0
    /// <summary>
    /// 等待一定时间销毁
    /// </summary>
    /// <returns></returns>
    IEnumerator DestoryThis()
    {
        //关闭自身的碰撞体
        Collider[] colliders = GetComponents <Collider>();
        foreach (Collider collider in colliders)
        {
            if (collider != null)
            {
                GameObject.Destroy(collider);
            }
        }
        yield return(null);

        //取消注册(其实也可以不用管)
        if (monsterDataInfo != null && monsterDataInfo.MonsterBaseAttribute != null)
        {
            thisAttribute.UnRegistor <IAttributeState>(IAttribute_Changed);
        }
        //通知杀死了某种怪物
        INowTaskState iNowTaskState = GameState.Instance.GetEntity <INowTaskState>();

        if (iNowTaskState != null && monsterDataInfo != null)
        {
            iNowTaskState.CheckNowTask(EnumCheckTaskType.Monster, (int)monsterDataInfo.MonsterType);
        }
        //移除组件
        NavMeshAgent navMeshAgent = gameObject.GetComponent <NavMeshAgent>();

        if (navMeshAgent != null)
        {
            GameObject.Destroy(navMeshAgent);
        }
        Rigidbody rigibody = GetComponent <Rigidbody>();

        if (rigibody != null)
        {
            GameObject.Destroy(rigibody);
        }
        if (monsterDataInfo != null)
        {
            yield return(new WaitForSeconds(monsterDataInfo.DeathAnimTime));
        }
        else
        {
            yield return(new WaitForSeconds(3));
        }
        float animatorTime    = 0;
        float maxAnimatorTime = monsterDataInfo != null ? monsterDataInfo.DeathAnimTime : 3;

        while (animatorTime < maxAnimatorTime)
        {
            animatorTime += Time.deltaTime;
            gameObject.transform.position -= Vector3.up * Time.deltaTime * 0.5f;
            yield return(null);
        }
        GameObject.Destroy(gameObject);
    }
Esempio n. 3
0
    /// <summary>
    /// 点击NPC处理任务相关
    /// </summary>
    ///<returns>是否有任务需要处理</returns>
    private bool ClickNPC_Task()
    {
        INowTaskState iNowTaskState = GameState.Instance.GetEntity <INowTaskState>();
        //先判断是否完成了任务
        bool checkNPCTaskResult = iNowTaskState.CheckNowTask(EnumCheckTaskType.NPC, _ClickInteractiveNPCID);

        if (checkNPCTaskResult)//如果任务完成了则不用后面的检测了
        {
            return(false);
        }
        //如果任务没有完成则需要后面的检测
        //接取任务的npcid与点击npcid相同并且存在的任务没有被完成也没有被接取
        TaskMap.RunTimeTaskInfo[] runTimeTaskInfos = runtimeTaskData.GetAllToDoList()
                                                     .Where(temp => temp.TaskInfoStruct.ReceiveTaskNpcId == _ClickInteractiveNPCID && temp.IsOver == false && temp.IsStart == false)
                                                     .ToArray();
        //存在主线任务则展开主线(主线任务在这里直接开始)
        if (runTimeTaskInfos.Where(temp => temp.TaskInfoStruct.TaskType == TaskMap.Enums.EnumTaskType.Main).Count() > 0)
        {
            //INowTaskState iNowTaskState = GameState.Instance.GetEntity<INowTaskState>();
            iNowTaskState.StartTask = runTimeTaskInfos.Where(temp => temp.TaskInfoStruct.TaskType == TaskMap.Enums.EnumTaskType.Main).First().ID;
            return(true);
        }
        //如果存在支线则展开支线(支线任务存在选择项,在UI处开始)
        if (runTimeTaskInfos.Where(temp => temp.TaskInfoStruct.TaskType == TaskMap.Enums.EnumTaskType.Spur).Count() > 0)
        {
            if (QueryObj != null)
            {
                QueryObj.SetActive(true);
            }
            return(true);
        }
        //如果存在重复任务则展开重复任务(重复任务存在选择项,在UI处开始)
        if (runTimeTaskInfos.Where(temp => temp.TaskInfoStruct.TaskType == TaskMap.Enums.EnumTaskType.Repeat).Count() > 0)
        {
            if (QueryObj != null)
            {
                QueryObj.SetActive(true);
            }
            return(true);
        }
        //如果不存在任何任务则在人物头顶显示文字
        if (TalkShowObj != null)
        {
            try
            {
                TalkShowObj.SendMessage("ClickInteractiveNPCID");
            }
            catch
            {
                Debug.Log("显示人物对话的面板没有ClickInteractiveNPCID函数用来接收消息");
            }
        }
        return(false);
    }
    private void OnEnable()
    {
        playerState = DataCenter.Instance.GetEntity <PlayerState>();
        entryData   = DataCenter.Instance.GetMetaData <EntryData>();
        UIManager.Instance.KeyUpHandle    += Instance_KeyUpHandle;
        UIManager.Instance.KeyPressHandle += Instance_KeyPressHandle;
        INowTaskState iNowTaskState = GameState.Instance.GetEntity <INowTaskState>();

        iNowTaskState.CheckNowTask(EnumCheckTaskType.Special, (int)TaskMap.Enums.EnumTaskSpecialCheck.OpenEntryUI);
        InitShow();
    }
Esempio n. 5
0
    private void OnEnable()
    {
        UIManager.Instance.KeyUpHandle += Instance_KeyUpHandle;
        if (uiFocusPath)
        {
            nowUIFocus = uiFocusPath.GetFirstFocus();
            if (nowUIFocus)
            {
                nowUIFocus.SetForcus();
            }
        }
        //给任务系统填入状态
        INowTaskState iNowTaskState = GameState.Instance.GetEntity <INowTaskState>();

        iNowTaskState.CheckNowTask(EnumCheckTaskType.Special, (int)TaskMap.Enums.EnumTaskSpecialCheck.OpenItemUI);
    }
Esempio n. 6
0
    private void OnEnable()
    {
        isSaving   = false;
        iGameState = GameState.Instance.GetEntity <IGameState>();
        //压入状态
        iGameState.PushEnumGameRunType(EnumGameRunType.Setting);
        UIManager.Instance.KeyUpHandle += Instance_KeyUpHandle;
        if (uiFocusPath)
        {
            nowTabPageFocus = uiFocusPath.GetFirstFocus() as UIFocusTabPage;
            if (nowTabPageFocus)
            {
                nowTabPageFocus.SetForcus();
                if (nowTabPageFocus.panel)
                {
                    nowTabPageFocus.panel.gameObject.SetActive(true);
                }
            }
        }
        //重新载入数据
        //检测此时是否有点击地图的ID(如果是则载入地图标签)
        IInteractiveState iInteractiveState = GameState.Instance.GetEntity <IInteractiveState>();
        NPCData           npcData           = DataCenter.Instance.GetMetaData <NPCData>();
        NPCDataInfo       npcDataInfo       = npcData.GetNPCDataInfo(iGameState.SceneName, iInteractiveState.ClickInteractiveNPCID);

        if (npcDataInfo != null && npcDataInfo.NPCType == EnumNPCType.Street)
        {
            UIFocusTabPage[] tabPages = uiFocusPath.NewUIFocusArray.OfType <UIFocusTabPage>().ToArray();
            var tempUIBigMaps         = Enumerable.Range(0, tabPages.Length).Select(temp => new { index = temp, uiBigMap = tabPages[temp].panel.GetComponent <UIBigMap>() }).Where(temp => temp.uiBigMap != null).FirstOrDefault();
            if (tempUIBigMaps != null)
            {
                ShowIndex(tempUIBigMaps.index);
            }
            else
            {
                ShowIndex(1);//第一个标签是地图则此处选取第二个标签(属性)
            }
        }
        else//如果不是则载入第一个标签
        {
            ShowIndex(0);
        }
        //给任务系统填入状态
        INowTaskState iNowTaskState = GameState.Instance.GetEntity <INowTaskState>();

        iNowTaskState.CheckNowTask(EnumCheckTaskType.Special, (int)TaskMap.Enums.EnumTaskSpecialCheck.OpenMenuUI);
    }
    private void OnEnable()
    {
        playerState          = DataCenter.Instance.GetEntity <PlayerState>();
        iPlayerState         = GameState.Instance.GetEntity <IPlayerState>();
        roleOfRaceExplanList = new List <KeyValuePair <RoleOfRace, string> >();
        FieldExplanAttribute.SetEnumExplanDic(roleOfRaceExplanList);
        GameState.Instance.Registor <IPlayerAttributeState>(IPlayerAttributeStateChanged);
        UpdateText();
        UIManager.Instance.KeyPressHandle += Instance_KeyPressHandle;
        UIManager.Instance.KeyUpHandle    += Instance_KeyUpHandle;
        scrollbar.value = 0;
        uiFocusPath     = GetComponent <UIFocusPath>();
        UIFocus[] uiFocusArray = uiFocusPath.NewUIFocusArray;
        foreach (UIFocus uiFocus in uiFocusArray)
        {
            uiFocus.SetForcus();
            uiFocus.LostForcus();
        }
        //给任务系统填入状态
        INowTaskState iNowTaskState = GameState.Instance.GetEntity <INowTaskState>();

        iNowTaskState.CheckNowTask(EnumCheckTaskType.Special, (int)TaskMap.Enums.EnumTaskSpecialCheck.OpenAttributeUI);
    }
Esempio n. 8
0
    /// <summary>
    /// 当隐藏时处理
    /// </summary>
    private void OnDisable()
    {
        UIManager.Instance.KeyUpHandle -= Instance_KeyUpHandle;
        if (nowKeySettingLattice)
        {
            nowKeySettingLattice.LostForcus();
        }
        //保存状态
        UIFocus[] uiKeySettingLatticeArray = keySettingFocusPath.UIFocuesArray;
        foreach (UIFocus item in uiKeySettingLatticeArray)
        {
            if (!item)
            {
                continue;
            }
            UIFocusKeySettingLattice uiKeySettingLattice = item as UIFocusKeySettingLattice;
            int inputKey = uiKeySettingLattice.GetKeySettingInput();//输入的按键值
            if (uiKeySettingLattice)
            {
                //KeyContactStruct[] keyContactStructs = keyContactData.GetKeyContactStruct(inputKey);
                KeyContactStruct newTarget = new KeyContactStruct();
                newTarget.id             = uiKeySettingLattice.id;
                newTarget.keyContactType = uiKeySettingLattice.keyLatticeType;
                //if (keyContactStructs.Length > 0)
                //{
                //    newTarget = keyContactStructs[0];
                //}
                //else
                //{
                //设置对象的名字
                switch (newTarget.keyContactType)
                {
                case EnumKeyContactType.None:
                    newTarget.name = "None";
                    break;

                case EnumKeyContactType.Skill:
                    EnumSkillType[] skillTypes = SkillCombineStaticTools.GetCombineSkills(newTarget.id);
                    newTarget.name = SkillCombineStaticTools.GetCombineSkillsName(skillTypes);
                    //如果是火球术
                    if (newTarget.id == SkillCombineStaticTools.GetCombineSkillKey(new EnumSkillType[] { EnumSkillType.FS01, EnumSkillType.YSX01 }))
                    {
                        //给任务系统填入状态
                        INowTaskState iNowTaskState = GameState.Instance.GetEntity <INowTaskState>();
                        iNowTaskState.CheckNowTask(EnumCheckTaskType.Special, (int)TaskMap.Enums.EnumTaskSpecialCheck.SetFireSkillToLattice);
                    }
                    break;

                case EnumKeyContactType.Prap:
                    PlayGoods playGoods = playerState.PlayerAllGoods.FirstOrDefault(temp => temp.ID == newTarget.id);
                    newTarget.name = playGoods.GoodsInfo.GoodsName;
                    break;

                case EnumKeyContactType.Action:
                    newTarget.name = "暂无功能";
                    break;
                }
                //}
                keyContactData.SetKeyContactStruct(inputKey, newTarget);
            }
        }
    }
Esempio n. 9
0
 /// <summary>
 /// 开始道具的功能
 /// 如果是装备则替换,如果是药水则恢复
 /// </summary>
 private void ItemAction()
 {
     if (focusUIListItem)
     {
         //物品对象
         PlayGoods     playGoods     = (PlayGoods)focusUIListItem.value;
         EnumGoodsType enumGoodsType = playGoods.GoodsInfo.EnumGoodsType;
         int           goodsTypeInt  = (int)enumGoodsType;
         if (GoodsStaticTools.IsChildGoodsNode(enumGoodsType, EnumGoodsType.Equipment))//如果是装备类型则替换装备
         {
             //如果是副手武器
             if (GoodsStaticTools.IsLeftOneHandedWeapon(enumGoodsType))
             {
                 //需要判断当前是否佩戴了双手武器以及副手武器(左手武器),如果佩戴了则需要卸载双手武器
                 PlayGoods[] twoHandedWeapons = playerState.PlayerAllGoods.Where(
                     temp => temp.GoodsLocation == GoodsLocation.Wearing &&
                     (GoodsStaticTools.IsTwoHandedWeapon(temp.GoodsInfo.EnumGoodsType) ||
                      (temp.leftRightArms != null && temp.leftRightArms.Value == false))).ToArray();
                 foreach (PlayGoods _playGoods in twoHandedWeapons)
                 {
                     _playGoods.leftRightArms = null;
                     _playGoods.GoodsLocation = GoodsLocation.Package;
                 }
                 playGoods.leftRightArms = false;
             }
             //如果是双手武器
             else if (GoodsStaticTools.IsTwoHandedWeapon(enumGoodsType))
             {
                 //需要判断当前是否佩戴了副手武器以及主手武器(右手武器),如果佩戴了则需要卸载副手武器
                 PlayGoods[] oneHandedWeapons = playerState.PlayerAllGoods.Where(
                     temp => temp.GoodsLocation == GoodsLocation.Wearing &&
                     (GoodsStaticTools.IsLeftOneHandedWeapon(temp.GoodsInfo.EnumGoodsType) ||
                      (temp.leftRightArms != null && temp.leftRightArms.Value == true))).ToArray();
                 foreach (PlayGoods _playGoods in oneHandedWeapons)
                 {
                     _playGoods.leftRightArms = null;
                     _playGoods.GoodsLocation = GoodsLocation.Package;
                 }
                 playGoods.leftRightArms = true;
             }
             //如果是饰品
             else if (GoodsStaticTools.IsChildGoodsNode(enumGoodsType, EnumGoodsType.Ornaments))
             {
                 EnumGoodsType?ornamentsType = GoodsStaticTools.GetParentGoodsType(playGoods.GoodsInfo.EnumGoodsType); //从基础的饰品类型向上跳到饰品的分类类型(项链 戒指 护身符 勋章)
                 if (ornamentsType != null && GoodsStaticTools.IsChildGoodsNode(ornamentsType.Value, EnumGoodsType.Ornaments))
                 {
                     PlayGoods[] ornaments = playerState.PlayerAllGoods.Where(
                         temp => temp.GoodsLocation == GoodsLocation.Wearing && GoodsStaticTools.IsChildGoodsNode(temp.GoodsInfo.EnumGoodsType, ornamentsType.Value)).ToArray();
                     foreach (PlayGoods _playGoods in ornaments)
                     {
                         _playGoods.GoodsLocation = GoodsLocation.Package;
                     }
                 }
             }
             //如果是武器(这里是单手武器,双手武器以及副手在上面已经判断过了 )
             else if (GoodsStaticTools.IsChildGoodsNode(enumGoodsType, EnumGoodsType.Arms))
             {
                 //需要卸载所有的右手装备
                 PlayGoods[] rightHandedWeapons = playerState.PlayerAllGoods.Where(
                     temp => temp.GoodsLocation == GoodsLocation.Wearing && temp.leftRightArms != null && temp.leftRightArms.Value == true).ToArray();
                 foreach (PlayGoods _playGoods in rightHandedWeapons)
                 {
                     _playGoods.leftRightArms = null;
                     _playGoods.GoodsLocation = GoodsLocation.Package;
                 }
                 playGoods.leftRightArms = true;
             }
             //如果是其他装备(防具等)
             else
             {
                 EnumGoodsType?armorType = GoodsStaticTools.GetParentGoodsType(playGoods.GoodsInfo.EnumGoodsType, 2); //从基础的防具类型向上跳到防具的大类(头盔大类 盔甲类 鞋子类)
                 if (armorType != null && GoodsStaticTools.IsChildGoodsNode(armorType.Value, EnumGoodsType.Equipment))
                 {
                     PlayGoods[] ammors = playerState.PlayerAllGoods.Where(
                         temp => temp.GoodsLocation == GoodsLocation.Wearing && GoodsStaticTools.IsChildGoodsNode(temp.GoodsInfo.EnumGoodsType, armorType.Value)).ToArray();
                     foreach (PlayGoods _playGoods in ammors)
                     {
                         _playGoods.GoodsLocation = GoodsLocation.Package;
                     }
                 }
             }
             playGoods.GoodsLocation          = GoodsLocation.Wearing;
             iPlayerStateRun.EquipmentChanged = true;
         }
         else if (GoodsStaticTools.IsChildGoodsNode(enumGoodsType, EnumGoodsType.Elixir))//如果是炼金药剂类则直接服用
         {
             iPlayerStateRun.EatMedicine(playGoods.ID);
         }
         else if (GoodsStaticTools.IsChildGoodsNode(enumGoodsType, EnumGoodsType.Item)) //如果是道具
         {
             if (enumGoodsType == EnumGoodsType.MagicScroll)                            //此处的魔法卷轴有一个任务的特殊检测
             {
                 INowTaskState iNowTaskState = GameState.Instance.GetEntity <INowTaskState>();
                 iNowTaskState.CheckNowTask(EnumCheckTaskType.Special, (int)TaskMap.Enums.EnumTaskSpecialCheck.SummonsScrollMagic);
             }
             Debug.Log("道具功能暂未实现");
         }
     }
 }