Beispiel #1
0
        BattleActorBase GetActorById(int unitId)
        {
            BattleActorBase ret = null;

            mBattleActorDic.TryGetValue(unitId, out ret);
            return(ret);
        }
Beispiel #2
0
        public void OnUnitEnterIdle(int unitId)
        {
            BattleActorBase actor = GetActorById(unitId);

            if (null != actor)
            {
                actor.OnEnterIdle();
            }
        }
Beispiel #3
0
        public void OnUnitUseSkill(int unitId, short skillId)
        {
            BattleActorBase actor = GetActorById(unitId);

            if (null != actor)
            {
                actor.OnUseSkill(skillId);
            }
        }
Beispiel #4
0
        public void OnUnitMove(int unitId, IntVector2 fromPos, IntVector2 toPos)
        {
            BattleActorBase actor = GetActorById(unitId);

            if (null != actor)
            {
                actor.OnMove(fromPos, toPos);
            }
        }
Beispiel #5
0
        void OnActorDead(int unitId)
        {
            BattleActorBase ret = null;

            mBattleActorDic.TryGetValue(unitId, out ret);
            if (null != ret)
            {
                ret.OnUnitDead();
            }
        }
Beispiel #6
0
        public void StartBattle(List <UnitConfigData> fighterDatas)
        {
            ActorRootTf      = new GameObject().transform;
            ActorRootTf.name = "BattleActorRoot";

            for (int i = 0; i < fighterDatas.Count; ++i)
            {
                BattleActorBase actor = new BattleActorBase(fighterDatas[i].id, fighterDatas[i].life, fighterDatas[i].borthPos);
                mBattleActorDic [actor.Id] = actor;
            }
        }
Beispiel #7
0
        public void Update()
        {
            var enumerator = mBattleActorDic.GetEnumerator();

            while (enumerator.MoveNext())
            {
                BattleActorBase actor = enumerator.Current.Value;
                actor.Update();
                if (actor.IsInDead && actor.IsFinishDeadAnim)
                {
                    actor.Destroy();
                    mToRemoveList.Add(actor.Id);
                }
            }
            for (int i = 0; i < mToRemoveList.Count; ++i)
            {
                mBattleActorDic.Remove(mToRemoveList[i]);
            }
        }
Beispiel #8
0
 public void OnUnitAttrChg(int unitId, FighterAttributeType attrType, int value)
 {
     if (attrType == FighterAttributeType.Life)
     {
         if (value <= 0)
         {
             OnActorDead(unitId);
         }
         else
         {
             BattleActorBase actor = GetActorById(unitId);
             if (null == actor)
             {
                 return;
             }
             actor.OnLifeChg(value);
         }
     }
 }