123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144 |
- using System;
- using Common.Utility.CombatEvent;
- using Fort23.Core;
- using GameLogic.Combat.Hero;
- using UTool.CustomizeTimeLogic.FxLogic.TimeLineEventinterface;
- namespace GameLogic.Combat.CombatTool
- {
- public class CombatHeroController : IDisposable
- {
- private BetterList<CombatHeroEntity> myHero = new BetterList<CombatHeroEntity>();
- private BetterList<CombatHeroEntity> enemyHero = new BetterList<CombatHeroEntity>();
- private BetterList<ILifetCycleHitPoint> myHeroHitPoint = new BetterList<ILifetCycleHitPoint>();
- private BetterList<ILifetCycleHitPoint> enemyHeroHitPoint = new BetterList<ILifetCycleHitPoint>();
- protected CombatController combatController;
- private BetterList<CombatHeroEntity> heroDie = new BetterList<CombatHeroEntity>();
- private BetterList<CombatHeroEntity> heroDispose = new BetterList<CombatHeroEntity>();
- public void Init(CombatController combatController)
- {
- this.combatController = combatController;
- }
- public void RemoveDieHero(CombatHeroEntity combatHeroEntity)
- {
- heroDie.Remove(combatHeroEntity);
- if (!heroDispose.Contains(combatHeroEntity))
- {
- heroDispose.Add(combatHeroEntity);
- }
- }
- public void Update(float t)
- {
- for (int i = 0; i < myHero.Count; i++)
- {
- myHero[i].Update(t);
- }
- for (int i = 0; i < enemyHero.Count; i++)
- {
- enemyHero[i].Update(t);
- }
- for (int i = 0; i < heroDie.Count; i++)
- {
- heroDie[i].Update(t);
- }
- for (int i = 0; i < heroDispose.Count; i++)
- {
- heroDispose[i].Dispose();
- }
- heroDispose.Clear();
- }
- public void AddHeroDie(CombatHeroEntity hero)
- {
- heroDie.Add(hero);
- }
- public void AddHero(CombatHeroEntity hero)
- {
- if (hero.IsEnemy)
- {
- enemyHero.Add(hero);
- }
- else
- {
- myHero.Add(hero);
- }
- }
- public void RemoveHero(CombatHeroEntity hero)
- {
- if (hero.IsEnemy)
- {
- enemyHero.Remove(hero);
- }
- else
- {
- myHero.Remove(hero);
- }
- }
- public void AddHeroHitPoint(bool isEnemy, ILifetCycleHitPoint hitPoint)
- {
- if (isEnemy)
- {
- enemyHeroHitPoint.Add(hitPoint);
- }
- else
- {
- myHeroHitPoint.Add(hitPoint);
- }
- }
- public void RemoveHeroHitPoint(bool isEnemy, ILifetCycleHitPoint hitPoint)
- {
- if (isEnemy)
- {
- enemyHeroHitPoint.Remove(hitPoint);
- }
- else
- {
- myHeroHitPoint.Remove(hitPoint);
- }
- }
- public void Dispose()
- {
- myHero.Dispose();
- enemyHero.Dispose();
-
- }
- public CombatHeroEntity[] GetHero(bool isEnemy)
- {
- if (isEnemy)
- {
- return enemyHero.ToArray();
- }
- else
- {
- return myHero.ToArray();
- }
- }
- public ILifetCycleHitPoint[] GetHeroHitPoint(bool isEnemy)
- {
- if (isEnemy)
- {
- return enemyHeroHitPoint.ToArray();
- }
- else
- {
- return myHeroHitPoint.ToArray();
- }
- }
- }
- }
|