Exemplo n.º 1
0
    protected override void UpdateState()
    {
        if (GetOwnerType() == 1)
        {
            ObjectHero obj = (ObjectHero)SceneObjectManager.GetInstance().GetSceneObjectByGameObject(this.gameObject);
            if (obj != null)
            {
                CurState = obj.GetActionState();
                if (obj.GetCurLockTarget() != null)
                {
                    CurLockTarget = obj.GetCurLockTarget().GetGameObject();
                }
                if (obj.GetSkillLockTarget() != null)
                {
                    CurLockSkillTarget = obj.GetSkillLockTarget().GetGameObject();
                }
            }
        }
        else
        {
            ObjectMonster obj = (ObjectMonster)SceneObjectManager.GetInstance().GetSceneObjectByGameObject(this.gameObject);
            if (obj != null)
            {
                CurState = obj.GetActionState();
            }
        }

        if (m_EventData != null && _anim[lastAnimatimName] != null)
        {
            m_EventData.OnUpdateEvent(_event, _anim[lastAnimatimName]);
        }
    }
Exemplo n.º 2
0
        private void AnalyseObjectMonster(ObjectMonster monster)
        {
            var _spellInfoArray = monster.Getm_SpellInfo();

            for (int i = 0; i < _spellInfoArray.Count; i++)
            {
                if (_spellInfoArray[i] != null && _spellInfoArray[i].GetSpellID() != -1)
                {
                    SpellInfo _tempInfo = _spellInfoArray[i];
                    for (int j = 0; j < _tempInfo.GetSpellRow().getNormalTemplate().Length; ++j)
                    {
                        if (monster.CheckSkillCondtion(_tempInfo))
                        {
                            SpellAILogic tempLogic = GenerateSubsetFromPool(_tempInfo.GetSpellRow().getNormalTemplate()[j],
                                                                            _tempInfo.GetSpellRow().getNormalpriority()[j],
                                                                            monster, _tempInfo, m_AITime);
                            if (tempLogic.IsAILogicReady() && tempLogic.GetPriority() >= m_MaxPriority)
                            {
                                m_MaxPriority = tempLogic.GetPriority();
                                m_SpellList.Add(new MonsterSpellLogicPackage(monster, tempLogic));
                            }
                        }
                    }
                }
            }
        }
Exemplo n.º 3
0
        private void onMonsterHurtCall(GameEvent e)
        {
            ObjectMonster monster = (ObjectMonster)e.data;

            if (monster != null)
            {
                UpdateBloodValue(monster.GUID, (float)monster.GetHP() / monster.GetMaxHP());
            }
        }
Exemplo n.º 4
0
        private void RefreshSpellList(List <ObjectMonster> monsterList)
        {
            ReturnData();

            for (int i = 0; i < monsterList.Count; ++i)
            {
                ObjectMonster _monster = monsterList[i];
                if (!_monster.IsSkillAttack() && _monster.IsAlive() && _monster.CheckSelfCanCastSkill())//判断该技能的硬性释放条件
                {
                    AnalyseObjectMonster(_monster);
                }
            }
        }
Exemplo n.º 5
0
        void onSupportMonstorBlood()
        {
            // 初始化敌人的血条
            List <ObjectMonster> monsters = SceneObjectManager.GetInstance().GetSceneMonsterList();

            if (monsters.Count > 0)
            {
                ObjectMonster monster = monsters[monsters.Count - 1];
                if (monster.IsAlive())
                {
                    mBloodControl.CreateBloodBar(monster);
                }
            }
        }
