一.火焰灼烧Timer
- public class FlameCavalryTimer_1 : PLCommonBasicMissionTimer
- {
- private Mission _mission;
- public FlameCavalryTimer_1(Mission mission, float triggerInterval, bool isTriggerOnce) : base(triggerInterval, isTriggerOnce)
- {
- _mission = mission;
- }
- public override void TriggerTimerScript()
- {
- try
- {
- BrunEnemyAround();
- }
- catch (Exception ex)
- {
- File.AppendAllLines(PLModuleConstans.ModuleCrashLogPath, new string[] { ex.ToString(), ex.Message, ex.StackTrace });
- }
- }
- private void BrunEnemyAround()
- {
- _mission.Agents.ForEach(cavalryAgent =>
- {
- if (cavalryAgent.IsHuman && cavalryAgent.Team.IsFriendOf(_mission.PlayerTeam))
- {
- MBList<Agent> enemyAgentList = new MBList<Agent>();
- _mission.GetNearbyEnemyAgents(new Vec2(cavalryAgent.Frame.origin.x, cavalryAgent.Frame.origin.y), 2f, cavalryAgent.Team, enemyAgentList);
- foreach (Agent enemyAgent in enemyAgentList)
- {
- PLDamageUtilities.GiveDamageToEnemey(cavalryAgent, enemyAgent, 60);
- }
- }
- });
- }
- }
复制代码 二.火骑兵Timer
- public class FlameCavalryTimer_2 : PLCommonBasicMissionTimer
- {
- private Mission _mission;
- public FlameCavalryTimer_2(Mission mission, float triggerInterval, bool isTriggerOnce) : base(triggerInterval, isTriggerOnce)
- {
- _mission = mission;
- }
- public override void TriggerTimerScript()
- {
- try
- {
- InitCavalryFlame();
- }
- catch (Exception ex)
- {
- File.AppendAllLines(PLModuleConstans.ModuleCrashLogPath, new string[] { ex.ToString(), ex.Message, ex.StackTrace });
- }
- }
- private void InitCavalryFlame()
- {
- InformationManager.DisplayMessage(new InformationMessage("InitCavalryFlame"));
- _mission.Agents.ForEach(cavalryAgent =>
- {
- if (cavalryAgent.IsHuman && cavalryAgent.Team.IsFriendOf(_mission.PlayerTeam))
- {
- if (!MissionAgentBehavior._cavalryFlamesMap.ContainsKey(cavalryAgent))
- {
- GameEntity emptyEntity = GameEntity.CreateEmpty(_mission.Scene);
- MatrixFrame agentFrame = cavalryAgent.Frame;
- emptyEntity.SetFrame(ref agentFrame);
- emptyEntity.AddParticleSystemComponent("psys_airplane_fire_2");
- MissionAgentBehavior._cavalryFlamesMap.Add(cavalryAgent, emptyEntity);
- }
- }
- });
- }
- }
- public class FlameCavalryTimer_3 : PLCommonBasicMissionTimer
- {
- private Mission _mission;
- public FlameCavalryTimer_3(Mission mission, float triggerInterval, bool isTriggerOnce) : base(triggerInterval, isTriggerOnce)
- {
- _mission = mission;
- }
- public override void TriggerTimerScript()
- {
- try
- {
- SyncCavalryFlame();
- }
- catch (Exception ex)
- {
- File.AppendAllLines(PLModuleConstans.ModuleCrashLogPath, new string[] { ex.ToString(), ex.Message, ex.StackTrace });
- }
- }
- private void SyncCavalryFlame()
- {
- for (int i = 0; i < MissionAgentBehavior._cavalryFlamesMap.Count; i++)
- {
- Agent cavalryAgent = MissionAgentBehavior._cavalryFlamesMap.ElementAt(i).Key;
- GameEntity flame = MissionAgentBehavior._cavalryFlamesMap.ElementAt(i).Value;
- MatrixFrame agentFrame = cavalryAgent.Frame;
- flame.SetFrame(ref agentFrame);
- }
- }
- }
复制代码
免责声明:如果侵犯了您的权益,请联系站长,我们会及时删除侵权内容,谢谢合作!更多信息从访问主页:qidao123.com:ToB企服之家,中国第一个企服评测及商务社交产业平台。 |