石头
This commit is contained in:
@@ -1,6 +1,5 @@
|
||||
using AibisDream.Framework;
|
||||
using UnityEngine;
|
||||
using UnityEngine.Serialization;
|
||||
|
||||
namespace AibisDream
|
||||
{
|
||||
@@ -13,6 +12,8 @@ namespace AibisDream
|
||||
[SerializeField] private float heightY;
|
||||
|
||||
private Vector3 _offset;
|
||||
|
||||
public bool IsBlock { get; }
|
||||
|
||||
private void Awake()
|
||||
{
|
||||
|
||||
@@ -4,7 +4,9 @@ using AibisDream.FixSystem;
|
||||
using AibisDream.Framework;
|
||||
using AibisDream.Kit;
|
||||
using AibisDream.Utility;
|
||||
using DG.Tweening;
|
||||
using UnityEngine;
|
||||
using UnityEngine.Serialization;
|
||||
|
||||
namespace AibisDream
|
||||
{
|
||||
@@ -12,16 +14,24 @@ namespace AibisDream
|
||||
{
|
||||
public static string DataPath = Application.streamingAssetsPath + "/LevelData/EngineSystem/";
|
||||
|
||||
private SpriteRenderer _cover;
|
||||
|
||||
[Header("系统配置")] [SerializeField] public EngineConfig config;
|
||||
[Header("系统数据")] [SerializeField] private EngineData engineData;
|
||||
|
||||
[FormerlySerializedAs("盖板移动时间")] [SerializeField]
|
||||
private float coverMoveDuration = 5f;
|
||||
[FormerlySerializedAs("盖板移动距离")] [SerializeField]
|
||||
private float coverMoveDistance = 2.8f;
|
||||
|
||||
private bool IsValid => engineData.isValid.Value;
|
||||
|
||||
|
||||
public event Action<EngineData> UpdateDashboard;
|
||||
|
||||
private void Awake()
|
||||
{
|
||||
FixSystemCenter.SystemDic.Register(this);
|
||||
_cover = transform.Find("Cover").GetComponent<SpriteRenderer>();
|
||||
}
|
||||
|
||||
private void OnEnable()
|
||||
@@ -58,13 +68,65 @@ namespace AibisDream
|
||||
// 失效期无法加油门
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 更新引擎气门变化
|
||||
/// </summary>
|
||||
/// <param name="curLevel">当前气门等级</param>
|
||||
public void UpdateAirLevel(int curLevel)
|
||||
{
|
||||
engineData.UpdateAirLevel(curLevel, config.maxLevel);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 打开盖板
|
||||
/// </summary>
|
||||
/// <returns>动画序列</returns>
|
||||
public Tween OpenCover()
|
||||
{
|
||||
var sq = DOTween.Sequence();
|
||||
// 盖板上移
|
||||
var moveDis = new Vector3(0, coverMoveDistance, 0);
|
||||
sq.Join(_cover.transform.DOBlendableMoveBy(moveDis, coverMoveDuration));
|
||||
// 盖板淡出
|
||||
sq.Join(_cover.DOFade(0, coverMoveDuration));
|
||||
|
||||
// 为引擎系统解锁
|
||||
sq.OnComplete(Unlock);
|
||||
|
||||
return sq;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 关闭盖板
|
||||
/// </summary>
|
||||
/// <returns>动画序列</returns>
|
||||
public Tween CloseCover()
|
||||
{
|
||||
var sq = DOTween.Sequence();
|
||||
sq.Join(_cover.DOFade(1, coverMoveDuration));
|
||||
|
||||
var moveDis = new Vector3(0, -coverMoveDistance, 0);
|
||||
sq.Join(_cover.transform.DOBlendableMoveBy(moveDis, coverMoveDuration));
|
||||
|
||||
// 锁定引擎系统
|
||||
sq.OnComplete(Lock);
|
||||
|
||||
return sq;
|
||||
}
|
||||
|
||||
public void Lock()
|
||||
{
|
||||
// 禁止油门和气门
|
||||
|
||||
}
|
||||
|
||||
public void Unlock()
|
||||
{
|
||||
// 开启油门和气门
|
||||
}
|
||||
|
||||
#region 数据加载与保存
|
||||
|
||||
|
||||
private string[] _keyOptions;
|
||||
|
||||
public override string CurDataKey { get; set; }
|
||||
@@ -81,7 +143,7 @@ namespace AibisDream
|
||||
Debug.Log("配置项名称为空");
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
if (!ConfigUtil.Instance.TryLoadConfig<EngineConfig>(DataPath + CurDataKey,
|
||||
out var data))
|
||||
{
|
||||
@@ -94,13 +156,14 @@ namespace AibisDream
|
||||
|
||||
public override void Save()
|
||||
{
|
||||
if (string.IsNullOrEmpty(CurDataKey))
|
||||
if (string.IsNullOrEmpty(CurDataKey))
|
||||
{
|
||||
Debug.Log("名称不为空");
|
||||
return;
|
||||
}
|
||||
|
||||
ConfigUtil.Instance.SaveConfig(config, DataPath + CurDataKey);
|
||||
|
||||
|
||||
if (!_keyOptions.Contains(CurDataKey))
|
||||
{
|
||||
// 重新读取key
|
||||
@@ -176,6 +239,8 @@ namespace AibisDream
|
||||
{
|
||||
isValid.Value = false;
|
||||
}
|
||||
|
||||
inAirRange = curInAirRange;
|
||||
}
|
||||
|
||||
public void UpdateAirLevel(int level, int maxLevel)
|
||||
|
||||
@@ -6,8 +6,8 @@ namespace AibisDream
|
||||
{
|
||||
private Transform _pointer;
|
||||
|
||||
[SerializeField] private float leftPosX;
|
||||
[SerializeField] private float rightPosX;
|
||||
[SerializeField] private float leftRot;
|
||||
[SerializeField] private float rightRot;
|
||||
|
||||
protected override void OnStart()
|
||||
{
|
||||
@@ -16,8 +16,9 @@ namespace AibisDream
|
||||
|
||||
protected override void UpdateDashboard(EngineData data)
|
||||
{
|
||||
var targetPosX = (rightPosX - leftPosX) * data.curSpeed + leftPosX;
|
||||
_pointer.localPosition = new Vector3(targetPosX, _pointer.localPosition.y, _pointer.localPosition.y);
|
||||
var targetRot = (rightRot - leftRot) * data.curSpeed + leftRot;
|
||||
|
||||
_pointer.eulerAngles = new Vector3(0, 0, -targetRot);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,29 +0,0 @@
|
||||
using UnityEngine;
|
||||
|
||||
namespace AibisDream
|
||||
{
|
||||
public class StoneLifeCycle : AbsLifeCycle
|
||||
{
|
||||
public override void OnInit()
|
||||
{
|
||||
Debug.Log("场景加载");
|
||||
}
|
||||
|
||||
public override void OnGameStart()
|
||||
{
|
||||
GameObject.Find("Gear System").gameObject.SetActive(true);
|
||||
}
|
||||
|
||||
public override void OnGameEnd()
|
||||
{
|
||||
GameObject.Find("Gear System").gameObject.SetActive(false);
|
||||
GameObject.Find("Engine System").gameObject.SetActive(false);
|
||||
}
|
||||
|
||||
public override void OnSceneUnload()
|
||||
{
|
||||
Debug.Log("场景卸载");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,11 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 9d2cedabb95163448b13ee5c471b832a
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
Reference in New Issue
Block a user