BossBattleStateStart.cs 2.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  1. using UnityEngine;
  2. using System.Collections;
  3. using System.Collections.Generic;
  4. public class BossBattleStateStart : BossBattleState
  5. {
  6. public static BossBattleStateStart Creator(BossBattle battle)
  7. {
  8. return new BossBattleStateStart(battle);
  9. }
  10. public BossBattleStateStart(BossBattle battle):
  11. base(battle, BossBattleStateType.Start)
  12. {
  13. }
  14. public override void OnEnter()
  15. {
  16. Init();
  17. }
  18. public override void Update(float deltaTime)
  19. {
  20. ChangeState(BossBattleStateType.Preloading);
  21. }
  22. public override void OnLeave()
  23. {
  24. }
  25. void Init()
  26. {
  27. //创建场景
  28. mBattle.BattleScene = new BossBattleScene(mBattle,mBattle.LevelName);
  29. //解析战斗人员
  30. mBattle.FighterMgr = new FighterManager(mBattle);
  31. mBattle.FighterMgr.InitFighters();
  32. mBattle.FighterMgr.ParseLoad();
  33. InitCommonBuffs();
  34. InitCommonAssets();
  35. }
  36. void InitCommonAssets()
  37. {
  38. List<int> commonEffectIds = new List<int>();
  39. commonEffectIds.Add(GlobalConfig.Instance.GetConfigIntValue(GlobalConfig.c_runsmoke_effectid));
  40. commonEffectIds.Add(GlobalConfig.Instance.GetConfigIntValue(GlobalConfig.c_shadow_effectid));
  41. commonEffectIds.Add(GlobalConfig.Instance.GetConfigIntValue(GlobalConfig.c_self_effectid));
  42. commonEffectIds.Add(GlobalConfig.Instance.GetConfigIntValue(GlobalConfig.c_relive_effectid));
  43. commonEffectIds.Add(GlobalConfig.Instance.GetConfigIntValue(GlobalConfig.c_enter_transfer_effectId));
  44. commonEffectIds.Add(GlobalConfig.Instance.GetConfigIntValue(GlobalConfig.c_exit_transfer_effectId));
  45. commonEffectIds.Add(GlobalConfig.Instance.GetConfigIntValue(GlobalConfig.c_pauseEffect_cfg_id));
  46. commonEffectIds.Add(GlobalConfig.Instance.GetConfigIntValue(BattleMgr.m_angle_effect_id_cfgid));
  47. if (commonEffectIds.Count > 0)
  48. BattlePrepareManager.Instance.PrecacheEffects(commonEffectIds.ToArray());
  49. if(BattleMgr.Instance.CommonEffectIds.Count > 0)
  50. BattlePrepareManager.Instance.PrecacheEffects(BattleMgr.Instance.CommonEffectIds.ToArray());
  51. }
  52. void InitCommonBuffs()
  53. {
  54. Dictionary<int, SInt> pointBuffs = BattleFormulaParamMgr.Instance.FunPointBuffs;
  55. foreach (var p in pointBuffs)
  56. {
  57. int buffId = p.Key;
  58. BattlePrepareManager.Instance.PrecacheBuff(buffId, (int)Role_Gender.Male,0,0,0);
  59. }
  60. }
  61. }