更新一些冲突内容

This commit is contained in:
2025-09-02 01:12:08 +08:00
parent 5365ab6441
commit f9f80aa559
6 changed files with 122 additions and 22 deletions

View File

@@ -37,19 +37,35 @@ namespace Convention
private void Update()
{
Vector3 dxyz = Vector3.zero;
Vector3 rxyz = Vector3.zero;
//Vector3 rxyz = Vector3.zero;
if (Keyboard.current[Key.W].isPressed || Keyboard.current[Key.UpArrow].isPressed)
dxyz += TargetFollow.forward;
{
var temp = TargetFollow.forward;
//temp.y = 0;
dxyz += temp.normalized;
}
if (Keyboard.current[Key.A].isPressed || Keyboard.current[Key.LeftArrow].isPressed)
dxyz += -TargetFollow.right;
{
var temp = TargetFollow.right;
temp.y = 0;
dxyz -= temp.normalized;
}
if (Keyboard.current[Key.D].isPressed || Keyboard.current[Key.RightArrow].isPressed)
dxyz += TargetFollow.right;
{
var temp = TargetFollow.right;
temp.y = 0;
dxyz += temp.normalized;
}
if (Keyboard.current[Key.S].isPressed || Keyboard.current[Key.DownArrow].isPressed)
dxyz += -TargetFollow.forward;
{
var temp = TargetFollow.forward;
//temp.y = 0;
dxyz -= temp.normalized;
}
if (Keyboard.current[Key.Space].isPressed)
dxyz += TargetFollow.up;
dxyz += Vector3.up;
if (Keyboard.current[Key.LeftShift].isPressed)
dxyz += -TargetFollow.up;
dxyz -= Vector3.up;
var drotation = Vector3.zero;
if (isFocus)
@@ -60,13 +76,15 @@ namespace Convention
//
TargetFollow.Translate(dxyz * moveSpeed, Space.Self);
TargetFollow.Translate(dxyz * moveSpeed, Space.World);
TargetFollow.Rotate(drotation * rotationSpeed, Space.Self);
//
if (Keyboard.current[Key.Escape].isPressed)
isFocus = false;
if (Keyboard.current[Key.LeftCtrl].isPressed && Keyboard.current[Key.LeftShift].isPressed)
TargetFollow.localEulerAngles = new(0, TargetFollow.eulerAngles.y, 0);
}
}
}