| | |
| | | using System;
|
| | | using Snxxz.UI;
|
| | | using System;
|
| | | using System.Collections; |
| | | using System.Collections.Generic; |
| | | using UnityEngine; |
| | | namespace Snxxz.UI
|
| | | {
|
| | | public class ClientHazyGrassStage : DungeonStage
|
| | | {
|
| | | static readonly Vector3 PlayerBornPosition = new Vector3(17.25f, 5.12f, 3.70f);
|
| | | static readonly Vector3 PlayerBornPosition1 = new Vector3(17.25f, 5.12f, 3.70f);
|
| | | static readonly Vector3 PlayerBornPosition2 = new Vector3(17.25f, 5.12f, 3.70f);
|
| | |
|
| | | static List<HazyMapNpcScriptableObject.NpcInfo> s_NpcInfos = new List<HazyMapNpcScriptableObject.NpcInfo>();
|
| | | static Dictionary<Vector3, GA_NpcClientCollect> s_CollectNpcs = new Dictionary<Vector3, GA_NpcClientCollect>();
|
| | | static Dictionary<uint, Vector3> s_Sid2NpcPos = new Dictionary<uint, Vector3>();
|
| | | static Dictionary<uint, int> s_Sid2NpcIds = new Dictionary<uint, int>();
|
| | | static List<GA_NpcClientFightNorm> s_ClientFightNpcs = new List<GA_NpcClientFightNorm>();
|
| | |
|
| | | static int grassRefreshCount = 0;
|
| | |
|
| | | bool mapLoadFinish = false;
|
| | | bool initedFightNpc = false;
|
| | |
|
| | | HazyRegionIncidentType incidentType;
|
| | |
|
| | | HazyGrassModel model { get { return ModelCenter.Instance.GetModel<HazyGrassModel>(); } }
|
| | | HazyRegionModel hazyRegionModel { get { return ModelCenter.Instance.GetModel<HazyRegionModel>(); } }
|
| | |
|
| | | public override void Initialize()
|
| | | {
|
| | |
| | | s_Sid2NpcPos.Clear();
|
| | |
|
| | | mapLoadFinish = false;
|
| | | initedFightNpc = false;
|
| | |
|
| | | grassRefreshCount = 0;
|
| | |
|
| | | var config = HazyRegionConfig.Get(hazyRegionModel.processingIncidentId);
|
| | | if (config != null)
|
| | | {
|
| | | incidentType = (HazyRegionIncidentType)config.incidentType;
|
| | | }
|
| | |
|
| | | UnloadAllNpc();
|
| | |
|
| | |
| | |
|
| | | InitialPlayer();
|
| | | InitializeNpc();
|
| | |
|
| | | initedFightNpc = true;
|
| | | }
|
| | |
|
| | | protected override void OnUpdate()
|
| | |
| | | void InitialPlayer()
|
| | | {
|
| | | var hero = PlayerDatas.Instance.hero;
|
| | | hero.Pos = PlayerBornPosition;
|
| | | if (incidentType == HazyRegionIncidentType.ReikiGrass)
|
| | | {
|
| | | hero.Pos = PlayerBornPosition1;
|
| | | }
|
| | | else if (incidentType == HazyRegionIncidentType.FairyGrass)
|
| | | {
|
| | | hero.Pos = PlayerBornPosition2;
|
| | | }
|
| | | CameraController.Instance.Apply();
|
| | | }
|
| | |
|
| | |
| | | }
|
| | | }
|
| | | break;
|
| | | case E_NpcType.Fight:
|
| | | if (!initedFightNpc)
|
| | | {
|
| | | var fightNpc = GAMgr.Instance.ReqClntFightNpc<GA_NpcClientFightNorm>((uint)npcInfo.npcId,
|
| | | E_ActorGroup.Enemy);
|
| | | if (fightNpc != null)
|
| | | {
|
| | | fightNpc.Pos = npcInfo.position;
|
| | | fightNpc.OnAttacked -= OnAttackNpc;
|
| | | fightNpc.OnAttacked += OnAttackNpc;
|
| | | }
|
| | | s_ClientFightNpcs.Add(fightNpc);
|
| | | }
|
| | | break;
|
| | | }
|
| | | }
|
| | | }
|
| | |
|
| | | private void OnAttackNpc()
|
| | | {
|
| | | Debug.Log("攻击了宝箱怪");
|
| | | }
|
| | |
|
| | | void UnloadAllNpc()
|
| | |
| | | GAMgr.Instance.Release(_npc);
|
| | | }
|
| | | }
|
| | |
|
| | | foreach (var _npc in s_ClientFightNpcs)
|
| | | {
|
| | | if (_npc != null)
|
| | | {
|
| | | _npc.OnAttacked -= OnAttackNpc;
|
| | | _npc.ActorInfo.serverDie = true;
|
| | | GAMgr.Instance.ServerDie(_npc.ServerInstID);
|
| | | GAMgr.Instance.Release(_npc);
|
| | | }
|
| | | }
|
| | |
|
| | | s_ClientFightNpcs.Clear();
|
| | | s_CollectNpcs.Clear();
|
| | | }
|
| | |
|
| | |
| | | }
|
| | | }
|
| | | #endif
|
| | | }
|
| | | } |
| | | |