TimeBattleStateStart.cs 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. using UnityEngine;
  2. using System.Collections.Generic;
  3. public class TimeBattleStateStart : TimeBattleState
  4. {
  5. public static TimeBattleStateStart Creator(TimeBattle battle)
  6. {
  7. return new TimeBattleStateStart(battle);
  8. }
  9. public TimeBattleStateStart(TimeBattle battle):
  10. base(battle,TimeBattleStateType.Start)
  11. {
  12. }
  13. public override void OnEnter()
  14. {
  15. Init();
  16. }
  17. public override void Update(float deltaTime)
  18. {
  19. ChangeState(TimeBattleStateType.Preloading);
  20. }
  21. public override void OnLeave()
  22. {
  23. }
  24. void Init()
  25. {
  26. mBattle.BattleScene = new TimeBattleScene(mBattle, mBattle.SceneName);
  27. mBattle.FighterMgr = new FighterManager(mBattle);
  28. mBattle.FighterMgr.InitFighters();
  29. mBattle.FighterMgr.ParseLoad();
  30. InitCommonBuffs();
  31. InitCommonAssets();
  32. }
  33. void InitCommonAssets()
  34. {
  35. List<int> commonEffectIds = new List<int>();
  36. commonEffectIds.Add(GlobalConfig.Instance.GetConfigIntValue(GlobalConfig.c_shadow_effectid));
  37. commonEffectIds.Add(GlobalConfig.Instance.GetConfigIntValue(GlobalConfig.c_self_effectid));
  38. if (commonEffectIds.Count > 0)
  39. BattlePrepareManager.Instance.PrecacheEffects(commonEffectIds.ToArray());
  40. }
  41. void InitCommonBuffs()
  42. {
  43. Dictionary<int, SInt> pointBuffs = BattleFormulaParamMgr.Instance.FunPointBuffs;
  44. foreach (var p in pointBuffs)
  45. {
  46. int buffId = p.Key;
  47. BattlePrepareManager.Instance.PrecacheBuff(buffId, (int)Role_Gender.Male, 0, 0, 0);
  48. }
  49. }
  50. }