Created
January 14, 2018 05:32
-
-
Save james7132/099d3111c8ab5924827e72a404d8ecda to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Decompiled with JetBrains decompiler | |
// Type: LevelSceneControl.Level4_1 | |
// Assembly: Assembly-CSharp, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null | |
// MVID: 349C91EF-FE4B-4E7F-8069-612CB2657429 | |
// Assembly location: D:\Steam Games\steamapps\common\The Disappearing of Gensokyo\The Disappearing of Gensokyo_Data\Managed\Assembly-CSharp.dll | |
using GameEvents; | |
using PS4; | |
using System; | |
using System.Collections; | |
using System.Collections.Generic; | |
using System.Diagnostics; | |
using UnityEngine; | |
using UnityEngine.Events; | |
namespace LevelSceneControl | |
{ | |
public class Level4_1 : LevelSettingBase | |
{ | |
private List<Level4_1.Stage> _stages = new List<Level4_1.Stage>(); | |
private List<AIAgent> _friendForcesUnits = new List<AIAgent>(); | |
[Header("===========stage1===========")] | |
public float S1_Delay = 0.5f; | |
private int _stageIndex; | |
private ColliderListener RocketCircleListener; | |
[Header("=====Level4_1=======")] | |
public CapsuleCollider RocketCircle; | |
public Unit Rocket; | |
public DamageData damage; | |
public Animator RocketAnim; | |
public Animator camareAnim; | |
public List<GameObject> PieceList; | |
public AudioSource unitExplosiveAudio; | |
public AudioSource NpcRemiliaDisappearSound; | |
public SetDialogue S1_Dia; | |
public GameObject NPCRemilia; | |
private float _s1DelayTimer; | |
private bool _s1DialogueFlag; | |
private Level4_1.Stage _currentStage; | |
private Vector3 _s1_DialogueRotation; | |
[Header("===========stage2===========")] | |
public CreepsSpawnTrigger S2_Spawn; | |
public Mission_Kill S2_Kill; | |
[Header("===========stage3===========")] | |
public SetDialogue S3_Dia; | |
public CreepsSpawnTrigger S3_FriendlyForces; | |
public List<WaveData> S3_WaveData; | |
public CheckPoint S3_checkPoint; | |
private bool _s3_waveFlag; | |
private float _s3_waveTimer; | |
private List<AIAgent> _s3_waveApplyUnits; | |
[Header("===========stage4===========")] | |
public WaveData S4_UpWave; | |
public WaveData S4_DRWave; | |
public WaveData S4_DLWave; | |
public WaveData S4_UpFriendWave; | |
public WaveData S4_DRFriendWave; | |
public WaveData S4_DLFriendWave; | |
public Mission_Guard S4_Gauard; | |
public SetDialogue S4_DialogBoss; | |
public Mission_Explore S4_Expore; | |
public List<Level4_1.GobackData> S4_Friend_Gobacks; | |
private Level4_1.Stage4Process _s4_process; | |
private List<AIAgent> S4_bossWaveUnits; | |
private List<Level4_1.GobackData> _s4_Friend_GObacks; | |
private int _s4_transportNumber; | |
private int _s4_transportCount; | |
private bool _s4_exporeFlag; | |
[Header("===========stage5===========")] | |
public CreepsSpawnTrigger S5_BossSpawn; | |
public Mission_Explore S5_FinishExplore; | |
public SetDialogue S5_finishDialog; | |
public Mission_Kill S5_KillBossWave; | |
public float S5_finishDialogDealy; | |
public GameObject audioListenerPlayer; | |
public GameObject audioListenerCamera; | |
private Level4_1.CheckData _checkData; | |
private void ContinueModelInit() | |
{ | |
this._checkData = CheckPointSystem.instance.GetUserData() as Level4_1.CheckData; | |
List<int> intList = this._checkData.frendForceState; | |
Dictionary<int, bool> map = new Dictionary<int, bool>(); | |
for (int index = this.S3_FriendlyForces.creepList.Count - 1; index >= 0; --index) | |
{ | |
if (!intList.Contains(index)) | |
{ | |
map[index] = false; | |
} | |
else | |
{ | |
this._friendForcesUnits.Add(this.S3_FriendlyForces.creepList[index]); | |
map[index] = true; | |
} | |
} | |
this.S3_FriendlyForces.SetEnableMap(map); | |
this._stageIndex = 3; | |
this.S3_FriendlyForces.gameObject.SetActive(true); | |
this.S3_FriendlyForces.enabled = true; | |
this.S3_FriendlyForces.Spawn(); | |
this.Rocket.gameObject.SetActive(true); | |
this.Rocket.SetHp(this._checkData.rocketHp); | |
} | |
private void StartModelInit() | |
{ | |
this._stageIndex = 0; | |
} | |
private void Start() | |
{ | |
this.RocketCircleListener = ColliderListener.Get(this.RocketCircle.gameObject); | |
this.RocketCircleListener.onTriggerEnter = new ColliderListener.VoidDelegate(this.RocketCircleEnterCallback); | |
Level4_1.Stage stage1 = this.initStage1(); | |
Level4_1.Stage stage2 = this.initStage2(); | |
Level4_1.Stage stage3 = this.initStage3(); | |
Level4_1.Stage stage4 = this.initStage4(); | |
Level4_1.Stage stage5 = this.initStage5(); | |
this._stages.Add(stage1); | |
this._stages.Add(stage2); | |
this._stages.Add(stage3); | |
this._stages.Add(stage4); | |
this._stages.Add(stage5); | |
if (PlayerData.GetGameRank() == Difficulty.Lunatic) | |
{ | |
this.StartModelInit(); | |
} | |
else | |
{ | |
switch (this.GetLevelEnterState()) | |
{ | |
case LevelSceneManager.LevelStartUpState.Start: | |
this.StartModelInit(); | |
break; | |
case LevelSceneManager.LevelStartUpState.Continue: | |
this.ContinueModelInit(); | |
break; | |
default: | |
this.StartModelInit(); | |
break; | |
} | |
} | |
this._currentStage = this._stages[this._stageIndex]; | |
this._currentStage.onEnter(); | |
} | |
private void Update() | |
{ | |
this._friendForcesUnits.RemoveAll((Predicate<AIAgent>) (x => | |
{ | |
if ((bool) ((UnityEngine.Object) x.thisUnit)) | |
return !x.thisUnit.isAlive; | |
return true; | |
})); | |
if (this._currentStage == null || this._currentStage.update == null) | |
return; | |
this._currentStage.update(); | |
} | |
private void RocketCircleEnterCallback(Collider other) | |
{ | |
Unit component = other.gameObject.GetComponent<Unit>(); | |
if ((UnityEngine.Object) component == (UnityEngine.Object) null || !IFF.IsEnemy(component.unitForce, PlayerSystem.instance.GetPlayerUnit().unitForce)) | |
return; | |
Vector3 vector3 = component.transform.position - this.Rocket.transform.position; | |
double num = (double) DamageSystem.UnitDamageTarget(component, this.Rocket, this.damage, component.transform.position, vector3.normalized, 0.0f, true, true); | |
component.Kill((Unit) null, 800f, component.transform.position, Vector3.up, 0.0f); | |
EffectSystem.CreateEffect(EffectType.MarisaBombExp, component.attachPoints.chest.position, Quaternion.LookRotation(Vector3.up)); | |
EffectSystem.CreateEffect(EffectType.RockExp, this.Rocket.attachPoints.chest.position, Quaternion.identity); | |
AudioManager.instance.AudioPlay(component.attachPoints.chest.gameObject, this.unitExplosiveAudio); | |
CameraSystem.instance.StartCameraShock(); | |
} | |
private void MoveNextStage() | |
{ | |
++this._stageIndex; | |
if (this._stageIndex < this._stages.Count) | |
{ | |
this._currentStage = this._stages[this._stageIndex]; | |
this._currentStage.onEnter(); | |
} | |
else | |
this._currentStage = (Level4_1.Stage) null; | |
} | |
private Level4_1.Stage initStage1() | |
{ | |
return new Level4_1.Stage() | |
{ | |
onEnter = new Action(this.Stage1Enter), | |
update = new Action(this.Stage1Update), | |
onExit = new Action(this.Stage1Exit) | |
}; | |
} | |
private void Stage1Enter() | |
{ | |
this._s1DelayTimer = 0.0f; | |
this._s1DialogueFlag = false; | |
UI_Controller.instance.uiBossInfo.isShow = false; | |
this.S1_Dia.DialogueDone.AddListener(new UnityAction(this.Stage1Exit)); | |
} | |
private void Stage1Update() | |
{ | |
this._s1DelayTimer += Time.deltaTime; | |
if ((double) this._s1DelayTimer >= (double) this.S1_Delay && !this._s1DialogueFlag) | |
{ | |
this._s1DialogueFlag = true; | |
this._s1_DialogueRotation = PlayerSystem.instance.transform.position - this.NPCRemilia.transform.position; | |
this.S1_Dia.SendDialogue(); | |
} | |
if (!this._s1DialogueFlag) | |
return; | |
float num = 20f; | |
this.NPCRemilia.transform.rotation = Quaternion.Lerp(this.NPCRemilia.transform.rotation, Quaternion.LookRotation(this._s1_DialogueRotation), Time.deltaTime * num); | |
Quaternion quaternion = Quaternion.LookRotation(-this._s1_DialogueRotation); | |
PlayerSystem.instance.GetMainCharacterSystem2().SetTargetRotation(quaternion); | |
PlayerSystem.instance.transform.rotation = Quaternion.Lerp(PlayerSystem.instance.transform.rotation, quaternion, Time.deltaTime * num); | |
} | |
private void Stage1Exit() | |
{ | |
UI_Controller.instance.uiBossInfo.isShow = true; | |
this.RocketCircle.gameObject.GetComponent<ParticleSystem>().Play(); | |
this.NPCRemilia.GetComponent<Animator>().CrossFade("Blink", 0.5f); | |
EffectSystem.CreateEffect(EffectType.BossRemiliaBatDisappear, this.NPCRemilia.transform.position + new Vector3(0.0f, 1.2f, 0.0f), Quaternion.identity); | |
AudioManager.instance.AudioPlay(this.NPCRemilia.gameObject, this.NpcRemiliaDisappearSound); | |
TimerManager.NewTimer(1f, (Action) (() => this.NPCRemilia.gameObject.SetActive(false)), 1, true, true); | |
this.MoveNextStage(); | |
} | |
private Level4_1.Stage initStage2() | |
{ | |
Mission_Kill missionKill = this.S2_Kill; | |
Mission.OnMissionComplete onMissionComplete = missionKill.onMissionComplete + new Mission.OnMissionComplete(this.Stage2Exit); | |
missionKill.onMissionComplete = onMissionComplete; | |
return new Level4_1.Stage() | |
{ | |
onEnter = new Action(this.Stage2Enter), | |
update = new Action(this.Stage2Update), | |
onExit = new Action(this.Stage2Exit) | |
}; | |
} | |
private void Stage2Enter() | |
{ | |
this.S2_Spawn.Spawn(); | |
} | |
private void Stage2Update() | |
{ | |
} | |
private void Stage2Exit() | |
{ | |
this.MoveNextStage(); | |
} | |
private Level4_1.Stage initStage3() | |
{ | |
for (int index = 0; index < this.S3_WaveData.Count; ++index) | |
this.S3_WaveData[index].init(); | |
this.S3_checkPoint.enabled = false; | |
Collider component = this.S3_checkPoint.GetComponent<Collider>(); | |
component.isTrigger = false; | |
component.enabled = false; | |
return new Level4_1.Stage() | |
{ | |
onEnter = new Action(this.Stage3Enter), | |
update = new Action(this.Stage3Update), | |
onExit = new Action(this.Stage3Exit) | |
}; | |
} | |
private void Stage3Enter() | |
{ | |
this._s3_waveFlag = false; | |
UI_Controller.instance.uiBossInfo.isShow = true; | |
this._friendForcesUnits.AddRange((IEnumerable<AIAgent>) this.S3_FriendlyForces.creepList); | |
this._s3_waveApplyUnits = new List<AIAgent>(); | |
this.S3_Dia.SendDialogue(); | |
this.S3_Dia.DialogueDone.AddListener(new UnityAction(this.Stage3StartWave)); | |
} | |
private void Stage3Update() | |
{ | |
if (!this._s3_waveFlag) | |
return; | |
this._s3_waveTimer += Time.deltaTime; | |
for (int index = 0; index < this.S3_WaveData.Count; ++index) | |
{ | |
if (!this.S3_WaveData[index].flag && (double) this._s3_waveTimer >= (double) this.S3_WaveData[index].waveTime) | |
{ | |
this.S3_WaveData[index].ApplyWave(); | |
this._s3_waveApplyUnits.AddRange((IEnumerable<AIAgent>) this.S3_WaveData[index].units); | |
} | |
} | |
this._s3_waveApplyUnits.RemoveAll((Predicate<AIAgent>) (x => | |
{ | |
if (!((UnityEngine.Object) x.thisUnit == (UnityEngine.Object) null)) | |
return !x.thisUnit.isAlive; | |
return true; | |
})); | |
bool flag = true; | |
for (int index = 0; index < this.S3_WaveData.Count; ++index) | |
{ | |
if (!this.S3_WaveData[index].flag) | |
{ | |
flag = false; | |
break; | |
} | |
} | |
if (!flag || this._s3_waveApplyUnits.Count != 0) | |
return; | |
this.Stage3Exit(); | |
} | |
private void Stage3Exit() | |
{ | |
this.S3_checkPoint.ActiveCheckPoint(false); | |
List<int> intList = new List<int>(); | |
for (int index = 0; index < this._friendForcesUnits.Count; ++index) | |
{ | |
if (this._friendForcesUnits[index].thisUnit.isAlive) | |
intList.Add(index); | |
} | |
this._checkData = new Level4_1.CheckData() | |
{ | |
frendForceState = intList, | |
rocketHp = this.Rocket.GetHp() | |
}; | |
if (PlayerData.GetGameRank() != Difficulty.Lunatic) | |
CheckPointSystem.instance.SetCheckPoint(this.S3_checkPoint, (object) this._checkData); | |
this.MoveNextStage(); | |
} | |
private void Stage3StartWave() | |
{ | |
this.S3_FriendlyForces.Spawn(); | |
this._s3_waveFlag = true; | |
} | |
private Level4_1.Stage initStage4() | |
{ | |
this.S4_Expore.onMissionComplete = new Mission.OnMissionComplete(this.Stage4ExporeCompelet); | |
this.S4_DialogBoss.DialogueDone.AddListener(new UnityAction(this.Stage4Exit)); | |
this.S4_bossWaveUnits = new List<AIAgent>(); | |
this.S4_UpFriendWave.init(); | |
this.S4_DRFriendWave.init(); | |
this.S4_DLFriendWave.init(); | |
this.S4_UpWave.init(); | |
this.S4_DRWave.init(); | |
this.S4_DLWave.init(); | |
return new Level4_1.Stage() | |
{ | |
onEnter = new Action(this.Stage4Enter), | |
update = new Action(this.Stage4Update), | |
onExit = new Action(this.Stage4Exit) | |
}; | |
} | |
private void Stage4Enter() | |
{ | |
this.NPCRemilia.gameObject.SetActive(false); | |
this._s4_transportCount = 0; | |
this._s4_exporeFlag = false; | |
UI_Controller.instance.uiBossInfo.isShow = true; | |
this.S4_UpFriendWave.ApplyWave(); | |
this.S4_DRFriendWave.ApplyWave(); | |
this.S4_DLFriendWave.ApplyWave(); | |
this.S4_UpWave.ApplyWave(); | |
this.S4_DRWave.ApplyWave(); | |
this.S4_DLWave.ApplyWave(); | |
this.S4_bossWaveUnits.AddRange((IEnumerable<AIAgent>) this.S4_UpWave.units); | |
this.S4_bossWaveUnits.AddRange((IEnumerable<AIAgent>) this.S4_DRWave.units); | |
this.S4_bossWaveUnits.AddRange((IEnumerable<AIAgent>) this.S4_DLWave.units); | |
this._s4_process = Level4_1.Stage4Process.BossWave; | |
} | |
private void Stage4Update() | |
{ | |
switch (this._s4_process) | |
{ | |
case Level4_1.Stage4Process.BossWave: | |
this.Stage4OnBossWave(); | |
break; | |
case Level4_1.Stage4Process.Retreat: | |
this.Stage4OnRetreat(); | |
break; | |
} | |
} | |
private void Stage4OnBossWave() | |
{ | |
this.S4_bossWaveUnits.RemoveAll((Predicate<AIAgent>) (x => | |
{ | |
if (!((UnityEngine.Object) x.thisUnit == (UnityEngine.Object) null)) | |
return !x.thisUnit.isAlive; | |
return true; | |
})); | |
if (this.S4_bossWaveUnits.Count != 0) | |
return; | |
this.S4_Gauard.Complete(); | |
this.Stage4FriendForcesGoback(); | |
this._s4_process = Level4_1.Stage4Process.Retreat; | |
} | |
private void Stage4OnRetreat() | |
{ | |
for (int index = this._s4_Friend_GObacks.Count - 1; index >= 0; --index) | |
{ | |
Level4_1.GobackData gobackData = this._s4_Friend_GObacks[index]; | |
Vector3 vector3 = gobackData.mover.transform.position - gobackData.target.position; | |
vector3.y = 0.0f; | |
if ((double) vector3.sqrMagnitude <= 1.0) | |
{ | |
this._s4_Friend_GObacks.RemoveAt(index); | |
this.StartCoroutine(this.TransportFirendForece(gobackData.mover, gobackData.indxe)); | |
} | |
} | |
if (this._s4_transportCount != this._s4_transportNumber || !this._s4_exporeFlag) | |
return; | |
this._s4_process = Level4_1.Stage4Process.BossDialogue; | |
this.StartCoroutine(this.Stage4DialogueBoss()); | |
} | |
[DebuggerHidden] | |
private IEnumerator Stage4DialogueBoss() | |
{ | |
// ISSUE: object of a compiler-generated type is created | |
return (IEnumerator) new Level4_1.\u003CStage4DialogueBoss\u003Ec__Iterator0() | |
{ | |
\u0024this = this | |
}; | |
} | |
private void Stage4FriendForcesGoback() | |
{ | |
this._s4_Friend_GObacks = new List<Level4_1.GobackData>(); | |
// ISSUE: object of a compiler-generated type is created | |
// ISSUE: variable of a compiler-generated type | |
Level4_1.\u003CStage4FriendForcesGoback\u003Ec__AnonStorey3 gobackCAnonStorey3 = new Level4_1.\u003CStage4FriendForcesGoback\u003Ec__AnonStorey3(); | |
// ISSUE: reference to a compiler-generated field | |
gobackCAnonStorey3.\u0024this = this; | |
// ISSUE: reference to a compiler-generated field | |
// ISSUE: reference to a compiler-generated field | |
// ISSUE: reference to a compiler-generated field | |
// ISSUE: reference to a compiler-generated field | |
for (gobackCAnonStorey3.i = 0; gobackCAnonStorey3.i < this._friendForcesUnits.Count; gobackCAnonStorey3.i = gobackCAnonStorey3.i + 1) | |
{ | |
// ISSUE: reference to a compiler-generated method | |
Level4_1.GobackData gobackData = this.S4_Friend_Gobacks.Find(new Predicate<Level4_1.GobackData>(gobackCAnonStorey3.\u003C\u003Em__0)); | |
if (gobackData != null) | |
{ | |
// ISSUE: reference to a compiler-generated field | |
this._friendForcesUnits[gobackCAnonStorey3.i].IssueCommand(AiCommand.ForcedMove, (object) gobackData.target.position); | |
// ISSUE: reference to a compiler-generated field | |
// ISSUE: reference to a compiler-generated field | |
this._s4_Friend_GObacks.Add(new Level4_1.GobackData() | |
{ | |
mover = this._friendForcesUnits[gobackCAnonStorey3.i], | |
target = gobackData.target, | |
indxe = gobackCAnonStorey3.i | |
}); | |
} | |
} | |
this._s4_transportNumber = this._s4_Friend_GObacks.Count; | |
} | |
private void Stage4ExporeCompelet() | |
{ | |
this._s4_exporeFlag = true; | |
} | |
[DebuggerHidden] | |
private IEnumerator TransportFirendForece(AIAgent agent, int index) | |
{ | |
// ISSUE: object of a compiler-generated type is created | |
return (IEnumerator) new Level4_1.\u003CTransportFirendForece\u003Ec__Iterator1() | |
{ | |
agent = agent, | |
index = index, | |
\u0024this = this | |
}; | |
} | |
private void Stage4Exit() | |
{ | |
this._s4_process = Level4_1.Stage4Process.Done; | |
this.MoveNextStage(); | |
} | |
private Level4_1.Stage initStage5() | |
{ | |
return new Level4_1.Stage() | |
{ | |
onEnter = new Action(this.Stage5Enter), | |
update = new Action(this.Stage5Update), | |
onExit = new Action(this.Stage5Exit) | |
}; | |
} | |
private void Stage5Enter() | |
{ | |
this.Rocket.armorType = ArmorType.INVULNERABLE; | |
this.Rocket.meleeDamageReduce = 1f; | |
this.Rocket.rangedDamagedReduce = 1f; | |
this.Rocket.explosiveDamageReduce = 1f; | |
this.RocketCircle.gameObject.SetActive(false); | |
this.RocketCircleListener.onTriggerEnter = (ColliderListener.VoidDelegate) null; | |
UI_Controller.instance.uiBossInfo.isShow = false; | |
this.S5_FinishExplore.onMissionComplete = new Mission.OnMissionComplete(this.Stage5FinishExplorDone); | |
this.S5_KillBossWave.onMissionComplete = new Mission.OnMissionComplete(this.Stage5Exit); | |
this.S5_BossSpawn.Spawn(); | |
} | |
private void Stage5Update() | |
{ | |
} | |
private void Stage5Exit() | |
{ | |
GameEventSystem.Instance.InvokeEvent<MissionEvent>(MissionEvent.KillNue, (object) null); | |
TimerManager.NewTimer(this.S5_finishDialogDealy, (Action) (() => this.S5_finishDialog.SendDialogue()), 0, true, true); | |
} | |
private void Stage5FinishExplorDone() | |
{ | |
UI_Controller.instance.uiReport.delayTime = 14f; | |
this.StartCoroutine(this.GameEndAnim()); | |
} | |
[DebuggerHidden] | |
private IEnumerator GameEndAnim() | |
{ | |
// ISSUE: object of a compiler-generated type is created | |
return (IEnumerator) new Level4_1.\u003CGameEndAnim\u003Ec__Iterator2() | |
{ | |
\u0024this = this | |
}; | |
} | |
public override void initSetting() | |
{ | |
base.initSetting(); | |
} | |
protected override void OnPieceReplaceCallBack(ItemPiece.ReplacePieceEventData eventData) | |
{ | |
this.PieceList[this.PieceList.IndexOf(eventData.pice.gameObject)] = eventData.NewObj; | |
} | |
private class Stage | |
{ | |
public Action onEnter; | |
public Action update; | |
public Action onExit; | |
} | |
[Serializable] | |
public class GobackData | |
{ | |
public int indxe; | |
public AIAgent mover; | |
public Transform target; | |
} | |
private enum Stage4Process | |
{ | |
BossWave, | |
Retreat, | |
BossDialogue, | |
Done, | |
} | |
public class CheckData | |
{ | |
public List<int> frendForceState; | |
public float rocketHp; | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment