127 lines
2.8 KiB
C#
127 lines
2.8 KiB
C#
// ***********************************************************************
|
|
// Assembly : Game
|
|
// Author : Kimch
|
|
// Created : 2020-12-01
|
|
// Description :
|
|
// Last Modified By :
|
|
// Last Modified On :
|
|
// ***********************************************************************
|
|
// <copyright file= "GameLevel" company="Kunpo"></copyright>
|
|
// <summary></summary>
|
|
// ***********************************************************************
|
|
|
|
using System.Collections;
|
|
using System.Collections.Generic;
|
|
using UnityEngine;
|
|
|
|
namespace G
|
|
{
|
|
public enum GameMode
|
|
{
|
|
None,
|
|
Normal,
|
|
Boss = 2,
|
|
Adventure = 3,
|
|
Limit = 4,
|
|
/// <summary>
|
|
/// 护送
|
|
/// </summary>
|
|
Escort = 5,
|
|
Infinity,
|
|
}
|
|
|
|
/// <summary>
|
|
/// 模式
|
|
/// </summary>
|
|
partial class GameLevel
|
|
{
|
|
#region Field
|
|
|
|
private float _stageTime = 0f;
|
|
private float _stageProgress = 0f;
|
|
|
|
#endregion
|
|
|
|
#region Property
|
|
|
|
/// <summary>
|
|
/// 关卡模式
|
|
/// </summary>
|
|
public GameMode stageMode
|
|
{
|
|
get;
|
|
private set;
|
|
}
|
|
|
|
public float stageTime
|
|
{
|
|
get => _stageTime;
|
|
}
|
|
|
|
public float stageProgress
|
|
{
|
|
get => _stageProgress;
|
|
set => _stageProgress = value;
|
|
}
|
|
|
|
#endregion
|
|
|
|
#region Method
|
|
|
|
/// <summary>
|
|
///
|
|
/// </summary>
|
|
/// <param name="mode"></param>
|
|
public void SetMode(int mode)
|
|
{
|
|
stageMode = (GameMode)mode;
|
|
if (stageMode == GameMode.Limit)
|
|
{
|
|
_stageTime = curStageItem.typeArgs[0];
|
|
GameCamera.Instance.SetMode(mode);
|
|
}
|
|
else
|
|
{
|
|
_stageTime = 0f;
|
|
}
|
|
}
|
|
|
|
public void MissionSuccess()
|
|
{
|
|
FinishStage(true);
|
|
EntityManager.Instance.RemoveAllEntity();
|
|
}
|
|
|
|
public void MissionFail()
|
|
{
|
|
Debug.Log("游戏结束 任务失败");
|
|
FinishStage(false);
|
|
EntityManager.Instance.RemoveAllEntity();
|
|
}
|
|
|
|
private void UpdateMode()
|
|
{
|
|
if (_stageFinish || _spawnStartTime < 0f)
|
|
return;
|
|
//限时模型
|
|
if (stageMode == GameMode.Limit)
|
|
{
|
|
if (_stageTime > 0)
|
|
{
|
|
_stageTime -= Time.deltaTime;
|
|
if (_stageTime <= 0f)
|
|
{
|
|
MissionFail();
|
|
}
|
|
}
|
|
}
|
|
else
|
|
{
|
|
_stageTime += Time.deltaTime;
|
|
}
|
|
}
|
|
|
|
#endregion
|
|
}
|
|
}
|