Beispiel #1
0
    public void EndPattenSkill(uint slot)
    {
        if (PattenList.Count <= 0)
        {
            return;
        }

        if (parent.SkillCtlr.SkillList.Length <= slot || parent.SkillCtlr.SkillList[slot] == null)
        {
            return;
        }

        uint skillIdx = parent.SkillCtlr.SkillList[slot].GetSkillIndex();

        for (int i = 0; i < PattenList.Count; i++)
        {
            PattenData data = PattenList[i];
            if (data.AcType != ActionType.Skill)
            {
                continue;
            }

            if (data.ActionValue != skillIdx)
            {
                continue;
            }

            data.PattenInit();
            Debug.Log("<color=yellow>end patten init skill id </color>" + data.ActionValue);
            break;
        }
    }
Beispiel #2
0
    //public Dictionary<uint, Transform> PattenPosDic = new Dictionary<uint, Transform>();//보류 조건

    // Use this for initialization
    void Start()
    {
        parent = GetComponent <Npc>();

        Mob.MobInfo           monInfo    = _LowDataMgr.instance.GetMonsterInfo(parent.NpcLowID);
        List <Mob.PattenInfo> pattenList = _LowDataMgr.instance.GetLowDataPattenList(monInfo.Pattenid);

        List <uint> skillList = new List <uint>();

        for (int i = 0; i < pattenList.Count; i++)
        {
            Mob.PattenInfo pattenInfo = pattenList[i];
            PattenData     data       = new PattenData(pattenInfo.Typerank, pattenInfo.MainType, pattenInfo.SubType, pattenInfo.TypeValue, pattenInfo.ActionType, pattenInfo.Actionvalue);
            if (data.AcType == ActionType.Skill)
            {
                skillList.Add(pattenInfo.Actionvalue);
                //data.SkillData.Init()
            }
            //else if(data.AcType == ActionType.MovePoint)//보류 조건
            //{
            //    GameObject go = GameObject.Find(string.Format("BossPattenPos_{0}", data.ActionValue));
            //    if (go == null)
            //    {
            //        Debug.LogError(string.Format("not found BossPattenPos_{0} error", data.ActionValue));
            //        continue;
            //    }

            //    PattenPosDic.Add(data.ActionValue, go.transform);
            //}

            PattenList.Add(data);
        }

        //SkillCtlr.InitBossRaidSkill(parent, skillList.ToArray() );
        if (0 < skillList.Count)
        {
            parent.SkillCtlr.AddRaidSkill(skillList.ToArray());
        }
    }