Exemplo n.º 6
0
    public void Anim_Attack()
    {
        ObjectCreature obj = SceneObjectManager.GetInstance().GetSceneObjectByGameObject(this.gameObject);

        if (obj is ObjectHero)
        {
            ObjectHero hero    = obj as ObjectHero;
            string[]   Actions = hero.GetSpellNormal().GetSpellRow().getAction();
            RandomAttack(Actions);
        }
        else
        {
            ObjectMonster monster = obj as ObjectMonster;
            string[]      Actions = monster.GetSpellNormal().GetSpellRow().getAction();
            RandomAttack(Actions);
        }
    }
        //######################################################被击动作接口####################################################
        //被击结束回调
        private void HurtEnd()
        {
            ObjectCreature pCaster = SceneObjectManager.GetInstance().GetSceneObjectByGameObject(this.gameObject);

            if (pCaster == null)
            {
                return;
            }

            switch (pCaster.GetActionState())
            {
            case ObjectCreature.ObjectActionState.Hurting:
            {
                if (pCaster.GetCacheLastActionState() == ObjectCreature.ObjectActionState.dizzy && pCaster.IsInFightState(EM_FIGHT_STATE.EM_FIGHT_STATE_VERTIGO))
                {
                    //重置回眩晕中 [10/19/2015 Zmy]
                    pCaster.SetObjectActionState(ObjectCreature.ObjectActionState.dizzy);
                }
                else
                {
                    pCaster.SetObjectActionState(ObjectCreature.ObjectActionState.normalAttack);
                }
            }
            break;

            case ObjectCreature.ObjectActionState.checkHurting:
            {
                //受击结束播放一次不带事件回调的待机动画,用于可以在checkHurting状态下可以再次播放受击动作 [9/28/2015 Zmy]
                if (pCaster is ObjectHero)
                {
                    ObjectHero obj = pCaster as ObjectHero;
                    obj.GetAnimation().Anim_Fidle(false);
                }
                else
                {
                    ObjectMonster obj = pCaster as ObjectMonster;
                    obj.GetAnimation().Anim_Fidle(false);
                }
            }
            break;

            default:
                break;
            }
        }
Exemplo n.º 8
0
        public UI_Blood CreateBloodBar(ObjectMonster monster)
        {
            Transform tans = monster.GetAnimation().EventControl.Pre_Head_T_EffectPoint;

            GameObject      barObj   = null;
            MonsterTemplate template = (MonsterTemplate)DataTemplate.GetInstance().m_MonsterTable.getTableData(monster.GetTableID());

            if (template.getMonstertype() == 1)
            {
                barObj = Instantiate(UI_FightControler.Inst.monsterBloodPre) as GameObject;
            }

            else
            {
                barObj = Instantiate(UI_FightControler.Inst.bossBloodBar) as GameObject;
            }
            barObj.transform.SetParent(transform, false);

            UI_Blood mBlood = barObj.AddComponent <UI_Blood>();

            mBlood.SetPosition(tans.position);
            barObj.transform.localScale = new Vector3(1, 1, 1);
            bloodInfo.Add(mBlood);
            mBlood.isHero = false;
            if (ObjectSelf.GetInstance().LimitFightMgr.m_bStartEnter)
            {
                int CurRound = ObjectSelf.GetInstance().LimitFightMgr.m_RoundNum;
                UltimatetrialmonsterTemplate row = (UltimatetrialmonsterTemplate)DataTemplate.GetInstance().m_UltimatetrialmonsterTable.getTableData(CurRound);
                int nLevel = template.getMonsterlevel() + row.getAdditionalLevel();
                mBlood.setHeroLevel(nLevel);
            }
            else
            {
                mBlood.setHeroLevel(template.getMonsterlevel());
            }
            mBlood.setHeadPosition(tans);
            mBlood.uid.Copy(monster.GetGuid());

            return(mBlood);
        }
