669 lines
21 KiB
C#
669 lines
21 KiB
C#
|
|
using BX;
|
|||
|
|
using Config.config;
|
|||
|
|
using DG.Tweening;
|
|||
|
|
using UnityEngine;
|
|||
|
|
using UnityEngine.Rendering.PostProcessing;
|
|||
|
|
|
|||
|
|
/// <summary>
|
|||
|
|
/// <20><>Ϸ<EFBFBD><CFB7><EFBFBD><EFBFBD>
|
|||
|
|
/// </summary>
|
|||
|
|
public class GameScene : MonoBehaviour
|
|||
|
|
{
|
|||
|
|
/// <summary>
|
|||
|
|
/// <20><><EFBFBD>ճ<EFBFBD><D5B3><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
|
/// </summary>
|
|||
|
|
[HideInInspector] public int judgmentOvertakingNumber;
|
|||
|
|
|
|||
|
|
/// <summary>
|
|||
|
|
/// <20>ڹؿ<DAB9><D8BF>ڿ<EFBFBD><DABF><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
|
/// </summary>
|
|||
|
|
public int adNumber;
|
|||
|
|
|
|||
|
|
/// <summary>
|
|||
|
|
/// ʹ<>ü<EFBFBD><C3BC>ܴ<EFBFBD><DCB4><EFBFBD>
|
|||
|
|
/// </summary>
|
|||
|
|
public int useSkillNumber;
|
|||
|
|
|
|||
|
|
/// <summary>
|
|||
|
|
/// <20><>Ϸʱ<CFB7><CAB1>
|
|||
|
|
/// </summary>
|
|||
|
|
public float levelTime;
|
|||
|
|
|
|||
|
|
/// <summary>
|
|||
|
|
/// <20><>¼<EFBFBD><C2BC><EFBFBD>ճ<EFBFBD><D5B3><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
|
/// </summary>
|
|||
|
|
private int recordJudgmentOvertakingNumbe;
|
|||
|
|
|
|||
|
|
/// <summary>
|
|||
|
|
/// <20>ܳ<EFBFBD><DCB3><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
|
/// </summary>
|
|||
|
|
[HideInInspector] public int totaiJudgmentOvertakingNumbe;
|
|||
|
|
|
|||
|
|
/// <summary>
|
|||
|
|
/// ײ<><D7B2><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
|
/// </summary>
|
|||
|
|
private int carAccidentNumber;
|
|||
|
|
|
|||
|
|
/// <summary>
|
|||
|
|
/// NPC<50><43><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ٶ<EFBFBD>
|
|||
|
|
/// </summary>
|
|||
|
|
[HideInInspector] public float npcLaneChangeSpeed;
|
|||
|
|
|
|||
|
|
/// <summary>
|
|||
|
|
/// <20><><EFBFBD><EFBFBD><EFBFBD>ƶ<EFBFBD><C6B6>ٶ<EFBFBD>
|
|||
|
|
/// </summary>
|
|||
|
|
[HideInInspector] public float trainMoveSpeed;
|
|||
|
|
|
|||
|
|
/// <summary>
|
|||
|
|
/// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
|
/// </summary>
|
|||
|
|
[HideInInspector] public float flashingLightNumber;
|
|||
|
|
|
|||
|
|
/// <summary>
|
|||
|
|
/// <20><>ʻ<EFBFBD><CABB><EFBFBD><EFBFBD>
|
|||
|
|
/// </summary>
|
|||
|
|
private float operatingRange;
|
|||
|
|
|
|||
|
|
/// <summary>
|
|||
|
|
/// <20>ܷ<EFBFBD>
|
|||
|
|
/// </summary>
|
|||
|
|
private float totalScore;
|
|||
|
|
|
|||
|
|
/// <summary>
|
|||
|
|
/// <20><>ʻ<EFBFBD><CABB><EFBFBD><EFBFBD><EFBFBD>÷<EFBFBD>
|
|||
|
|
/// </summary>
|
|||
|
|
private float operatingRangeScore;
|
|||
|
|
|
|||
|
|
/// <summary>
|
|||
|
|
/// <20><><EFBFBD>ճ<EFBFBD><D5B3><EFBFBD><EFBFBD>÷<EFBFBD>
|
|||
|
|
/// </summary>
|
|||
|
|
private float dangerousOvertakingScore;
|
|||
|
|
|
|||
|
|
/// <summary>
|
|||
|
|
/// <20>ӵ<EFBFBD>ʱ<EFBFBD><CAB1>ʱ<EFBFBD><CAB1>
|
|||
|
|
/// </summary>
|
|||
|
|
private float speedbreakerTime;
|
|||
|
|
|
|||
|
|
|
|||
|
|
/// <summary>
|
|||
|
|
/// <20>յ<EFBFBD>
|
|||
|
|
/// </summary>
|
|||
|
|
private float endPos;
|
|||
|
|
|
|||
|
|
/// <summary>
|
|||
|
|
/// <20>Ƿ<EFBFBD><C7B7>ӵ<EFBFBD>ʱ<EFBFBD><CAB1>
|
|||
|
|
/// </summary>
|
|||
|
|
public bool isSpeedbreaker;
|
|||
|
|
|
|||
|
|
/// <summary>
|
|||
|
|
/// <20>Ƿ<EFBFBD><C7B7><EFBFBD>ͣ
|
|||
|
|
/// </summary>
|
|||
|
|
public bool isSuspend;
|
|||
|
|
|
|||
|
|
/// <summary>
|
|||
|
|
/// <20><><EFBFBD><EFBFBD>
|
|||
|
|
/// </summary>
|
|||
|
|
private Player player;
|
|||
|
|
|
|||
|
|
/// <summary>
|
|||
|
|
/// <20>ؿ<EFBFBD><D8BF><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
|
/// </summary>
|
|||
|
|
private LevelConfig levelConfig;
|
|||
|
|
|
|||
|
|
/// <summary>
|
|||
|
|
/// <20><>ͼ<EFBFBD><CDBC><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
|
/// </summary>
|
|||
|
|
public MapManager mapManager;
|
|||
|
|
|
|||
|
|
/// <summary>
|
|||
|
|
/// <20>յ<EFBFBD>
|
|||
|
|
/// </summary>
|
|||
|
|
private GameObject end;
|
|||
|
|
|
|||
|
|
/// <summary>
|
|||
|
|
/// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
|
/// </summary>
|
|||
|
|
private PostProcessVolume postProcessVolume;
|
|||
|
|
|
|||
|
|
/// <summary>
|
|||
|
|
/// ģ<><C4A3>Tween
|
|||
|
|
/// </summary>
|
|||
|
|
private Tween blurEffectTween;
|
|||
|
|
|
|||
|
|
private void Awake()
|
|||
|
|
{
|
|||
|
|
Scenes.Instance.gameScene = this;
|
|||
|
|
mapManager = Instantiate(YooAssetManager.Instance.LoadAssetSync<GameObject>(PackagesName.GameData, "MapManager")).GetComponent<MapManager>();
|
|||
|
|
SetLevelConfig(UserDataManager.Instance.userData.level);
|
|||
|
|
mapManager.Init();
|
|||
|
|
GetChromaticAberration();
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
private void Start()
|
|||
|
|
{
|
|||
|
|
Init();
|
|||
|
|
PlayGame();
|
|||
|
|
mapManager.SetPlayer(player);
|
|||
|
|
mapManager.InitGenerateNPCCar();
|
|||
|
|
if (UserDataManager.Instance.userData.guidance.isOverInitialEntry)
|
|||
|
|
{
|
|||
|
|
GenerateEnd(levelConfig.End);
|
|||
|
|
}
|
|||
|
|
SetJudgmentOvertakingNumber();
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
private void FixedUpdate()
|
|||
|
|
{
|
|||
|
|
SetNumericalValue();
|
|||
|
|
SetOperatingRange();
|
|||
|
|
UIManager.Instance.GetUI<GameUI>()?.SetTotalScore(totalScore);
|
|||
|
|
Speedbreaker();
|
|||
|
|
SetLevelTime();
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
/// <summary>
|
|||
|
|
/// <20><>¼<EFBFBD>ؿ<EFBFBD>ʱ<EFBFBD><CAB1>
|
|||
|
|
/// </summary>
|
|||
|
|
private void SetLevelTime()
|
|||
|
|
{
|
|||
|
|
if(Scenes.Instance.e_GameState==E_GameState.Gameing)
|
|||
|
|
{
|
|||
|
|
levelTime += Time.deltaTime;
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
/// <summary>
|
|||
|
|
/// <20><>ʼ<EFBFBD><CABC>
|
|||
|
|
/// </summary>
|
|||
|
|
private void Init()
|
|||
|
|
{
|
|||
|
|
levelTime = 0;
|
|||
|
|
adNumber = 0;
|
|||
|
|
useSkillNumber = 0;
|
|||
|
|
AudioManager.Instance.SetBackgroundMusic(YooAssetManager.Instance.LoadAssetSync<AudioClip>(PackagesName.GameData, "GameBGM_" + Random.Range(1, 4)));
|
|||
|
|
trainMoveSpeed = GameNumericalValue.TrainMoveSpeed;
|
|||
|
|
npcLaneChangeSpeed = GameNumericalValue.NpcLaneChangeSpeed;
|
|||
|
|
flashingLightNumber = GameNumericalValue.FlashingLightNumber;
|
|||
|
|
operatingRangeScore = 0;
|
|||
|
|
dangerousOvertakingScore = 0;
|
|||
|
|
totalScore = 0;
|
|||
|
|
carAccidentNumber = 0;
|
|||
|
|
totaiJudgmentOvertakingNumbe = 0;
|
|||
|
|
speedbreakerTime = 0;
|
|||
|
|
ResetSpeedbreaker();
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
/// <summary>
|
|||
|
|
/// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ֵ
|
|||
|
|
/// </summary>
|
|||
|
|
private void SetNumericalValue()
|
|||
|
|
{
|
|||
|
|
if (Scenes.Instance.e_GameState == E_GameState.Gameing)
|
|||
|
|
{
|
|||
|
|
npcLaneChangeSpeed -= Time.deltaTime * 0.01f;
|
|||
|
|
npcLaneChangeSpeed = Mathf.Clamp(npcLaneChangeSpeed, 0.3f, GameNumericalValue.NpcLaneChangeSpeed);
|
|||
|
|
trainMoveSpeed += Time.deltaTime * 0.01f;
|
|||
|
|
trainMoveSpeed = Mathf.Clamp(trainMoveSpeed, GameNumericalValue.TrainMoveSpeed, 25);
|
|||
|
|
flashingLightNumber -= Time.deltaTime * 0.015f;
|
|||
|
|
flashingLightNumber = Mathf.Clamp(flashingLightNumber, 4, 6);
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
/// <summary>
|
|||
|
|
/// <20>õ<EFBFBD><C3B5><EFBFBD>Ļģ<C4BB><C4A3>Ч<EFBFBD><D0A7>
|
|||
|
|
/// </summary>
|
|||
|
|
private void GetChromaticAberration()
|
|||
|
|
{
|
|||
|
|
PostProcessVolume[] postProcessVolume = Camera.main.GetComponents<PostProcessVolume>();
|
|||
|
|
for (int i = 0; i < postProcessVolume.Length; i++)
|
|||
|
|
{
|
|||
|
|
if (postProcessVolume[i].profile.TryGetSettings<ChromaticAberration>(out ChromaticAberration outSetting))
|
|||
|
|
{
|
|||
|
|
this.postProcessVolume = postProcessVolume[i];
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
/// <summary>
|
|||
|
|
/// <20>ӵ<EFBFBD>ʱ<EFBFBD><CAB1>
|
|||
|
|
/// </summary>
|
|||
|
|
public void Speedbreaker()
|
|||
|
|
{
|
|||
|
|
if (isSpeedbreaker && !isSuspend)
|
|||
|
|
{
|
|||
|
|
BlurEffect(true);
|
|||
|
|
Time.timeScale = 0.6f;
|
|||
|
|
speedbreakerTime += Time.unscaledDeltaTime;
|
|||
|
|
if (speedbreakerTime >= GameNumericalValue.SpeedbreakerTime)
|
|||
|
|
{
|
|||
|
|
BlurEffect(false);
|
|||
|
|
UIManager.Instance.GetUI<GameUI>().SetSpeedbreakerBtn(true);
|
|||
|
|
isSpeedbreaker = false;
|
|||
|
|
speedbreakerTime = 0;
|
|||
|
|
Time.timeScale = 1;
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
/// <summary>
|
|||
|
|
/// ģ<><C4A3>Ч<EFBFBD><D0A7>
|
|||
|
|
/// </summary>
|
|||
|
|
private void BlurEffect(bool isShow)
|
|||
|
|
{
|
|||
|
|
if (isShow)
|
|||
|
|
{
|
|||
|
|
if (postProcessVolume.weight > 0) return;
|
|||
|
|
AudioManager.Instance.PlaySound(YooAssetManager.Instance.LoadAssetSync<AudioClip>(PackagesName.GameData, "BulletTimeStart"));
|
|||
|
|
DelayedProcessingManager.Instance.DelayDoSecond(this, 2, () =>
|
|||
|
|
{
|
|||
|
|
AudioManager.Instance.PlaySound(YooAssetManager.Instance.LoadAssetSync<AudioClip>(PackagesName.GameData, "BulletTimeCycle"), true);
|
|||
|
|
});
|
|||
|
|
AudioManager.Instance.SetBkMusic(false, 1);
|
|||
|
|
Scenes.Instance.player.RunningSound(false);
|
|||
|
|
float value = 0;
|
|||
|
|
blurEffectTween = DOTween.To(() => value, x => value = x, 0.5f, 0.3f).OnUpdate(() =>
|
|||
|
|
{
|
|||
|
|
postProcessVolume.weight = value;
|
|||
|
|
});
|
|||
|
|
}
|
|||
|
|
else
|
|||
|
|
{
|
|||
|
|
AudioManager.Instance.PlaySound(YooAssetManager.Instance.LoadAssetSync<AudioClip>(PackagesName.GameData, "BulletTimeEnd"));
|
|||
|
|
AudioManager.Instance.ClearIndividually("BulletTimeCycle");
|
|||
|
|
AudioManager.Instance.SetBkMusic(true, 2);
|
|||
|
|
player.RunningSound(true);
|
|||
|
|
float value = 0.5f;
|
|||
|
|
blurEffectTween = DOTween.To(() => value, x => value = x, 0, 3).OnUpdate(() =>
|
|||
|
|
{
|
|||
|
|
postProcessVolume.weight = value;
|
|||
|
|
});
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
/// <summary>
|
|||
|
|
/// <20><><EFBFBD><EFBFBD><EFBFBD>ӵ<EFBFBD>ʱ<EFBFBD><CAB1>
|
|||
|
|
/// </summary>
|
|||
|
|
public void ResetSpeedbreaker()
|
|||
|
|
{
|
|||
|
|
isSpeedbreaker = false;
|
|||
|
|
speedbreakerTime = 0;
|
|||
|
|
Time.timeScale = 1;
|
|||
|
|
blurEffectTween.Kill();
|
|||
|
|
|
|||
|
|
postProcessVolume.weight = 0;
|
|||
|
|
AudioManager.Instance.SetBkMusic(true, 2);
|
|||
|
|
AudioManager.Instance.ClearIndividually("BulletTimeCycle");
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
/// <summary>
|
|||
|
|
/// <20><><EFBFBD>ùؿ<C3B9>
|
|||
|
|
/// </summary>
|
|||
|
|
public void ResetLevel()
|
|||
|
|
{
|
|||
|
|
UIManager.Instance.ResourcesShowUI<LoadUI>((ui) =>
|
|||
|
|
{
|
|||
|
|
ui.SetAction(() =>
|
|||
|
|
{
|
|||
|
|
UIManager.Instance.AsynShowUI<GameUI>((gameUI) =>
|
|||
|
|
{
|
|||
|
|
gameUI.SetCountDownkeepOut(true);
|
|||
|
|
});
|
|||
|
|
Init();
|
|||
|
|
SetJudgmentOvertakingNumber();
|
|||
|
|
mapManager.GameOver();
|
|||
|
|
mapManager.Init();
|
|||
|
|
mapManager.InitGenerateNPCCar();
|
|||
|
|
(Vector3, int) birthPoint = mapManager.sectionRoadOne.GetBirthPoint();
|
|||
|
|
player.transform.position = birthPoint.Item1;
|
|||
|
|
player.SetMoveIndex(birthPoint.Item2);
|
|||
|
|
player.Init();
|
|||
|
|
player.SetPlay();
|
|||
|
|
Scenes.Instance.SetGameState(E_GameState.Start);
|
|||
|
|
}, () =>
|
|||
|
|
{
|
|||
|
|
CountDown();
|
|||
|
|
});
|
|||
|
|
ui.Load();
|
|||
|
|
});
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
/// <summary>
|
|||
|
|
/// <20><><EFBFBD>ùؿ<C3B9><D8BF><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
|
/// </summary>
|
|||
|
|
/// <param name="level"></param>
|
|||
|
|
public void SetLevelConfig(int level)
|
|||
|
|
{
|
|||
|
|
if (UserDataManager.Instance.userData.guidance.isOverInitialEntry)
|
|||
|
|
{
|
|||
|
|
if (UserDataManager.Instance.userData.level > 4)
|
|||
|
|
{
|
|||
|
|
levelConfig = ConfigManager.Instance.Tables.TbLevelConfig.Get("Level_" + Random.Range(1, 5));
|
|||
|
|
mapManager.SetLevel(levelConfig);
|
|||
|
|
}
|
|||
|
|
else
|
|||
|
|
{
|
|||
|
|
levelConfig = ConfigManager.Instance.Tables.TbLevelConfig.Get("Level_" + level);
|
|||
|
|
mapManager.SetLevel(levelConfig);
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
else
|
|||
|
|
{
|
|||
|
|
levelConfig = ConfigManager.Instance.Tables.TbLevelConfig.Get("Level_" +0);
|
|||
|
|
mapManager.SetLevel(levelConfig);
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
/// <summary>
|
|||
|
|
/// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʻ<EFBFBD><CABB><EFBFBD><EFBFBD>
|
|||
|
|
/// </summary>
|
|||
|
|
private void SetOperatingRange()
|
|||
|
|
{
|
|||
|
|
if (end != null)
|
|||
|
|
{
|
|||
|
|
if (player != null && Scenes.Instance.e_GameState == E_GameState.Gameing)
|
|||
|
|
{
|
|||
|
|
operatingRange = endPos - Vector3.Distance(end.transform.position, player.transform.position);
|
|||
|
|
operatingRangeScore = operatingRange;
|
|||
|
|
totalScore = operatingRangeScore + dangerousOvertakingScore;
|
|||
|
|
UIManager.Instance.GetUI<GameUI>()?.ShowOperatingRange(operatingRange, endPos);
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
/// <summary>
|
|||
|
|
/// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
|
/// </summary>
|
|||
|
|
public void SetdangerousOvertakingScore(float value)
|
|||
|
|
{
|
|||
|
|
dangerousOvertakingScore += value;
|
|||
|
|
UIManager.Instance.GetUI<GameUI>().SetExtraScore(value);
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
/// <summary>
|
|||
|
|
/// <20>õ<EFBFBD><C3B5>ؿ<EFBFBD><D8BF><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
|
/// </summary>
|
|||
|
|
/// <returns></returns>
|
|||
|
|
public float GetSchedule()
|
|||
|
|
{
|
|||
|
|
return operatingRange / levelConfig.End;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
/// <summary>
|
|||
|
|
/// <20>õ<EFBFBD><C3B5><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
|
/// </summary>
|
|||
|
|
/// <returns></returns>
|
|||
|
|
public float GetScore()
|
|||
|
|
{
|
|||
|
|
return totalScore;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
/// <summary>
|
|||
|
|
/// ʤ<><CAA4>
|
|||
|
|
/// </summary>
|
|||
|
|
public void Victory()
|
|||
|
|
{
|
|||
|
|
ResetSpeedbreaker();
|
|||
|
|
Scenes.Instance.SetGameState(E_GameState.GameVictory);
|
|||
|
|
UIManager.Instance.HideUI<GameUI>();
|
|||
|
|
UIManager.Instance.AsynShowUI<VictoryUI>();
|
|||
|
|
mapManager.GameOver();
|
|||
|
|
player.FireInit();
|
|||
|
|
player.skill.Clear();
|
|||
|
|
player.skinCar.OpenFrontLight();
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
/// <summary>
|
|||
|
|
/// <20><>ͣ
|
|||
|
|
/// </summary>
|
|||
|
|
public void Suspend()
|
|||
|
|
{
|
|||
|
|
player.RunningSound(false);
|
|||
|
|
isSuspend = true;
|
|||
|
|
Time.timeScale = 0;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
/// <summary>
|
|||
|
|
/// <20><>Ϸ<EFBFBD><CFB7><EFBFBD><EFBFBD>
|
|||
|
|
/// </summary>
|
|||
|
|
public void GameOver()
|
|||
|
|
{
|
|||
|
|
ResetSpeedbreaker();
|
|||
|
|
UIManager.Instance.HideUI<GameUI>();
|
|||
|
|
DelayedProcessingManager.Instance.DelayDoSecond(this, 1, () =>
|
|||
|
|
{
|
|||
|
|
UIManager.Instance.AsynShowUI<ResurgenceUI>();
|
|||
|
|
});
|
|||
|
|
Scenes.Instance.SetGameState(E_GameState.GameOver);
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
/// <summary>
|
|||
|
|
/// <20><><EFBFBD><EFBFBD>
|
|||
|
|
/// </summary>
|
|||
|
|
public void Resurgence()
|
|||
|
|
{
|
|||
|
|
ResetSpeedbreaker();
|
|||
|
|
UIManager.Instance.ResourcesShowUI<LoadUI>((ui) =>
|
|||
|
|
{
|
|||
|
|
ui.SetAction(() =>
|
|||
|
|
{
|
|||
|
|
mapManager.GameOver();
|
|||
|
|
UIManager.Instance.HideUI<ResurgenceUI>();
|
|||
|
|
player.Resurgence();
|
|||
|
|
mapManager.ResurgenceInit();
|
|||
|
|
}, () =>
|
|||
|
|
{
|
|||
|
|
Scenes.Instance.SetGameState(E_GameState.Gameing);
|
|||
|
|
player.RunningSound(true);
|
|||
|
|
});
|
|||
|
|
ui.Load();
|
|||
|
|
});
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
/// <summary>
|
|||
|
|
/// <20>ص<EFBFBD><D8B5><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
|
/// </summary>
|
|||
|
|
public void BackHall()
|
|||
|
|
{
|
|||
|
|
Time.timeScale = 1;
|
|||
|
|
player.RunningSound(false);
|
|||
|
|
UserDataManager.Instance.TrySkillOver();
|
|||
|
|
UIManager.Instance.ResourcesShowUI<LoadUI>((ui) =>
|
|||
|
|
{
|
|||
|
|
ui.SetAction(() =>
|
|||
|
|
{
|
|||
|
|
UIManager.Instance.DeleteUI<GameUI>();
|
|||
|
|
UIManager.Instance.DeleteUI<ResurgenceUI>();
|
|||
|
|
UIManager.Instance.DeleteUI<SettlementUI>();
|
|||
|
|
UIManager.Instance.DeleteUI<VictoryUI>();
|
|||
|
|
UIManager.Instance.DeleteUI<SuspendUI>();
|
|||
|
|
CachePoolManager.Instance.Clear();
|
|||
|
|
}, () =>
|
|||
|
|
{
|
|||
|
|
Scenes.Instance.hallScene.SkipInit();
|
|||
|
|
});
|
|||
|
|
ScenesLoadManager.Instance.AsynLoadScene(MyConstant.HallScene, () =>
|
|||
|
|
{
|
|||
|
|
ui.Load();
|
|||
|
|
});
|
|||
|
|
});
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
/// <summary>
|
|||
|
|
/// <20>õ<EFBFBD><C3B5><EFBFBD><EFBFBD>ճ<EFBFBD><D5B3><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
|
/// </summary>
|
|||
|
|
/// <returns></returns>
|
|||
|
|
public int GetJudgmentOvertakingNumber()
|
|||
|
|
{
|
|||
|
|
judgmentOvertakingNumber++;
|
|||
|
|
if (judgmentOvertakingNumber > 10)
|
|||
|
|
{
|
|||
|
|
judgmentOvertakingNumber = 10;
|
|||
|
|
}
|
|||
|
|
recordJudgmentOvertakingNumbe = judgmentOvertakingNumber;
|
|||
|
|
return judgmentOvertakingNumber;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
/// <summary>
|
|||
|
|
/// <20><><EFBFBD><EFBFBD><EFBFBD>ܾ<EFBFBD><DCBE>ճ<EFBFBD><D5B3><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
|
/// </summary>
|
|||
|
|
public void SetTotaiJudgmentOvertakingNumbe()
|
|||
|
|
{
|
|||
|
|
totaiJudgmentOvertakingNumbe++;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
/// <summary>
|
|||
|
|
/// <20>õ<EFBFBD>ײ<EFBFBD><D7B2><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
|
/// </summary>
|
|||
|
|
/// <returns></returns>
|
|||
|
|
public int GetCarAccidentNumber()
|
|||
|
|
{
|
|||
|
|
return carAccidentNumber;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
/// <summary>
|
|||
|
|
/// <20><><EFBFBD><EFBFBD><EFBFBD>ܾ<EFBFBD><DCBE>ճ<EFBFBD><D5B3><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
|
/// </summary>
|
|||
|
|
public void SetGetCarAccidentNumbe()
|
|||
|
|
{
|
|||
|
|
carAccidentNumber++;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
/// <summary>
|
|||
|
|
/// <20><><EFBFBD>þ<EFBFBD><C3BE>ճ<EFBFBD><D5B3><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
|
/// </summary>
|
|||
|
|
public void SetJudgmentOvertakingNumber()
|
|||
|
|
{
|
|||
|
|
judgmentOvertakingNumber = 0;
|
|||
|
|
if (recordJudgmentOvertakingNumbe != 0)
|
|||
|
|
{
|
|||
|
|
UIManager.Instance.GetUI<GameUI>().SetMultipleState();
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
/// <summary>
|
|||
|
|
/// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
|
/// </summary>
|
|||
|
|
public void Multiple()
|
|||
|
|
{
|
|||
|
|
judgmentOvertakingNumber = recordJudgmentOvertakingNumbe;
|
|||
|
|
UIManager.Instance.GetUI<GameUI>().SetEventType(E_ShowEventType.JudgmentOvertaking, (GameNumericalValue.JudgmentOvertakingAwardMoney * judgmentOvertakingNumber).ToString());
|
|||
|
|
UIManager.Instance.GetUI<GameUI>().SetCloseCall(judgmentOvertakingNumber);
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
/// <summary>
|
|||
|
|
/// <20><>ʼ<EFBFBD><CABC>Ϸ
|
|||
|
|
/// </summary>
|
|||
|
|
public void PlayGame()
|
|||
|
|
{
|
|||
|
|
(Vector3, int) birthPoint = mapManager.sectionRoadOne.GetBirthPoint();
|
|||
|
|
Scenes.Instance.PlayerCarInit(birthPoint.Item1);
|
|||
|
|
player = Scenes.Instance.player;
|
|||
|
|
player.SetPlay();
|
|||
|
|
player.SetMoveIndex(birthPoint.Item2);
|
|||
|
|
player.SetGameBK(levelConfig);
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
/// <summary>
|
|||
|
|
/// <20><><EFBFBD><EFBFBD><EFBFBD>յ<EFBFBD>
|
|||
|
|
/// </summary>
|
|||
|
|
public void GenerateEnd(float distance)
|
|||
|
|
{
|
|||
|
|
YooAssetManager.Instance.LoadAssetAsync<GameObject>(PackagesName.GameData, "End", (obj) =>
|
|||
|
|
{
|
|||
|
|
end = Instantiate(obj);
|
|||
|
|
if (UserDataManager.Instance.userData.level > 4)
|
|||
|
|
{
|
|||
|
|
end.transform.position = player.transform.position + player.transform.forward * (distance + UserDataManager.Instance.userData.level * 1.35f);
|
|||
|
|
}
|
|||
|
|
else
|
|||
|
|
{
|
|||
|
|
end.transform.position = player.transform.position + player.transform.forward * distance;
|
|||
|
|
}
|
|||
|
|
endPos = Vector3.Distance(player.transform.position, end.transform.position);
|
|||
|
|
});
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
/// <summary>
|
|||
|
|
/// <20><><EFBFBD><EFBFBD>ʱ
|
|||
|
|
/// </summary>
|
|||
|
|
public void CountDown()
|
|||
|
|
{
|
|||
|
|
DelayedProcessingManager.Instance.DelayDoSecond(this, 0.35f, () =>
|
|||
|
|
{
|
|||
|
|
player.skinCar.SetAllLight(true);
|
|||
|
|
player.playerAnim.Play("Player_Shank");
|
|||
|
|
float countdow = 3;
|
|||
|
|
GameUI gameUI = UIManager.Instance.GetUI<GameUI>();
|
|||
|
|
gameUI.SetCountDownkeepOut();
|
|||
|
|
gameUI.SetCountDown(3.ToString(), E_CountDownType.Three);
|
|||
|
|
gameUI.SetCountdownEnds(false);
|
|||
|
|
player.GetReady(E_CountDownType.Three);
|
|||
|
|
AudioManager.Instance.PlaySound(YooAssetManager.Instance.LoadAssetSync<AudioClip>(PackagesName.GameData, "CountDown"));
|
|||
|
|
DOTween.To(() => countdow, value => countdow = value, 2, 1.3f).OnComplete(() =>
|
|||
|
|
{
|
|||
|
|
AudioManager.Instance.PlaySound(YooAssetManager.Instance.LoadAssetSync<AudioClip>(PackagesName.GameData, "CountDown"));
|
|||
|
|
player.GetReady(E_CountDownType.Two);
|
|||
|
|
gameUI.SetCountDownkeepOut();
|
|||
|
|
gameUI.SetCountDown(2.ToString(), E_CountDownType.Two);
|
|||
|
|
DOTween.To(() => countdow, value => countdow = value, 1, 1.3f).OnComplete(() =>
|
|||
|
|
{
|
|||
|
|
AudioManager.Instance.PlaySound(YooAssetManager.Instance.LoadAssetSync<AudioClip>(PackagesName.GameData, "CountDown"));
|
|||
|
|
player.GetReady(E_CountDownType.One);
|
|||
|
|
gameUI.SetCountDownkeepOut();
|
|||
|
|
gameUI.SetCountDown(1.ToString(), E_CountDownType.One);
|
|||
|
|
DOTween.To(() => countdow, value => countdow = value, 0, 1.4f).OnComplete(() =>
|
|||
|
|
{
|
|||
|
|
GuidanceManger.Instance.ChannelChangeguidance();
|
|||
|
|
AudioManager.Instance.PlaySound(YooAssetManager.Instance.LoadAssetSync<AudioClip>(PackagesName.GameData, "GO"));
|
|||
|
|
player.playerAnim.Stop("Player_Shank");
|
|||
|
|
gameUI.SetCountDownkeepOut(false);
|
|||
|
|
gameUI.SetCountdownEnds(true);
|
|||
|
|
player.TurnToGameCamear();
|
|||
|
|
gameUI.SetCountDownkeepOut();
|
|||
|
|
gameUI.SetCountDown("GO!!!", E_CountDownType.GO);
|
|||
|
|
player.skinCar.SetAllLight(false);
|
|||
|
|
Scenes.Instance.SetGameState(E_GameState.Gameing);
|
|||
|
|
player.RunningSound(true);
|
|||
|
|
});
|
|||
|
|
});
|
|||
|
|
});
|
|||
|
|
});
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
/// <summary>
|
|||
|
|
/// <20><>;<EFBFBD><CDBE><EFBFBD><EFBFBD>ʱ
|
|||
|
|
/// </summary>
|
|||
|
|
public void HalfWayCountdown()
|
|||
|
|
{
|
|||
|
|
int value = 3;
|
|||
|
|
UIManager.Instance.GetUI<GameUI>().SetCountDown(value.ToString(), E_CountDownType.Three);
|
|||
|
|
AudioManager.Instance.PlaySound(YooAssetManager.Instance.LoadAssetSync<AudioClip>(PackagesName.GameData, "CountDown"));
|
|||
|
|
DOTween.To(() => value, x => value = x, 2, 1).OnComplete(() =>
|
|||
|
|
{
|
|||
|
|
UIManager.Instance.GetUI<GameUI>().SetCountDown(value.ToString(), E_CountDownType.Two);
|
|||
|
|
AudioManager.Instance.PlaySound(YooAssetManager.Instance.LoadAssetSync<AudioClip>(PackagesName.GameData, "CountDown"));
|
|||
|
|
DOTween.To(() => value, x => value = x, 1, 1).OnComplete(() =>
|
|||
|
|
{
|
|||
|
|
UIManager.Instance.GetUI<GameUI>().SetCountDown(value.ToString(), E_CountDownType.One);
|
|||
|
|
AudioManager.Instance.PlaySound(YooAssetManager.Instance.LoadAssetSync<AudioClip>(PackagesName.GameData, "CountDown"));
|
|||
|
|
DOTween.To(() => value, x => value = x, 0, 1).OnComplete(() =>
|
|||
|
|
{
|
|||
|
|
if (isSpeedbreaker)
|
|||
|
|
{
|
|||
|
|
Time.timeScale = 0.6f;
|
|||
|
|
}
|
|||
|
|
else
|
|||
|
|
{
|
|||
|
|
player.RunningSound(true);
|
|||
|
|
Time.timeScale = 1;
|
|||
|
|
}
|
|||
|
|
AudioManager.Instance.PlaySound(YooAssetManager.Instance.LoadAssetSync<AudioClip>(PackagesName.GameData, "GO"));
|
|||
|
|
UIManager.Instance.GetUI<GameUI>().SetCountDown("GO!!!", E_CountDownType.GO);
|
|||
|
|
UIManager.Instance.GetUI<GameUI>().SetCountdownEnds(true);
|
|||
|
|
isSuspend = false;
|
|||
|
|
}).SetUpdate(true);
|
|||
|
|
}).SetUpdate(true);
|
|||
|
|
}).SetUpdate(true);
|
|||
|
|
}
|
|||
|
|
}
|