LogicBattleStateStart.cs 2.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980
  1. using UnityEngine;
  2. using System.Collections;
  3. using System.Collections.Generic;
  4. public class LogicBattleStateStart : LogicBattleState
  5. {
  6. public static LogicBattleState Creator (LogicBattle battle)
  7. {
  8. return new LogicBattleStateStart (battle);
  9. }
  10. public LogicBattleStateStart (LogicBattle battle)
  11. : base (battle, LogicBattleStateType.Start)
  12. {
  13. }
  14. public override void OnEnter ()
  15. {
  16. InitScene ();
  17. InitCamera ();
  18. InitFighterMgr ();
  19. InitCommonBuffs();
  20. InitCommonAssets();
  21. }
  22. public override void OnLeave ()
  23. {
  24. }
  25. public override void Update (float deltaTime)
  26. {
  27. ChangeState (LogicBattleStateType.Preloading);
  28. }
  29. void InitCamera()
  30. {
  31. BattleCamera.CurrentEffectLayerName = BattleCamera.SceneEffectLayerName;
  32. }
  33. void InitScene ()
  34. {
  35. mBattle.BattleScene = new LogicBattleScene(mBattle);
  36. }
  37. void InitFighterMgr ()
  38. {
  39. mBattle.FighterMgr = new FighterManager (mBattle);
  40. mBattle.FighterMgr.InitializeCurrentSceneFighters ();
  41. mBattle.FighterMgr.ParseLoad();
  42. }
  43. void InitCommonAssets()
  44. {
  45. List<int> commonEffectIds = new List<int>();
  46. commonEffectIds.Add(GlobalConfig.Instance.GetConfigIntValue(GlobalConfig.c_runsmoke_effectid));
  47. commonEffectIds.Add(GlobalConfig.Instance.GetConfigIntValue(GlobalConfig.c_shadow_effectid));
  48. commonEffectIds.Add(GlobalConfig.Instance.GetConfigIntValue(GlobalConfig.c_self_effectid));
  49. commonEffectIds.Add(GlobalConfig.Instance.GetConfigIntValue(GlobalConfig.c_relive_effectid));
  50. commonEffectIds.Add(GlobalConfig.Instance.GetConfigIntValue(GlobalConfig.c_enter_transfer_effectId));
  51. commonEffectIds.Add(GlobalConfig.Instance.GetConfigIntValue(GlobalConfig.c_exit_transfer_effectId));
  52. commonEffectIds.Add(GlobalConfig.Instance.GetConfigIntValue(BattleMgr.m_angle_effect_id_cfgid));
  53. if(commonEffectIds.Count > 0)
  54. BattlePrepareManager.Instance.PrecacheEffects(commonEffectIds.ToArray());
  55. if (BattleMgr.Instance.CommonEffectIds.Count > 0)
  56. BattlePrepareManager.Instance.PrecacheEffects(BattleMgr.Instance.CommonEffectIds.ToArray());
  57. }
  58. void InitCommonBuffs()
  59. {
  60. Dictionary<int, SInt> pointBuffs = BattleFormulaParamMgr.Instance.FunPointBuffs;
  61. foreach(var p in pointBuffs)
  62. {
  63. int buffId = p.Key;
  64. BattlePrepareManager.Instance.PrecacheBuff(buffId,(int)Role_Gender.Male,0,0,0);
  65. }
  66. }
  67. }