using System.Collections;
|
using System.Collections.Generic;
|
using UnityEngine;
|
using vnxbqy.UI;
|
using System;
|
|
public class GuardDungeonStage : DungeonStage
|
{
|
readonly Vector3 s_PlayerPosition = new Vector3(16.8f, 1.441f, 9.09f);
|
readonly List<Vector3> s_MonsterPositions = new List<Vector3>()
|
{
|
new Vector3(10f, 1.441f, 10),
|
new Vector3(10f, 1.441f, 10),
|
new Vector3(13.5f,1.441f,11.5f),
|
new Vector3(13.5f,1.441f,11.5f),
|
new Vector3(13f,1.441f,12.5f),
|
new Vector3(12.5f,1.441f,13f),
|
new Vector3(11f,1.441f,13.5f),
|
new Vector3(11f,1.441f,13f),
|
new Vector3(10.5f,1.441f,8.5f),
|
new Vector3(10.5f,1.441f,8.5f),
|
new Vector3(12f,1.441f,8.5f),
|
new Vector3(12f,1.441f,9f),
|
};
|
|
readonly Vector3 s_BossPosition = new Vector3(9f, 1.441f, 12f);
|
readonly Vector3 s_CagePosition = new Vector3(11f, 1.441f, 11f);
|
readonly Vector3 s_GuardPosition = new Vector3(11f, 1.441f, 11f);
|
|
readonly int s_GuardNpcId = 32504001;
|
readonly int s_BossNpcId = 32503001;
|
readonly int s_MonsterNpcId = 32501001;
|
|
static int[] stepTimes = null;
|
|
List<GA_NpcClientFightNorm> clientMonsters = new List<GA_NpcClientFightNorm>();
|
GA_NpcClientFightBoss clientBoss;
|
GA_NpcClientFightNorm clientCage;
|
GA_NpcClientFunc clientGuard;
|
|
Clock dungeonEndClock;
|
|
BossShowStep bossShowStep;
|
KillMonsterStep killMonsterStep;
|
DestroyCageStep destroyCageStep;
|
GuardDialogueStep guardDialogueStep;
|
DungeonOver dungeonOverStep;
|
|
Step m_Step = Step.None;
|
Step step
|
{
|
get { return m_Step; }
|
set
|
{
|
if (m_Step != value)
|
{
|
switch (m_Step)
|
{
|
case Step.BossShow:
|
bossShowStep.OnExit();
|
break;
|
case Step.KillMonster:
|
killMonsterStep.OnExit();
|
break;
|
case Step.DestroyCage:
|
destroyCageStep.OnExit();
|
break;
|
case Step.GuardDialogue:
|
guardDialogueStep.OnExit();
|
break;
|
case Step.Over:
|
dungeonOverStep.OnExit();
|
break;
|
}
|
|
m_Step = value;
|
switch (m_Step)
|
{
|
case Step.BossShow:
|
bossShowStep.OnEnter();
|
break;
|
case Step.KillMonster:
|
killMonsterStep.OnEnter();
|
break;
|
case Step.DestroyCage:
|
destroyCageStep.OnEnter();
|
break;
|
case Step.GuardDialogue:
|
guardDialogueStep.OnEnter();
|
break;
|
case Step.Over:
|
dungeonOverStep.OnEnter();
|
break;
|
}
|
|
}
|
}
|
}
|
|
|
int guardDialogueIndex = 0;
|
float guardDialogueAbleTime = 0f;
|
|
int enemyDeadCount = 0;
|
|
int dialogueNpcId = 0;
|
int[] speakTypes = null;
|
string[] dialogues = null;
|
List<Item> items = null;
|
int autoDialogueSecond = 10;
|
|
DateTime startTime = DateTime.Now;
|
|
public int totalUsedSeconds
|
{
|
get
|
{
|
return (int)(DateTime.Now - startTime).TotalSeconds;
|
}
|
}
|
|
bool initialized = false;
|
|
DungeonModel model { get { return ModelCenter.Instance.GetModel<DungeonModel>(); } }
|
|
public override void Initialize()
|
{
|
base.Initialize();
|
|
if (!initialized)
|
{
|
var funcConfig = FuncConfigConfig.Get("ClientGuardDungeon");
|
dialogueNpcId = int.Parse(funcConfig.Numerical1);
|
speakTypes = ConfigParse.GetMultipleStr<int>(funcConfig.Numerical2);
|
dialogues = ConfigParse.GetMultipleStr(funcConfig.Numerical3);
|
var itemDict = ConfigParse.GetDic<int, int>(funcConfig.Numerical4);
|
if (itemDict != null)
|
{
|
items = new List<Item>();
|
foreach (var itemId in itemDict.Keys)
|
{
|
items.Add(new Item()
|
{
|
id = itemId,
|
count = itemDict[itemId],
|
});
|
}
|
}
|
|
funcConfig = FuncConfigConfig.Get("TaskContinue");
|
autoDialogueSecond = int.Parse(funcConfig.Numerical2);
|
|
var dungeonId = model.GetDungeonId(ClientGuardDungeon.DATAMAPID, 0);
|
var dungeonConfig = DungeonConfig.Get(dungeonId);
|
|
stepTimes = LitJson.JsonMapper.ToObject<int[]>(dungeonConfig.StepTime);
|
|
initialized = true;
|
}
|
|
bossShowStep = new BossShowStep(this);
|
killMonsterStep = new KillMonsterStep(this);
|
destroyCageStep = new DestroyCageStep(this);
|
guardDialogueStep = new GuardDialogueStep(this);
|
dungeonOverStep = new DungeonOver(this);
|
|
step = Step.None;
|
|
PlayerDatas.Instance.hero.aiHandler.PriorityNpcID = s_MonsterNpcId;
|
|
BossShowModel.Instance.bossShowPreparedEvent += OnBossShowBegin;
|
BossShowModel.Instance.bossShowCompletedEvent += BossShowCompletedEvent;
|
NPCInteractProcessor.s_NpcInteractEvent += OnNpcTalkEvent;
|
model.onDungeonResultEvent += OnDungeonResultEvent;
|
|
NormalDialogueWin.onDialogueComplete += OnDialogueComplete;
|
}
|
|
public override void UnInitialize()
|
{
|
step = Step.None;
|
|
UnloadNpcs();
|
|
if (dungeonEndClock != null)
|
{
|
Clock.Stop(dungeonEndClock);
|
dungeonEndClock = null;
|
}
|
|
BossShowModel.Instance.bossShowPreparedEvent -= OnBossShowBegin;
|
BossShowModel.Instance.bossShowCompletedEvent -= BossShowCompletedEvent;
|
NPCInteractProcessor.s_NpcInteractEvent -= OnNpcTalkEvent;
|
NormalDialogueWin.onDialogueComplete -= OnDialogueComplete;
|
model.onDungeonResultEvent -= OnDungeonResultEvent;
|
|
base.UnInitialize();
|
}
|
|
protected override void OnStageLoadFinish()
|
{
|
base.OnStageLoadFinish();
|
|
StartCoroutine(Co_VerityExistBossShow());
|
|
InitializeHero();
|
}
|
|
void InitializeHero()
|
{
|
var hero = PlayerDatas.Instance.hero;
|
if (hero != null)
|
{
|
hero.Pos = s_PlayerPosition;
|
}
|
}
|
|
private IEnumerator Co_VerityExistBossShow()
|
{
|
yield return WaitingForSecondConst.WaitMS500;
|
if (!BossShowModel.Instance.BossShowing)
|
{
|
BossShowCompletedEvent();
|
}
|
}
|
|
void InitializeNpcs()
|
{
|
UnloadNpcs();
|
|
foreach (var position in s_MonsterPositions)
|
{
|
var npc = GAMgr.Instance.ReqClntFightNpc<GA_NpcClientFightNorm>((uint)s_MonsterNpcId, E_ActorGroup.Enemy);
|
npc.Pos = npc.BornPos = position;
|
npc.LockTargetSID = PlayerDatas.Instance.PlayerId;
|
clientMonsters.Add(npc);
|
}
|
|
clientBoss = GAMgr.Instance.ReqClntFightNpc<GA_NpcClientFightBoss>((uint)s_BossNpcId, E_ActorGroup.Enemy);
|
clientBoss.Pos = clientBoss.BornPos = s_BossPosition;
|
clientBoss.LockTargetSID = PlayerDatas.Instance.PlayerId;
|
clientBoss.Rotation = Quaternion.Euler(0, 116.5f, 0);
|
|
clientCage = GAMgr.Instance.ReqClntFightNpc<GA_NpcClientFightNorm>((uint)GeneralDefine.guardDungeonCageNPCID, E_ActorGroup.Enemy);
|
clientCage.Pos = s_CagePosition;
|
clientCage.Rotation = Quaternion.Euler(0, 116.5f, 0);
|
clientCage.LockHp(1);
|
|
clientGuard = GAMgr.Instance.ReqClntNoFightNpc<GA_NpcClientFunc>((uint)s_GuardNpcId, E_ActorGroup.FuncNpc);
|
clientGuard.Pos = s_GuardPosition;
|
clientGuard.Rotation = Quaternion.Euler(0, 0, 0);
|
|
enemyDeadCount = 0;
|
}
|
|
void UnloadNpcs()
|
{
|
for (int i = 0; i < clientMonsters.Count; i++)
|
{
|
var npc = clientMonsters[i];
|
if (npc != null)
|
{
|
GAMgr.Instance.ServerDie(npc.ServerInstID);
|
GAMgr.Instance.Release(npc);
|
}
|
}
|
clientMonsters.Clear();
|
|
if (clientBoss != null)
|
{
|
GAMgr.Instance.ServerDie(clientBoss.ServerInstID);
|
GAMgr.Instance.Release(clientBoss);
|
clientBoss = null;
|
}
|
|
if (clientCage != null)
|
{
|
GAMgr.Instance.ServerDie(clientCage.ServerInstID);
|
GAMgr.Instance.Release(clientCage);
|
clientCage = null;
|
}
|
|
if (clientGuard != null)
|
{
|
GAMgr.Instance.ServerDie(clientGuard.ServerInstID);
|
GAMgr.Instance.Release(clientGuard);
|
clientGuard = null;
|
}
|
}
|
|
protected override void OnUpdate()
|
{
|
base.OnUpdate();
|
|
if (step == Step.KillMonster)
|
{
|
UpdateNpcDeadCount();
|
}
|
|
if (step == Step.DestroyCage)
|
{
|
UpdateCageState();
|
}
|
|
switch (step)
|
{
|
case Step.BossShow:
|
bossShowStep.OnUpdate();
|
break;
|
case Step.KillMonster:
|
killMonsterStep.OnUpdate();
|
break;
|
case Step.DestroyCage:
|
destroyCageStep.OnUpdate();
|
break;
|
case Step.GuardDialogue:
|
guardDialogueStep.OnUpdate();
|
break;
|
case Step.Over:
|
dungeonOverStep.OnUpdate();
|
break;
|
}
|
}
|
|
private void UpdateNpcDeadCount()
|
{
|
var requreUpdate = false;
|
|
var deadCount = 0;
|
for (int i = 0; i < clientMonsters.Count; i++)
|
{
|
if (clientMonsters[i] == null || clientMonsters[i].ActorInfo.serverDie)
|
{
|
deadCount++;
|
}
|
}
|
|
if (clientBoss == null || clientBoss.ActorInfo.serverDie)
|
{
|
deadCount += 1;
|
}
|
|
if (deadCount != enemyDeadCount)
|
{
|
enemyDeadCount = deadCount;
|
requreUpdate = true;
|
}
|
|
if (requreUpdate)
|
{
|
UpdateDungeonMission();
|
}
|
|
if (enemyDeadCount == clientMonsters.Count + 1)
|
{
|
step = Step.DestroyCage;
|
UpdateDungeonMission();
|
}
|
}
|
|
private void UpdateCageState()
|
{
|
if (clientCage != null && clientCage.ActorInfo.serverDie)
|
{
|
step = Step.GuardDialogue;
|
UpdateDungeonMission();
|
}
|
}
|
|
void UpdateDungeonMission()
|
{
|
var missionData = new DungeonMissionData()
|
{
|
lineID = 0,
|
step = (int)step,
|
npcTotal = enemyDeadCount,
|
npc = new DungeonNPCInfo[1]
|
{
|
new DungeonNPCInfo()
|
{
|
NPCID=GeneralDefine.guardDungeonCageNPCID,
|
killCnt= (int)step > (int)Step.DestroyCage ? 1 : 0,
|
},
|
},
|
talkOver = (int)step > (int)Step.GuardDialogue ? 1 : 0,
|
};
|
model.UpdateJiaDungeonMission(ClientGuardDungeon.DATAMAPID, missionData);
|
}
|
|
private void OnBossShowBegin()
|
{
|
step = Step.BossShow;
|
}
|
|
private void BossShowCompletedEvent()
|
{
|
InitializeNpcs();
|
|
var seconds = stepTimes[1];
|
|
startTime = DateTime.Now;
|
|
model.UpdateCoolDown(DungeonCoolDownType.FightStart, (uint)seconds * 1000);
|
dungeonEndClock = Clock.AlarmAfter(seconds, OnDungeonEnd);
|
|
step = Step.KillMonster;
|
|
UpdateDungeonMission();
|
}
|
|
private void OnNpcTalkEvent(E_NpcType arg1, int npcId, uint arg3)
|
{
|
if (npcId == s_GuardNpcId && step == Step.GuardDialogue)
|
{
|
if (!WindowCenter.Instance.IsOpen<MainInterfaceWin>()
|
|| WindowCenter.Instance.ExistAnyFullScreenOrMaskWin())
|
{
|
return;
|
}
|
if (!WindowCenter.Instance.IsOpen<NormalDialogueWin>())
|
{
|
WindowCenter.Instance.Close<MainInterfaceWin>();
|
NormalDialogueWin.customDialogueInfo = new CustomDialogueInfo()
|
{
|
dialogues = dialogues,
|
speakTypes = speakTypes,
|
npcId = dialogueNpcId,
|
autoSeconds = autoDialogueSecond,
|
items = new List<Item>(items),
|
};
|
WindowCenter.Instance.Open<NormalDialogueWin>();
|
}
|
}
|
}
|
|
private void OnDialogueComplete()
|
{
|
var pak = new CB101_tagCMClientEndFB();
|
pak.MapID = ClientGuardDungeon.DATAMAPID;
|
pak.LineID = 0;
|
GameNetSystem.Instance.SendInfo(pak);
|
}
|
|
private void OnDungeonResultEvent()
|
{
|
if (dungeonEndClock != null)
|
{
|
Clock.Stop(dungeonEndClock);
|
dungeonEndClock = null;
|
}
|
|
var seconds = stepTimes[2];
|
model.UpdateCoolDown(DungeonCoolDownType.LeaveMap, (uint)seconds * 1000);
|
|
step = Step.Over;
|
UpdateDungeonMission();
|
}
|
|
private void OnDungeonEnd()
|
{
|
ClientGuardDungeon.RequestExit();
|
}
|
|
#if UNITY_EDITOR
|
private void OnGUI()
|
{
|
if (GUILayout.Button("Exit"))
|
{
|
ClientGuardDungeon.RequestExit();
|
}
|
}
|
#endif
|
|
class BossShowStep
|
{
|
float timer = 0f;
|
float monsterExclaimTime = 6.4f;
|
float monsterRunTime = 7f;
|
bool exclaimed = false;
|
float monsterMoveSpeed = 0.5f;
|
|
GuardDungeonStage dungeonStage;
|
public BossShowStep(GuardDungeonStage _stage)
|
{
|
dungeonStage = _stage;
|
}
|
|
public void OnEnter()
|
{
|
timer = 0f;
|
exclaimed = false;
|
var showActors = BossShowModel.Instance.showTargetList;
|
for (int i = 0; i < showActors.Count; i++)
|
{
|
var showActor = showActors[i];
|
if (showActor.npcId == dungeonStage.s_GuardNpcId)
|
{
|
showActor.m_Model.transform.localScale = Vector3.one * 3;
|
}
|
}
|
|
for (int i = 0; i < showActors.Count; i++)
|
{
|
var showActor = showActors[i];
|
if (dungeonStage.s_MonsterNpcId == showActor.npcId)
|
{
|
var mountPoint = showActor.m_Model.transform.GetChildTransformDeeply("A_Name");
|
|
switch (i)
|
{
|
case 2:
|
StoryDialogueBubble.StoryShow(Language.Get("BossShowTalk2"), mountPoint, BossShowModel.Instance.showCamera, 0.5f);
|
break;
|
case 3:
|
StoryDialogueBubble.StoryShow(Language.Get("BossShowTalk3"), mountPoint, BossShowModel.Instance.showCamera, 1f);
|
break;
|
case 5:
|
StoryDialogueBubble.StoryShow(Language.Get("BossShowTalk4"), mountPoint, BossShowModel.Instance.showCamera, 1.5f);
|
break;
|
case 6:
|
StoryDialogueBubble.StoryShow(Language.Get("BossShowTalk5"), mountPoint, BossShowModel.Instance.showCamera, 2f);
|
break;
|
}
|
}
|
else if (dungeonStage.s_BossNpcId == showActor.npcId)
|
{
|
var mountPoint = showActor.m_Model.transform.GetChildTransformDeeply("A_Stun");
|
StoryDialogueBubble.StoryShow(Language.Get("BossShowTalk1"), mountPoint, BossShowModel.Instance.showCamera);
|
}
|
}
|
|
}
|
|
public void OnUpdate()
|
{
|
timer += Time.deltaTime;
|
var showActors = BossShowModel.Instance.showTargetList;
|
if (!exclaimed && timer > monsterExclaimTime)
|
{
|
exclaimed = true;
|
|
for (int i = 0; i < showActors.Count; i++)
|
{
|
var showActor = showActors[i];
|
|
if (dungeonStage.s_MonsterNpcId == showActor.npcId)
|
{
|
var mountPoint = showActor.m_Model.transform.GetChildTransformDeeply("A_Name");
|
HeadUpStorySign.Display(mountPoint, BossShowModel.Instance.showCamera);
|
showActor.m_Model.transform.LookAt(BossShowModel.Instance.showCamera.transform);
|
showActor.m_Model.transform.localEulerAngles = showActor.m_Model.transform.localEulerAngles.SetX(0f);
|
}
|
else if (dungeonStage.s_BossNpcId == showActor.npcId)
|
{
|
var mountPoint = showActor.m_Model.transform.GetChildTransformDeeply("A_Stun");
|
HeadUpStorySign.Display(mountPoint, BossShowModel.Instance.showCamera);
|
}
|
}
|
}
|
|
if (exclaimed && timer > monsterRunTime)
|
{
|
for (int i = 0; i < showActors.Count; i++)
|
{
|
var showActor = showActors[i];
|
if (showActor.m_Model != null)
|
{
|
if (dungeonStage.s_MonsterNpcId == showActor.npcId)
|
{
|
var cameraPosition = BossShowModel.Instance.showCamera.transform.position;
|
var monsterPosition = showActor.m_Model.transform.position;
|
var direction = (cameraPosition.SetY(monsterPosition.y) - monsterPosition).normalized;
|
showActor.m_Model.transform.position += direction * monsterMoveSpeed * Time.deltaTime;
|
|
showActor.m_Model.transform.LookAt(BossShowModel.Instance.showCamera.transform);
|
showActor.m_Model.transform.localEulerAngles = showActor.m_Model.transform.localEulerAngles.SetX(0f);
|
}
|
}
|
}
|
}
|
|
if (Time.time > dungeonStage.guardDialogueAbleTime)
|
{
|
for (int i = 0; i < showActors.Count; i++)
|
{
|
var showActor = showActors[i];
|
if (dungeonStage.s_GuardNpcId == showActor.npcId)
|
{
|
dungeonStage.guardDialogueAbleTime = Time.time + GeneralDefine.guardBubbleInterval;
|
var mountPoint = showActor.m_Model.transform.GetChildTransformDeeply("A_Name");
|
|
var index = dungeonStage.guardDialogueIndex % 5 + 1;
|
dungeonStage.guardDialogueIndex++;
|
var content = Language.Get(StringUtility.Contact("BabyDragonWord", index));
|
StoryDialogueBubble.StoryShow(content, mountPoint, BossShowModel.Instance.showCamera);
|
}
|
}
|
}
|
|
}
|
|
public void OnExit()
|
{
|
}
|
|
}
|
|
class KillMonsterStep
|
{
|
GuardDungeonStage dungeonStage;
|
SFXController cageInvincibleEffect;
|
DungeonModel dungeonModel { get { return ModelCenter.Instance.GetModel<DungeonModel>(); } }
|
|
bool guardScaled = false;
|
bool guardAdjustPosition = false;
|
|
public KillMonsterStep(GuardDungeonStage _stage)
|
{
|
dungeonStage = _stage;
|
}
|
|
public void OnEnter()
|
{
|
guardScaled = false;
|
guardAdjustPosition = false;
|
cageInvincibleEffect = null;
|
}
|
|
public void OnUpdate()
|
{
|
var actors = GAMgr.Instance.GetGroupList(E_ActorGroup.Enemy);
|
if (actors == null || PlayerDatas.Instance.hero == null)
|
{
|
return;
|
}
|
|
if (cageInvincibleEffect == null)
|
{
|
for (int i = 0; i < actors.Count; i++)
|
{
|
var actor = actors[i] as GA_NpcClientFightNorm;
|
if (actor != null
|
&& actor.NpcConfig.NPCID == GeneralDefine.guardDungeonCageNPCID)
|
{
|
cageInvincibleEffect = SFXPlayUtility.Instance.PlayBattleEffect(3010, actor, 2f);
|
break;
|
}
|
}
|
}
|
|
if (guardAdjustPosition)
|
{
|
if (dungeonStage.clientGuard != null)
|
{
|
var yoffset = dungeonStage.clientGuard.Pos.y;
|
dungeonStage.clientGuard.Pos = cageInvincibleEffect.transform.position.SetY(yoffset);
|
}
|
}
|
|
if (!guardScaled)
|
{
|
if (dungeonStage.clientGuard != null)
|
{
|
dungeonStage.clientGuard.Root.localScale = Vector3.one * 3;
|
var npcInteractor = dungeonStage.clientGuard.Root.GetComponent<NPCInteractProcessor>();
|
if (npcInteractor != null)
|
{
|
npcInteractor.enabled = false;
|
}
|
guardScaled = true;
|
guardAdjustPosition = true;
|
}
|
}
|
|
for (int i = 0; i < actors.Count; i++)
|
{
|
var actor = actors[i] as GA_NpcClientFightNorm;
|
if (actor == null)
|
{
|
continue;
|
}
|
if (actor.NpcConfig.NPCID == dungeonStage.s_MonsterNpcId && !actor.ActorInfo.serverDie)
|
{
|
if (PlayerDatas.Instance.hero.aiHandler.IsAuto())
|
{
|
PlayerDatas.Instance.hero.SelectTarget = actor;
|
PlayerDatas.Instance.hero.LockTarget = actor;
|
}
|
break;
|
}
|
else if (actor.NpcConfig.NPCID == dungeonStage.s_BossNpcId && !actor.ActorInfo.serverDie)
|
{
|
if (PlayerDatas.Instance.hero.aiHandler.IsAuto())
|
{
|
PlayerDatas.Instance.hero.SelectTarget = actor;
|
PlayerDatas.Instance.hero.LockTarget = actor;
|
}
|
break;
|
}
|
}
|
|
if (Time.time > dungeonStage.guardDialogueAbleTime)
|
{
|
if (dungeonStage.clientGuard != null)
|
{
|
dungeonStage.guardDialogueAbleTime = Time.time + GeneralDefine.guardBubbleInterval;
|
var mountPoint = dungeonStage.clientGuard.MP_Name;
|
|
var index = dungeonStage.guardDialogueIndex % 5 + 1;
|
dungeonStage.guardDialogueIndex++;
|
var content = Language.Get(StringUtility.Contact("BabyDragonWord", index));
|
StoryDialogueBubble.StoryShow(content, mountPoint, CameraController.Instance.CameraObject);
|
}
|
}
|
|
}
|
|
public void OnExit()
|
{
|
if (cageInvincibleEffect != null)
|
{
|
SFXPlayUtility.Instance.Release(cageInvincibleEffect);
|
cageInvincibleEffect = null;
|
}
|
}
|
|
}
|
|
class DestroyCageStep
|
{
|
|
GuardDungeonStage dungeonStage;
|
public DestroyCageStep(GuardDungeonStage _stage)
|
{
|
dungeonStage = _stage;
|
}
|
|
public void OnEnter()
|
{
|
dungeonStage.clientCage.LockHp(0);
|
}
|
|
public void OnUpdate()
|
{
|
if (PlayerDatas.Instance.hero == null)
|
{
|
return;
|
}
|
PlayerDatas.Instance.hero.aiHandler.PriorityNpcID = GeneralDefine.guardDungeonCageNPCID;
|
|
if (Time.time > dungeonStage.guardDialogueAbleTime)
|
{
|
if (dungeonStage.clientGuard != null)
|
{
|
dungeonStage.guardDialogueAbleTime = Time.time + GeneralDefine.guardBubbleInterval;
|
var mountPoint = dungeonStage.clientGuard.MP_Name;
|
|
var index = dungeonStage.guardDialogueIndex % 5 + 1;
|
dungeonStage.guardDialogueIndex++;
|
var content = Language.Get(StringUtility.Contact("BabyDragonWord", index));
|
StoryDialogueBubble.StoryShow(content, mountPoint, CameraController.Instance.CameraObject);
|
}
|
}
|
|
}
|
|
public void OnExit()
|
{
|
|
}
|
|
}
|
|
class GuardDialogueStep
|
{
|
GuardDungeonStage dungeonStage;
|
|
bool autoDialogueSymbol = false;
|
|
HeadUpQuestSign m_QuestSign;
|
|
public GuardDialogueStep(GuardDungeonStage _stage)
|
{
|
dungeonStage = _stage;
|
}
|
|
public void OnEnter()
|
{
|
autoDialogueSymbol = true;
|
|
var playerTaskDatas = ModelCenter.Instance.GetModel<TaskModel>();
|
var questId = playerTaskDatas.currentMission;
|
playerTaskDatas.AutomaticTripToTask(questId);
|
|
if (dungeonStage.clientGuard != null)
|
{
|
var npcInteractor = dungeonStage.clientGuard.Root.GetComponent<NPCInteractProcessor>();
|
if (npcInteractor != null)
|
{
|
npcInteractor.enabled = true;
|
}
|
|
if (m_QuestSign != null)
|
{
|
HeadUpQuestSign.Recycle(m_QuestSign);
|
m_QuestSign = null;
|
}
|
|
m_QuestSign = HeadUpQuestSign.RequireHeadUpQuestSign(HeadUpQuestSign.Pattern.Question, dungeonStage.clientGuard.MP_Name,
|
0, CameraController.Instance.CameraObject);
|
m_QuestSign.SetActive(true);
|
}
|
}
|
|
public void OnUpdate()
|
{
|
if (autoDialogueSymbol)
|
{
|
if (!WindowCenter.Instance.IsOpen<NormalDialogueWin>())
|
{
|
var hero = PlayerDatas.Instance.hero;
|
|
if (hero != null && hero.SkillMgr != null
|
&& hero.SkillMgr.CurCastSkill != null
|
&& hero.SkillMgr.CurCastSkill.SkillCompelete
|
&& dungeonStage.clientGuard != null)
|
{
|
dungeonStage.clientGuard.OnClick();
|
autoDialogueSymbol = false;
|
}
|
}
|
else
|
{
|
autoDialogueSymbol = false;
|
}
|
}
|
}
|
|
public void OnExit()
|
{
|
autoDialogueSymbol = false;
|
if (m_QuestSign != null)
|
{
|
HeadUpQuestSign.Recycle(m_QuestSign);
|
m_QuestSign = null;
|
}
|
}
|
|
}
|
|
class DungeonOver
|
{
|
GuardDungeonStage dungeonStage;
|
float timer = 0f;
|
float transformDuration = 2f;
|
|
Animator m_GuardAnimator;
|
bool m_OnGuardDancing = false;
|
bool m_GuardDanceComplete = false;
|
|
SFXController m_GuardEffect;
|
|
public DungeonOver(GuardDungeonStage _stage)
|
{
|
dungeonStage = _stage;
|
}
|
|
public void OnEnter()
|
{
|
timer = 0f;
|
m_OnGuardDancing = false;
|
m_GuardAnimator = null;
|
m_GuardEffect = null;
|
}
|
|
public void OnUpdate()
|
{
|
timer += Time.deltaTime;
|
|
Transform guard = null;
|
if (dungeonStage.clientGuard != null)
|
{
|
guard = dungeonStage.clientGuard.Root;
|
if (m_GuardAnimator == null)
|
{
|
m_GuardAnimator = dungeonStage.clientGuard.Root.GetComponentInChildren<Animator>();
|
}
|
if (m_GuardEffect == null)
|
{
|
m_GuardEffect = SFXPlayUtility.Instance.PlayBattleEffect(1014, dungeonStage.clientGuard, 1);
|
var mountPoint = guard.GetChildTransformDeeply(GAStaticDefine.MountPointBoneName);
|
m_GuardEffect.duration = 0;
|
m_GuardEffect.transform.SetParent(mountPoint);
|
m_GuardEffect.transform.localPosition = Vector3.zero;
|
}
|
}
|
|
|
if (guard != null)
|
{
|
if (timer < transformDuration)
|
{
|
guard.localScale = Mathf.Lerp(3, 1, timer / transformDuration) * Vector3.one;
|
}
|
else
|
{
|
var hero = PlayerDatas.Instance.hero;
|
if (!m_GuardDanceComplete)
|
{
|
dungeonStage.clientGuard.ReleaseName();
|
SelectionManager.Release(SelectionManager.E_Type.Green);
|
dungeonStage.clientGuard.ReleaseShadow();
|
GuardDancing();
|
return;
|
}
|
if (hero != null && MathUtility.CalDistance(guard.transform.position, hero.Root.position) > 1.0f)
|
{
|
guard.LookAt(new Vector3(hero.Root.position.x, hero.Root.position.y + 0.5f, hero.Root.position.z));
|
guard.Translate(Vector3.forward * hero.ActorInfo.moveSpeed * Time.deltaTime);
|
}
|
}
|
}
|
}
|
|
public void GuardDancing()
|
{
|
var hero = PlayerDatas.Instance.hero;
|
if (hero != null && dungeonStage.clientGuard != null)
|
{
|
var nextPosition = hero.Root.position + hero.Root.right.normalized * 0.6f - hero.Forward.normalized * 0.3f;
|
nextPosition.y = hero.Root.position.y + 1.0f;
|
var dis = Vector3.Distance(nextPosition, dungeonStage.clientGuard.Root.position);
|
if (dis > 0.1f)
|
{
|
dungeonStage.clientGuard.Forward = nextPosition - dungeonStage.clientGuard.Root.position;
|
var deltapos = Vector3.Lerp(dungeonStage.clientGuard.Root.position, nextPosition, hero.ActorInfo.moveSpeed * Time.deltaTime);
|
dungeonStage.clientGuard.Root.position = deltapos;
|
}
|
else
|
{
|
if (!m_OnGuardDancing && dungeonStage.clientGuard.NextAction != GA_Guard.GuardAction_Dance2)
|
{
|
dungeonStage.clientGuard.Forward = hero.Forward;
|
dungeonStage.clientGuard.NextAction = GA_Guard.GuardAction_Dance2;
|
m_OnGuardDancing = true;
|
}
|
else if (m_OnGuardDancing && m_GuardAnimator.GetCurrentAnimatorStateInfo(0).normalizedTime > 0.90f
|
&& !m_GuardAnimator.IsInTransition(0))
|
{
|
dungeonStage.clientGuard.NextAction = GA_Guard.GuardAction_Run;
|
m_GuardDanceComplete = true;
|
}
|
}
|
}
|
else
|
{
|
m_GuardDanceComplete = true;
|
}
|
}
|
|
public void OnExit()
|
{
|
if (m_GuardEffect != null)
|
{
|
SFXPlayUtility.Instance.Release(m_GuardEffect);
|
m_GuardEffect = null;
|
}
|
}
|
}
|
|
enum Step
|
{
|
None = -1,
|
BossShow = 0,
|
KillMonster = 1,
|
DestroyCage = 2,
|
GuardDialogue = 3,
|
Over = 4,
|
}
|
|
}
|