diff --git a/Assets/Scripts/MiniGame/Engine.meta b/Assets/Scripts/MiniGame/Engine.meta deleted file mode 100644 index aa172b8b2..000000000 --- a/Assets/Scripts/MiniGame/Engine.meta +++ /dev/null @@ -1,8 +0,0 @@ -fileFormatVersion: 2 -guid: 5e4e107b3ecf9c547b40caab94412f3c -folderAsset: yes -DefaultImporter: - externalObjects: {} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Scripts/MiniGame/Engine/CordPull.cs b/Assets/Scripts/MiniGame/Engine/CordPull.cs deleted file mode 100644 index 907cb29b9..000000000 --- a/Assets/Scripts/MiniGame/Engine/CordPull.cs +++ /dev/null @@ -1,138 +0,0 @@ -using AibisDream.Framework; -using AibisDream.Utility; -using DG.Tweening; -using UnityEngine; -using UnityEngine.EventSystems; - -namespace AibisDream -{ - public class CordPull : MonoBehaviour, IInteraction - { - private static readonly int ShineFade = Shader.PropertyToID("_ShineFade"); - - private EventTriggerEx _trigger; - private SpriteRenderer _sprite; - private EngineSystem _engineSystem; - private Vector3 _initPos; - public float maxDistance; - - private Vector3 _dragPoint; - private bool _isDragging; - - private void Awake() - { - // 记录当前位置 - InitRefs(); - } - - private void InitRefs() - { - _initPos = transform.position; - - _trigger = GetComponent(); - _engineSystem = transform.parent.GetComponent(); - _sprite = GetComponent(); - - _trigger.Register(EventTriggerType.BeginDrag, OnBeginDrag); - _trigger.Register(EventTriggerType.EndDrag, OnEndDrag); - _trigger.Register(EventTriggerType.Drag, OnDrag); - } - - private void Update() - { - if (_isDragging) - { - MoveToDragPos(); - } - } - - private void MoveToDragPos() - { - float curY; - // 如果拖拽点在上方,直接移动 - if (_dragPoint.y > transform.position.y) - { - curY = _dragPoint.y; - } - // 如果拖拽点在下方,限速移动 - else - { - curY = _dragPoint.y; - var pullDelta = Mathf.Abs(curY - transform.position.y) / maxDistance; - // 将增量同步给Engine - _engineSystem.AddAirPress(pullDelta); - } - - transform.position = new Vector3(transform.position.x, curY, transform.position.z); - } - - private void OnDrag(BaseEventData data) - { - // 这里是一些阻碍拖动的情况 - if (!IsActive) return; - - // 正常情况下不会出错 - if (data is not PointerEventData pointerData) return; - - // 设置拖拽目标点 - SetDragTarget(pointerData.position); - } - - private void OnBeginDrag(BaseEventData data) - { - // 这里是一些阻碍拖动的情况 - if (!IsActive) return; - - // 首次拖拽后关闭高亮 - if (GlobalVariableKit.IsCordHighLight) - { - GlobalVariableKit.IsCordHighLight = false; - _sprite.material.SetFloat(ShineFade, 0); - } - - // 正常情况下不会出错 - if (data is not PointerEventData pointerData) return; - // 设置拖拽目标点 - SetDragTarget(pointerData.position); - - // 开始拖动的时候把原有的动画删掉 - transform.DOKill(); - _isDragging = true; - } - - private void OnEndDrag(BaseEventData data) - { - _isDragging = false; - // 松手后抽回去 - var retractTime = (_initPos.y - transform.localPosition.y) / _engineSystem.engineConfig.returnSpeed; - transform.DOMove(_initPos, retractTime); - } - - private void SetDragTarget(Vector3 mousePos) - { - var worldPos = CameraKit.GetMouseWorldPos(mousePos); - - var dragY = CommonUtil.Limit(worldPos.y, _initPos.y, _initPos.y - maxDistance); - - _dragPoint = new Vector3(transform.position.x, dragY, transform.position.z); - } - - public void ActiveShine() - { - _sprite.material.SetFloat(ShineFade, 1); - } - - #region 交互限制相关 - - public bool IsActive => _engineSystem.isPullActive; - - public bool IsAvailable => _engineSystem.isAvailable; - - public GameObject GetGameObject() - { - return gameObject; - } - - #endregion - } -} \ No newline at end of file diff --git a/Assets/Scripts/MiniGame/Engine/CordPull.cs.meta b/Assets/Scripts/MiniGame/Engine/CordPull.cs.meta deleted file mode 100644 index 881345b1b..000000000 --- a/Assets/Scripts/MiniGame/Engine/CordPull.cs.meta +++ /dev/null @@ -1,3 +0,0 @@ -fileFormatVersion: 2 -guid: 7a6d9bb0e6b84b14a9d78479d5462d41 -timeCreated: 1737097199 \ No newline at end of file diff --git a/Assets/Scripts/MiniGame/Engine/EngineSystem.cs b/Assets/Scripts/MiniGame/Engine/EngineSystem.cs deleted file mode 100644 index c521186f7..000000000 --- a/Assets/Scripts/MiniGame/Engine/EngineSystem.cs +++ /dev/null @@ -1,140 +0,0 @@ -using System; -using System.Collections; -using AibisDream.FixSystem; -using AibisDream.Framework; -using AibisDream.Utility; -using Cinemachine; -using DG.Tweening; -using UnityEngine; -using UnityEngine.Events; - -namespace AibisDream -{ - public class EngineSystem : MonoBehaviour - { - [SerializeField]private SpriteRenderer cover; - - [Header("系统配置")] public EngineConfig engineConfig; - public bool isAvailable; - public bool isPullActive; - private bool _isSuccess; - - public float curSpeed; - public float targetSpeed = 0.95f; - [SerializeField] private float coverMoveDuration = 5f; - [SerializeField] private float coverMoveDistance = 2.8f; - - public UnityEvent updateSpeedEvent = new(); - - private void Awake() - { - FixSystemCenter.SystemDic.Register(this); - - // 注册相机 - var virtualCam = transform.Find("Engine Camera").GetComponent(); - CameraKit.Instance.RegisterCamera(CameraEnum.Engine, virtualCam); - } - - public IEnumerator StepOnGas(float target, float duration) - { - // 逐渐加速 - yield return DOTween.To(() => curSpeed, x => { curSpeed = x; }, target, duration).WaitForCompletion(); - } - - public void AddAirPress(float speedDelta) - { - curSpeed = CommonUtil.Limit(curSpeed + speedDelta / engineConfig.pullCount, 1, 0); - } - - private void OnDestroy() - { - CameraKit.Instance.UnRegisterCamera(CameraEnum.Engine); - } - - private void Update() - { - updateSpeedEvent.Invoke(curSpeed, GetSpeedScale()); - if (curSpeed >= targetSpeed && !_isSuccess) - { - _isSuccess = true; - isPullActive = false; - DialogController.Instance?.StartDialogNode("EngineSuccess"); - } - } - - private float GetSpeedScale() - { - return 1 + curSpeed * engineConfig.speedRate; - } - - /// - /// 开启系统交互 - /// - private void EnableSystem() - { - isAvailable = true; - } - - /// - /// 关闭系统交互 - /// - private void DisableSystem() - { - isAvailable = false; - } - - /// - /// 打开盖板 - /// 关闭系统交互 - /// - /// 动画序列 - 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(EnableSystem); - - return sq; - } - - /// - /// 关闭盖板 - /// - /// 动画序列 - 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(DisableSystem); - - return sq; - } - - public void ActivePull() - { - isPullActive = true; - var pull = GetComponentInChildren(); - pull.ActiveShine(); - } - } - - [Serializable] - public struct EngineConfig - { - [Header("齿轮基础速度")] public float gearSpeed; - [Header("齿轮速度倍率")] public float speedRate; - [Header("拉满几次到全速")] public float pullCount; - [Header("拉绳回缩速度")] public float returnSpeed; - } -} \ No newline at end of file diff --git a/Assets/Scripts/MiniGame/Engine/EngineSystem.cs.meta b/Assets/Scripts/MiniGame/Engine/EngineSystem.cs.meta deleted file mode 100644 index a6e6ba623..000000000 --- a/Assets/Scripts/MiniGame/Engine/EngineSystem.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 10324e3c30ee1924893a08455ce65e0d -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Scripts/MiniGame/Engine/EngineYarnCommand.cs b/Assets/Scripts/MiniGame/Engine/EngineYarnCommand.cs deleted file mode 100644 index 917171e21..000000000 --- a/Assets/Scripts/MiniGame/Engine/EngineYarnCommand.cs +++ /dev/null @@ -1,46 +0,0 @@ -using System.Collections; -using AibisDream.FixSystem; -using Yarn.Unity; - -namespace AibisDream -{ - public static class EngineYarnCommand - { - private static EngineSystem EngineSystem => FixSystemCenter.SystemDic.Get(); - - // 打开引擎盖 - [YarnCommand("open_engine_cover")] - public static IEnumerator OpenEngineCover() - { - yield return EngineSystem.OpenCover(); - } - - // 打开引擎盖 - [YarnCommand("close_engine_cover")] - public static IEnumerator CloseEngineCover() - { - yield return EngineSystem.CloseCover(); - } - - /// - /// 踩油门 - /// - /// 目标速度 - /// 用时 - /// 协程 - [YarnCommand("step_on_gas")] - public static IEnumerator StepOnGas(float targetSpeed, float duration) - { - return EngineSystem.StepOnGas(targetSpeed, duration); - } - - /// - /// 激活拉绳 - /// - [YarnCommand("active_engine_pull")] - public static void ActivePull() - { - EngineSystem.ActivePull(); - } - } -} \ No newline at end of file diff --git a/Assets/Scripts/MiniGame/Engine/EngineYarnCommand.cs.meta b/Assets/Scripts/MiniGame/Engine/EngineYarnCommand.cs.meta deleted file mode 100644 index 93ca8b17a..000000000 --- a/Assets/Scripts/MiniGame/Engine/EngineYarnCommand.cs.meta +++ /dev/null @@ -1,3 +0,0 @@ -fileFormatVersion: 2 -guid: 25506a4586954f8db428372d3644fcf9 -timeCreated: 1736336596 \ No newline at end of file diff --git a/Assets/Scripts/MiniGame/Engine/MovablePartGroup.cs b/Assets/Scripts/MiniGame/Engine/MovablePartGroup.cs deleted file mode 100644 index a162982d0..000000000 --- a/Assets/Scripts/MiniGame/Engine/MovablePartGroup.cs +++ /dev/null @@ -1,70 +0,0 @@ -using System; -using AibisDream.FixSystem; -using DG.Tweening; -using UnityEngine; - -namespace AibisDream -{ - public class MoveablePartGroup : MonoBehaviour - { - #region 动件索引 - - [Header("可动组件索引")] public EngineGear[] engineGears; - private EngineSystem EngineSystem => FixSystemCenter.SystemDic.Get(); - - #endregion - - private EngineSystem _engineSystem; - - private void Start() - { - // 赋予初始速度 - foreach (var gear in engineGears) - { - gear.Rotate(EngineSystem.engineConfig.gearSpeed); - } - EngineSystem.updateSpeedEvent.AddListener(OnSpeedUpdate); - } - - private void OnSpeedUpdate(float originSpeed, float speedScale) - { - // 处理齿轮速度 - foreach (var gear in engineGears) - { - gear.SetSpeedScale(speedScale); - } - } - } - - [Serializable] - public class EngineGear - { - public Transform gear; - public float speedRadio; - - private Tween _rotateTween; - - /// - /// 设置速度 - /// - /// 基础速度 - public void SetSpeedScale(float speedScale) - { - if (_rotateTween != null) - { - _rotateTween.timeScale = speedScale; - } - // _rotateTween.timeScale = speedScale; - } - - public void Rotate(float initSpeed) - { - var duration = 1 / Mathf.Abs(initSpeed * speedRadio); - - var target = speedRadio >= 0 ? new Vector3(0, 0, 360) : new Vector3(0, 0, -360); - _rotateTween = gear.DORotate(target, duration, RotateMode.LocalAxisAdd) - .SetEase(Ease.Linear) - .SetLoops(-1, LoopType.Incremental); - } - } -} \ No newline at end of file diff --git a/Assets/Scripts/MiniGame/Engine/MovablePartGroup.cs.meta b/Assets/Scripts/MiniGame/Engine/MovablePartGroup.cs.meta deleted file mode 100644 index 254b759c3..000000000 --- a/Assets/Scripts/MiniGame/Engine/MovablePartGroup.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 8fa4ca1b14430cb49b015ee8d5a5eaf4 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/StreamingAssets/LevelData/EngineSystem.meta b/Assets/StreamingAssets/LevelData/EngineSystem.meta deleted file mode 100644 index 3cdda2009..000000000 --- a/Assets/StreamingAssets/LevelData/EngineSystem.meta +++ /dev/null @@ -1,8 +0,0 @@ -fileFormatVersion: 2 -guid: 3388932338827fc4785c8f4c4012b38e -folderAsset: yes -DefaultImporter: - externalObjects: {} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/StreamingAssets/LevelData/EngineSystem/stone1.json b/Assets/StreamingAssets/LevelData/EngineSystem/stone1.json deleted file mode 100644 index ef7735cf8..000000000 --- a/Assets/StreamingAssets/LevelData/EngineSystem/stone1.json +++ /dev/null @@ -1 +0,0 @@ -{"oilDownRatio":0.2,"oilUpRatio":0.4,"acceleratedSpeed":1.0,"resistance":1.0,"airMaxRatio":0.45,"airMinRatio":0.37,"baseAirMax":0.2,"maxLevel":5,"targetSpeed":0.8,"invalidTime":0.7} \ No newline at end of file diff --git a/Assets/StreamingAssets/LevelData/EngineSystem/stone1.json.meta b/Assets/StreamingAssets/LevelData/EngineSystem/stone1.json.meta deleted file mode 100644 index a9b00be08..000000000 --- a/Assets/StreamingAssets/LevelData/EngineSystem/stone1.json.meta +++ /dev/null @@ -1,7 +0,0 @@ -fileFormatVersion: 2 -guid: aa0525ab5423c9c4f9e29f9580bc5939 -DefaultImporter: - externalObjects: {} - userData: - assetBundleName: - assetBundleVariant: