| | |
| | | static readonly Vector3 playerBornPosition = new Vector3(10, 6.38f, 6.67f);
|
| | | static readonly Vector3 bossBornPosition = new Vector3(8.35f, 6.37f, 9.7f);
|
| | |
|
| | |
|
| | | Step step = Step.Start;
|
| | | ClientStage currentStage = null;
|
| | |
|
| | | static GA_NpcClientFightBoss clientFightBoss = null;
|
| | |
|
| | | static float totalTime = 20f;
|
| | | static float timer = 0f;
|
| | | static DateTime playerAtkTime = DateTime.Now;
|
| | |
|
| | | HazyDemonKingModel model { get { return ModelCenter.Instance.GetModel<HazyDemonKingModel>(); } }
|
| | | HazyRegionModel hazyRegionModel { get { return ModelCenter.Instance.GetModel<HazyRegionModel>(); } }
|
| | |
|
| | |
|
| | | public override void Initialize()
|
| | | {
|
| | | base.Initialize();
|
| | |
|
| | | currentStage = null;
|
| | | timer = 0f;
|
| | | playerAtkTime = DateTime.MinValue;
|
| | |
|
| | | DTC0403_tagPlayerLoginLoadOK.mapInitOkEvent += OnReconnected; |
| | | DTC0403_tagPlayerLoginLoadOK.mapInitOkEvent += OnReconnected;
|
| | | AttackHandler.OnAttackTarget += OnPlayerAttack; |
| | | }
|
| | |
|
| | | protected override void OnStageLoadFinish()
|
| | | {
|
| | | base.OnStageLoadFinish();
|
| | |
|
| | | step = Step.Start;
|
| | | currentStage = new StartStage();
|
| | | currentStage.OnStart();
|
| | | InitializePlayer();
|
| | | InitializeBoss();
|
| | | }
|
| | |
|
| | | void InitializePlayer()
|
| | | {
|
| | | var hero = PlayerDatas.Instance.hero;
|
| | | hero.Pos = playerBornPosition;
|
| | | CameraController.Instance.Apply();
|
| | | }
|
| | |
|
| | | void InitializeBoss()
|
| | | {
|
| | | if (clientFightBoss != null)
|
| | | {
|
| | | clientFightBoss.ActorInfo.serverDie = true;
|
| | | GAMgr.Instance.ServerDie(clientFightBoss.ServerInstID);
|
| | | clientFightBoss.Die();
|
| | | clientFightBoss = null;
|
| | | }
|
| | |
|
| | | var config = HazyRegionConfig.Get(hazyRegionModel.processingIncidentId);
|
| | | var npcId = NPCConfig.Get(config.npcId);
|
| | |
|
| | | clientFightBoss = GAMgr.Instance.ReqClntFightNpc<GA_NpcClientFightBoss>((uint)config.npcId, E_ActorGroup.Enemy);
|
| | | clientFightBoss.Pos = bossBornPosition;
|
| | | clientFightBoss.LockTargetSID = PlayerDatas.Instance.PlayerId;
|
| | | }
|
| | |
|
| | | private void OnPlayerAttack(uint _attackerId, uint _victimId, byte _type, uint _damage)
|
| | | {
|
| | | if (clientFightBoss == null)
|
| | | {
|
| | | return;
|
| | | }
|
| | |
|
| | | if (_victimId == clientFightBoss.ServerInstID)
|
| | | {
|
| | | var progress = Mathf.Clamp01(1 - timer / totalTime);
|
| | | var hp = (ulong)(clientFightBoss.ActorInfo.RealMaxHp * progress);
|
| | |
|
| | | TargetBriefInfo.OnRefreshBossLifeBar(_victimId, clientFightBoss.NpcConfig.NPCID,
|
| | | hp, clientFightBoss.ActorInfo.RealMaxHp);
|
| | |
|
| | | playerAtkTime = DateTime.Now;
|
| | | }
|
| | | }
|
| | |
|
| | | protected override void OnUpdate()
|
| | | {
|
| | | base.OnUpdate();
|
| | |
|
| | | if (currentStage != null)
|
| | | if (timer < totalTime)
|
| | | {
|
| | | currentStage.OnUpdate();
|
| | | if (currentStage.isCompleted)
|
| | | if ((DateTime.Now - playerAtkTime).TotalSeconds < 1f)
|
| | | {
|
| | | currentStage.OnEnd();
|
| | | currentStage = null;
|
| | | timer += Time.deltaTime;
|
| | | if (timer >= totalTime)
|
| | | {
|
| | | OnBossDie();
|
| | | }
|
| | | }
|
| | | }
|
| | | }
|
| | |
|
| | | void OnBossDie()
|
| | | {
|
| | | if (clientFightBoss != null)
|
| | | {
|
| | | clientFightBoss.ActorInfo.serverDie = true;
|
| | | GAMgr.Instance.ServerDie(clientFightBoss.ServerInstID);
|
| | | clientFightBoss.Die();
|
| | | clientFightBoss = null;
|
| | | }
|
| | | }
|
| | |
|
| | |
| | | {
|
| | | base.UnInitialize();
|
| | |
|
| | | currentStage = null;
|
| | |
|
| | | if (clientFightBoss != null)
|
| | | {
|
| | | clientFightBoss.ActorInfo.serverDie = true;
|
| | |
| | | clientFightBoss = null;
|
| | | }
|
| | |
|
| | | DTC0403_tagPlayerLoginLoadOK.mapInitOkEvent -= OnReconnected; |
| | | DTC0403_tagPlayerLoginLoadOK.mapInitOkEvent -= OnReconnected;
|
| | | AttackHandler.OnAttackTarget -= OnPlayerAttack; |
| | | }
|
| | |
|
| | | #if UNITY_EDITOR
|
| | |
| | | public abstract void OnUpdate();
|
| | | public abstract void OnStart();
|
| | | public abstract void OnEnd();
|
| | | }
|
| | |
|
| | | public class StartStage : ClientStage
|
| | | {
|
| | | public override bool isCompleted
|
| | | {
|
| | | get; protected set;
|
| | | }
|
| | |
|
| | | public override void OnStart()
|
| | | {
|
| | | var hero = PlayerDatas.Instance.hero;
|
| | | hero.Pos = playerBornPosition;
|
| | |
|
| | | CameraController.Instance.Apply();
|
| | |
|
| | | var config = HazyRegionConfig.Get(model.processingIncidentId);
|
| | | var npcId = NPCConfig.Get(config.npcId);
|
| | |
|
| | | if (clientFightBoss != null)
|
| | | {
|
| | | clientFightBoss.ActorInfo.serverDie = true;
|
| | | GAMgr.Instance.ServerDie(clientFightBoss.ServerInstID);
|
| | | clientFightBoss.Die();
|
| | | clientFightBoss = null;
|
| | | }
|
| | | clientFightBoss = GAMgr.Instance.ReqClntFightNpc<GA_NpcClientFightBoss>((uint)config.npcId, E_ActorGroup.Enemy);
|
| | | clientFightBoss.Pos = bossBornPosition;
|
| | | clientFightBoss.LockTargetSID = PlayerDatas.Instance.PlayerId;
|
| | |
|
| | | isCompleted = true;
|
| | | }
|
| | |
|
| | | public override void OnUpdate()
|
| | | {
|
| | | }
|
| | |
|
| | | public override void OnEnd()
|
| | | {
|
| | | }
|
| | | }
|
| | | } |