Beispiel #3
0
    public virtual bool PattenUpdate()
    {
        bool isPatten = false;
        int  count    = PattenList.Count;

        for (int i = 0; i < count; i++)
        {
            bool       isAction = false;
            PattenData data     = PattenList[i];
            float      value    = data.PattenValue;

            switch (data.PaType)
            {
            case PattenType.TimeLater:     //소환된 후 시간
                value = value * 0.01f;     //100 == 1
                if (value <= data.RunTime) //발동 조건
                {
                    isAction = true;
                }

                break;

            case PattenType.MyHp:     //현재 체력
            {
                value = value * 0.1f; //10 == 1
                float con = parent.CharInfo.Hp / parent.CharInfo.MaxHp;
                if (data.ConType == ConditionType.Over)
                {
                    if (value <= con)        //발동 조건
                    {
                        isAction = true;
                    }
                }
                else if (data.ConType == ConditionType.Under)
                {
                    if (con < value)        //발동 조건
                    {
                        isAction = true;
                    }
                }
            }
            break;

            case PattenType.EnemyTotalHp:    //적의 총 체력 평균
            {
                int totalHp = 0, totalMaxHp = 0;
                int playerCount = NetData.instance._playerSyncData.playerSyncDatas.Count;
                for (int j = 0; j < playerCount; j++)
                {
                    PlayerUnitData unitData = NetData.instance._playerSyncData.playerSyncDatas[j];
                    Unit           unit     = G_GameInfo.CharacterMgr.FindRoomUnit(unitData._AccountUUID);
                    totalHp    += unit.CharInfo.Hp;
                    totalMaxHp += unit.CharInfo.MaxHp;
                }

                int parCount = NetData.instance._playerSyncData.partnerSyncDatas.Count;
                for (int j = 0; j < parCount; j++)
                {
                    PlayerUnitData parData = NetData.instance._playerSyncData.partnerSyncDatas[i];
                    Unit           unit    = G_GameInfo.CharacterMgr.FindRoomUnit(parData._AccountUUID);
                    totalHp    += unit.CharInfo.Hp;
                    totalMaxHp += unit.CharInfo.MaxHp;
                }

                value = value * 0.1f;        //10 == 1
                float con = totalHp / totalMaxHp;
                if (data.ConType == ConditionType.Over)
                {
                    if (value <= con)        //발동 조건
                    {
                        isAction = true;
                    }
                }
                else if (data.ConType == ConditionType.Under)
                {
                    if (con < value)        //발동 조건
                    {
                        isAction = true;
                    }
                }
            }
            break;

            case PattenType.LifeCount:    //팀의 살아있는 수 <- 몬스터
            {
                int teamLiveCount = 0;

                int teamCount = NetData.instance._playerSyncData.playerSyncDatas.Count;
                for (int j = 0; j < teamCount; j++)
                {
                    PlayerUnitData teamData = NetData.instance._playerSyncData.playerSyncDatas[i];
                    if (teamData._TeamID == parent.TeamID)           //같은편
                    {
                        Unit unit = G_GameInfo.CharacterMgr.FindRoomUnit(teamData._AccountUUID);
                        if (!unit.IsDie)         //살아있따
                        {
                            teamLiveCount++;
                        }
                    }
                }
                int parCount = NetData.instance._playerSyncData.partnerSyncDatas.Count;
                for (int j = 0; j < parCount; j++)
                {
                    PlayerUnitData parData = NetData.instance._playerSyncData.partnerSyncDatas[i];
                    if (parData._TeamID == parent.TeamID)            //같은편
                    {
                        Unit unit = G_GameInfo.CharacterMgr.FindRoomUnit(parData._AccountUUID);
                        if (!unit.IsDie)         //살아있따
                        {
                            teamLiveCount++;
                        }
                    }
                }

                if (data.ConType == ConditionType.Over)
                {
                    if (value <= teamLiveCount)        //발동 조건
                    {
                        isAction = true;
                    }
                }
                else if (data.ConType == ConditionType.Under)
                {
                    if (teamLiveCount < value)        //발동 조건
                    {
                        isAction = true;
                    }
                }
            }

            break;

            case PattenType.EnemyLifeCount:    //적의 살아있는 수
            {
                int liveCount   = 0;
                int playerCount = NetData.instance._playerSyncData.playerSyncDatas.Count;
                for (int j = 0; j < playerCount; j++)
                {
                    PlayerUnitData unitData = NetData.instance._playerSyncData.playerSyncDatas[j];
                    Unit           unit     = G_GameInfo.CharacterMgr.FindRoomUnit(unitData._AccountUUID);
                    if (!unit.IsDie)            //살았다
                    {
                        liveCount++;
                    }
                }

                int parCount = NetData.instance._playerSyncData.partnerSyncDatas.Count;
                for (int j = 0; j < parCount; j++)
                {
                    PlayerUnitData parData = NetData.instance._playerSyncData.partnerSyncDatas[i];
                    Unit           unit    = G_GameInfo.CharacterMgr.FindRoomUnit(parData._AccountUUID);
                    if (!unit.IsDie)            //살았다
                    {
                        liveCount++;
                    }
                }

                if (data.ConType == ConditionType.Over)
                {
                    if (value <= liveCount)        //발동 조건
                    {
                        isAction = true;
                    }
                }
                else if (data.ConType == ConditionType.Under)
                {
                    if (liveCount < value)        //발동 조건
                    {
                        isAction = true;
                    }
                }
            }
            break;

            case PattenType.EnemyDeadCount:    //적의 죽어있는 수
            {
                int deadCount   = 0;
                int playerCount = NetData.instance._playerSyncData.playerSyncDatas.Count;
                for (int j = 0; j < playerCount; j++)
                {
                    PlayerUnitData unitData = NetData.instance._playerSyncData.playerSyncDatas[j];
                    Unit           unit     = G_GameInfo.CharacterMgr.FindRoomUnit(unitData._AccountUUID);
                    if (unit.IsDie)            //죽었다
                    {
                        deadCount++;
                    }
                }

                int parCount = NetData.instance._playerSyncData.partnerSyncDatas.Count;
                for (int j = 0; j < parCount; j++)
                {
                    PlayerUnitData parData = NetData.instance._playerSyncData.partnerSyncDatas[i];
                    Unit           unit    = G_GameInfo.CharacterMgr.FindRoomUnit(parData._AccountUUID);
                    if (unit.IsDie)            //죽었다
                    {
                        deadCount++;
                    }
                }

                if (data.ConType == ConditionType.Over)
                {
                    if (value <= deadCount)        //발동 조건
                    {
                        isAction = true;
                    }
                }
                else if (data.ConType == ConditionType.Under)
                {
                    if (deadCount < value)        //발동 조건
                    {
                        isAction = true;
                    }
                }
            }
            break;

            case PattenType.DeadCount:    //팀의 죽어있는 수 <- 몬스터
            {
                int teamDeadCount = 0;

                int teamCount = NetData.instance._playerSyncData.playerSyncDatas.Count;
                for (int j = 0; j < teamCount; j++)
                {
                    PlayerUnitData teamData = NetData.instance._playerSyncData.playerSyncDatas[i];
                    if (teamData._TeamID == parent.TeamID)           //같은편
                    {
                        Unit unit = G_GameInfo.CharacterMgr.FindRoomUnit(teamData._AccountUUID);
                        if (unit.IsDie)          //죽었다
                        {
                            teamDeadCount++;
                        }
                    }
                }
                int parCount = NetData.instance._playerSyncData.partnerSyncDatas.Count;
                for (int j = 0; j < parCount; j++)
                {
                    PlayerUnitData parData = NetData.instance._playerSyncData.partnerSyncDatas[i];
                    if (parData._TeamID == parent.TeamID)            //같은편
                    {
                        Unit unit = G_GameInfo.CharacterMgr.FindRoomUnit(parData._AccountUUID);
                        if (unit.IsDie)         //죽었다
                        {
                            teamDeadCount++;
                        }
                    }
                }

                if (data.ConType == ConditionType.Over)
                {
                    if (value <= teamDeadCount)        //발동 조건
                    {
                        isAction = true;
                    }
                }
                else if (data.ConType == ConditionType.Under)
                {
                    if (teamDeadCount < value)        //발동 조건
                    {
                        isAction = true;
                    }
                }
            }

            break;
            }

            if (!isAction)//발동 조건 미흡
            {
                continue;
            }

            switch (data.AcType)
            {
            //case ActionType.MovePoint ://보류 조건
            //Transform movePos = null;
            //if(PattenPosDic.TryGetValue(data.ActionValue, out movePos))
            //{
            //    isPatten = parent.MovePosition(movePos.position);
            //    if (isPatten)
            //        Debug.Log("<color=yellow>Patten success skill id </color>" + data.ActionValue);
            //}

            //break;

            case ActionType.Skill:
                for (int j = 0; j < parent.SkillCtlr.SkillList.Length; j++)
                {
                    Skill sk = parent.SkillCtlr.SkillList[j];
                    if (sk == null || !sk.IsPatten || sk.GetSkillIndex() != data.ActionValue)
                    {
                        continue;
                    }

                    isPatten = parent.UseSkill(j);
                    if (isPatten)
                    {
                        Debug.Log("<color=yellow>Patten success skill id </color>" + data.ActionValue);
                    }
                    break;
                }

                //isPatten = UseSkill(data.ActionValue);
                break;

            case ActionType.Spawn:
                isPatten = G_GameInfo.GameInfo.spawnCtlr.MenualSpawnGroup((int)data.ActionValue);
                if (isPatten)
                {
                    Debug.Log("<color=yellow>Patten success Spawn Group id </color>" + data.ActionValue);
                    PattenList.Remove(data);    //소환 성공했으니 해당 데이터 더 이상 사용하지 않는다. 추후에는 변경될지도 모름.
                }
                break;
            }

            if (isPatten)
            {
                break;
            }
        }

        return(isPatten);
    }