public HeroInfo (HeroData data, HeroInfo info) : base(data) { Data = data; if (info != null) { hp = (int)(data.HP * info.HPRatio); IsConverting = info.IsConverting; IsInHall = info.IsInHall; LastHitTime = info.LastHitTime; } }
public static Hero Create(HeroRecord record) { HeroData data = HeroDataManager.Instance.GetData(record.Kid) as HeroData; HeroInfo info = new HeroInfo(data, record); return Create(record.Kid, info); }
public static Hero Create(int heroKid, HeroInfo info) { Hero hero = new Hero(); hero.Uid = Guid.NewGuid().ToString(); hero.Data = HeroDataManager.Instance.GetData(heroKid) as HeroData; hero.Info = new HeroInfo(hero.Data, info); hero.Script = ResourceManager.Instance.LoadAsset<HeroScript>(ObjectType.GameObject, hero.Data.GetResPath()); hero.Script.Uid = hero.Uid; hero.Script.CallbackUpdate = hero.Update; hero.Script.CallbackSlowUpdate = hero.SlowUpdate; hero.Script.CallbackDie = hero.OnDie; hero.Script.CallbackTrapAttack = hero.OnTrapAttack; hero.Script.AnimatorDataDic = AnimatorDataManager.Instance.GetDataDic(hero.Data.Kid); hero.battleProxy = ApplicationFacade.Instance.RetrieveProxy<BattleProxy>(); hero.inputManager = InputManager.Instance; instance = hero; return hero; }