feat():大改前的提交,这个版本保存了所有冗余的代码

This commit is contained in:
2025-10-17 15:10:19 +08:00
parent 668bfe12eb
commit 3d03c59dc3
68 changed files with 2045 additions and 159 deletions

View File

@@ -0,0 +1,72 @@
using System;
using Script.Gameplay.Input;
using UnityEngine;
namespace Gameplay.Player
{
public enum WatchMode
{
Normal,
Inside,
Outside
}
public class PlayerWatchModeSwitcher : MonoBehaviour
{
[SerializeField] private Camera cam;
private InputManager inputManager;
private WatchMode currentMode = WatchMode.Normal;
private void Start()
{
inputManager = InputManager.Instance;
SetWatchMode(currentMode);
var input = inputManager.Input;
input.Player.SwitchWatchMode.performed += ctx =>
{
currentMode = (WatchMode)(((int)currentMode + 1) % 3);
SetWatchMode(currentMode);
};;
}
public void SetWatchMode(WatchMode mode)
{
currentMode = mode;
SwitchWatchMode(mode);
}
// 实现按Tap键实现在WatchMode 3个模式切换并通过SwitchWatchMode设置正确的相机模式
private void SwitchWatchMode(WatchMode watchMode)
{
switch (watchMode)
{
case WatchMode.Normal:
SetSeeLines(false);
break;
case WatchMode.Inside:
SetSeeLines(false);
break;
case WatchMode.Outside:
SetSeeLines(true);
break;
default:
throw new ArgumentOutOfRangeException();
}
}
private void SetSeeLines(bool seeLine)
{
int linesLayer = LayerMask.NameToLayer("Lines");
int mask = cam.cullingMask;
if (seeLine)
mask |= 1 << linesLayer; // 打开
else
mask &= ~(1 << linesLayer); // 关闭
cam.cullingMask = mask;
}
}
}