Exemplo n.º 9
0
        private void OnAiTagLogic1()
        {
            if (m_ReleaseObj.GetGroupType() == EM_OBJECT_TYPE.EM_OBJECT_TYPE_HERO)
            {
                int        count = SceneObjectManager.GetInstance().GetObjectMonsterCount();
                ObjectHero hero  = (ObjectHero)m_ReleaseObj;
                //选择相克目标
//                 switch(hero.GetHeroRow().getCamp())
//                 {
//                     case (int)EM_HERO_CAMP_TYPE.EM_HERO_CAMP_TYPE1:
//                         for (int i = 0; i < count;++i)
//                         {
//                             if (SceneObjectManager.GetInstance().GetSceneMonsterList()[i].GetMonsterRow().getCamp() == (int)EM_HERO_CAMP_TYPE.EM_HERO_CAMP_TYPE2)
//                             {
//                                 m_SkillTag = SceneObjectManager.GetInstance().GetSceneMonsterList()[i];
//                                 return;
//                             }
//                         }
//                             break;
//                     case (int)EM_HERO_CAMP_TYPE.EM_HERO_CAMP_TYPE2:
//                             for (int i = 0; i < count; ++i)
//                             {
//                                 if (SceneObjectManager.GetInstance().GetSceneMonsterList()[i].GetMonsterRow().getCamp() == (int)EM_HERO_CAMP_TYPE.EM_HERO_CAMP_TYPE3)
//                                 {
//                                     m_SkillTag = SceneObjectManager.GetInstance().GetSceneMonsterList()[i];
//                                     return;
//                                 }
//                             }
//                             break;
//                     case (int)EM_HERO_CAMP_TYPE.EM_HERO_CAMP_TYPE3:
//                             for (int i = 0; i < count; ++i)
//                             {
//                                 if (SceneObjectManager.GetInstance().GetSceneMonsterList()[i].GetMonsterRow().getCamp() == (int)EM_HERO_CAMP_TYPE.EM_HERO_CAMP_TYPE1)
//                                 {
//                                     m_SkillTag = SceneObjectManager.GetInstance().GetSceneMonsterList()[i];
//                                     return;
//                                 }
//                             }
//                             break;
//                 }
                //选择普通攻击目标
                if (m_SkillTag == null || m_SkillTag.IsAlive() == false)
                {
                    m_SkillTag = hero.GetCurLockTarget();
                }
            }
            else if (m_ReleaseObj.GetGroupType() == EM_OBJECT_TYPE.EM_OBJECT_TYPE_MONSTER)
            {
                int           count   = SceneObjectManager.GetInstance().GetObjectHeroCount();
                ObjectMonster monster = (ObjectMonster)m_ReleaseObj;
                //选择相克目标
//                 switch (monster.GetMonsterRow().getCamp())
//                 {
//                     case (int)EM_HERO_CAMP_TYPE.EM_HERO_CAMP_TYPE1:
//                         for (int i = 0; i < count; ++i)
//                         {
//                             if (SceneObjectManager.GetInstance().GetSceneHeroList()[i].GetHeroRow().getCamp() == (int)EM_HERO_CAMP_TYPE.EM_HERO_CAMP_TYPE2)
//                             {
//                                 m_SkillTag = SceneObjectManager.GetInstance().GetSceneHeroList()[i];
//                                 return;
//                             }
//                         }
//                         break;
//                     case (int)EM_HERO_CAMP_TYPE.EM_HERO_CAMP_TYPE2:
//                         for (int i = 0; i < count; ++i)
//                         {
//                             if (SceneObjectManager.GetInstance().GetSceneHeroList()[i].GetHeroRow().getCamp() == (int)EM_HERO_CAMP_TYPE.EM_HERO_CAMP_TYPE3)
//                             {
//                                 m_SkillTag = SceneObjectManager.GetInstance().GetSceneHeroList()[i];
//                                 return;
//                             }
//                         }
//                         break;
//                     case (int)EM_HERO_CAMP_TYPE.EM_HERO_CAMP_TYPE3:
//                         for (int i = 0; i < count; ++i)
//                         {
//                             if (SceneObjectManager.GetInstance().GetSceneHeroList()[i].GetHeroRow().getCamp() == (int)EM_HERO_CAMP_TYPE.EM_HERO_CAMP_TYPE1)
//                             {
//                                 m_SkillTag = SceneObjectManager.GetInstance().GetSceneHeroList()[i];
//                                 return;
//                             }
//                         }
//                         break;
//                 }
                //选择普通攻击目标
                if (m_SkillTag == null || m_SkillTag.IsAlive() == false)
                {
                    m_SkillTag = monster.GetCurLockTarget();
                }
            }
        }
Exemplo n.º 10
0
 public MonsterSpellLogicPackage(ObjectMonster caster, SpellAILogic logic)
 {
     m_Caster       = caster;
     m_SpellAILogic = logic;
 }
Exemplo n.º 11
0
        public Vector3 GetMonsterMovePos(int roundIdx, ObjectMonster monster)
        {
            int idx = SceneObjectManager.GetInstance().GetMonsterIdxByGUID(monster.GUID);

            return(GetMonsterMovePos(roundIdx, idx));
        }
Exemplo n.º 12
0
    public BattleObstacle(ObjectField objectField, ObjectStage objectStage, ItemDropManager itemDropManager, FSM parentFsm)
        : base(objectField, objectStage, itemDropManager, parentFsm)
    {
        var statTable = StatLoader.Instance.GetStatTable<int, ObjectMonsterStat>("ObjectID");
        Stat = statTable.Get(objectStage.ObjectID);

        objectMonster = TableLoader.GetTable<ObjectMonster>().Get(objectStage.ObjectID);
        name = StringTableLoader.Instance.Get(objectField.ObjectName);

        InitStatus<Mob>(
            new object[] { Mob.HP, 0, ObjectMonsterStat.MaximumLife, ObjectMonsterStat.MaximumLife, }
        );

        RegisterDeathCondition(
            delegate(Status current)
            {
                return current.Get(Mob.HP) == 0;
            }
        );

        AddAction(Action.E_Type.Attack,
            delegate(float value, GameInstance firer, string[] param)
            {
                bool isCritical = false;
                if (param != null)
                {
                    foreach (var entity in param)
                    {
                        if (entity == "critical")
                        {
                            isCritical = true;
                        }
                        else if (entity == "charged")
                        {
                            FSMEvent("chargedAttack");
                        }
                    }
                }
                string meterRes = "FieldEffect/TextPhysicalDmg";
                if (isCritical)
                {
                    meterRes = "FieldEffect/TextPhysicCriticalDmg";
                    PlaySound(79);
                }
                float damage = OnHit(value, ObjectMonsterStat.damageReduction, meterRes);
                return new ActionHandler.Result(Mob.HP, -damage);
            }
        );

        AddAction(Action.E_Type.Suicide,
                delegate(float value, GameInstance firer, string[] param)
                {
                    RemoveOverlapEvent();
                    RemoveHUD();
                    FSMEvent("Suicide");
                    return new ActionHandler.Result(Mob.HP, 0);
                }
        );

        /*
        AddAction(Action.E_Type.Attack,
            delegate(float value, GameInstance firer, string[] param)
            {
                bool isCritical = false;
                if (param != null)
                {
                    foreach (var entity in param)
                    {
                        if (entity == "critical")
                        {
                            isCritical = true;
                        }
                    }
                }
                string meterRes = "FieldEffect/TextMagicalDmg";
                if (isCritical)
                {
                    meterRes = "FieldEffect/TextMagicCriticalDmg";
                    PlaySound(79);
                }
                float damage = OnHit(value, ObjectMonsterStat.MagicResistance, meterRes);
                return new ActionHandler.Result(Mob.HP, -damage);
            }
        );
        AddAction(Action.E_Type.NoneDefensiveAttack,
            delegate(float value, GameInstance firer, string[] param)
            {
                FSMEvent("damage");
                CameraEffect.Instance.Flick(new Vector2(1, 1));
                float damage = value;
                AttachMeter("FieldEffect/TextMagicalDmg", (int)damage);
                return new ActionHandler.Result(Mob.HP, -damage);
            }
        );
         * */
        AddAction(Action.E_Type.Buff,
            delegate(float value, GameInstance firer, string[] param)
            {
                Buff.Handle onBuff = null;
                Buff.Handle onDebuff = null;
                int? buffID = Cast.To<int>(value);
                Status.AddBuff(buffID.Value, firer.Stat, onBuff, onDebuff);
                return new ActionHandler.Result(null, value);
            }
        );
        AddAction(Action.E_Type.Dispel,
            delegate(float value, GameInstance firer, string[] param)
            {
                Status.Dispel();
                return new ActionHandler.Result(null, value);
            }
        );

        if (!string.IsNullOrEmpty(objectMonster.fsm))
        {
            InitFSM(objectMonster.fsm, this, false);
        }
    }