feat: scene built, basic function completed

This commit is contained in:
2026-07-03 22:06:54 +08:00
parent 1995835c12
commit 99bcfccc94
8 changed files with 221 additions and 191 deletions

View File

@@ -216,6 +216,52 @@ Transform:
m_Children: []
m_Father: {fileID: 0}
m_LocalEulerAnglesHint: {x: 50, y: -30, z: 0}
--- !u!1 &755090841
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 755090842}
- component: {fileID: 755090843}
m_Layer: 0
m_Name: CameraBoot
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!4 &755090842
Transform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 755090841}
serializedVersion: 2
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0
m_Children:
- {fileID: 963194228}
m_Father: {fileID: 1916791294}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!114 &755090843
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 755090841}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: d5fcaeb18225e04419f9a3d6c48546a5, type: 3}
m_Name:
m_EditorClassIdentifier:
mouseSpeed: 500
--- !u!1 &963194225
GameObject:
m_ObjectHideFlags: 0
@@ -302,104 +348,12 @@ Transform:
m_GameObject: {fileID: 963194225}
serializedVersion: 2
m_LocalRotation: {x: 0.44279677, y: -0, z: -0, w: 0.89662206}
m_LocalPosition: {x: 0, y: 5, z: -5.57}
m_LocalPosition: {x: 0.67767763, y: 2.292, z: -2.217}
m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0
m_Children: []
m_Father: {fileID: 0}
m_Father: {fileID: 755090842}
m_LocalEulerAnglesHint: {x: 52.565, y: 0, z: 0}
--- !u!1 &1641063756
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 1641063757}
- component: {fileID: 1641063759}
- component: {fileID: 1641063758}
m_Layer: 0
m_Name: player
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!4 &1641063757
Transform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1641063756}
serializedVersion: 2
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0
m_Children: []
m_Father: {fileID: 1916791294}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!81 &1641063758
AudioListener:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1641063756}
m_Enabled: 1
--- !u!20 &1641063759
Camera:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1641063756}
m_Enabled: 1
serializedVersion: 2
m_ClearFlags: 1
m_BackGroundColor: {r: 0.19215687, g: 0.3019608, b: 0.4745098, a: 0}
m_projectionMatrixMode: 1
m_GateFitMode: 2
m_FOVAxisMode: 0
m_Iso: 200
m_ShutterSpeed: 0.005
m_Aperture: 16
m_FocusDistance: 10
m_FocalLength: 50
m_BladeCount: 5
m_Curvature: {x: 2, y: 11}
m_BarrelClipping: 0.25
m_Anamorphism: 0
m_SensorSize: {x: 36, y: 24}
m_LensShift: {x: 0, y: 0}
m_NormalizedViewPortRect:
serializedVersion: 2
x: 0
y: 0
width: 1
height: 1
near clip plane: 0.3
far clip plane: 1000
field of view: 60
orthographic: 0
orthographic size: 5
m_Depth: 0
m_CullingMask:
serializedVersion: 2
m_Bits: 4294967295
m_RenderingPath: -1
m_TargetTexture: {fileID: 0}
m_TargetDisplay: 0
m_TargetEye: 3
m_HDR: 1
m_AllowMSAA: 1
m_AllowDynamicResolution: 0
m_ForceIntoRT: 0
m_OcclusionCulling: 1
m_StereoConvergence: 10
m_StereoSeparation: 0.022
--- !u!1 &1916791289
GameObject:
m_ObjectHideFlags: 0
@@ -414,6 +368,7 @@ GameObject:
- component: {fileID: 1916791291}
- component: {fileID: 1916791290}
- component: {fileID: 1916791295}
- component: {fileID: 1916791298}
m_Layer: 0
m_Name: Cube
m_TagString: Untagged
@@ -518,7 +473,7 @@ MeshFilter:
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1916791289}
m_Mesh: {fileID: 10202, guid: 0000000000000000e000000000000000, type: 0}
m_Mesh: {fileID: 10207, guid: 0000000000000000e000000000000000, type: 0}
--- !u!4 &1916791294
Transform:
m_ObjectHideFlags: 0
@@ -532,7 +487,7 @@ Transform:
m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0
m_Children:
- {fileID: 1641063757}
- {fileID: 755090842}
m_Father: {fileID: 0}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!114 &1916791295
@@ -550,6 +505,19 @@ MonoBehaviour:
speed: 5
rb: {fileID: 0}
jumpForce: 5
--- !u!114 &1916791298
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1916791289}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 54f70d5af29a406987058ba50db0a636, type: 3}
m_Name:
m_EditorClassIdentifier:
mouseSpeed: 20
--- !u!1 &2036601234
GameObject:
m_ObjectHideFlags: 0
@@ -660,7 +628,6 @@ Transform:
SceneRoots:
m_ObjectHideFlags: 0
m_Roots:
- {fileID: 963194228}
- {fileID: 705507995}
- {fileID: 2036601238}
- {fileID: 1916791294}

View File

@@ -0,0 +1,18 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class CameraControllerX : MonoBehaviour
{
[SerializeField]
private float mouseSpeed = 20f;
void Update()
{
float mouseX = Input.GetAxis("Mouse X");
transform.Rotate(Vector3.up * (mouseX * mouseSpeed));
}
}

View File

@@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: 54f70d5af29a406987058ba50db0a636
timeCreated: 1783053068

View File

@@ -0,0 +1,24 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class CameraControllerY : MonoBehaviour
{
[SerializeField]
private float mouseSpeed = 500f;
private float pitch = 0f;
// Update is called once per frame
void Update()
{
float mouseY = Input.GetAxis("Mouse Y");
pitch -= mouseY * mouseSpeed * Time.deltaTime;
pitch = Mathf.Clamp(pitch, -90f, 30f);
transform.localRotation = Quaternion.Euler(pitch, 0f, 0f);
}
}

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: d5fcaeb18225e04419f9a3d6c48546a5
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -1,52 +1,59 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class Moving : MonoBehaviour
{
public float speed = 5f;
[SerializeField]
private Rigidbody rb;
[SerializeField]
private float jumpForce = 5f;
void Start()
{
}
// Update is called once per frame
void Update()
{
Vector3 direction = Vector3.zero;
if (Input.GetKey(KeyCode.W))
direction += Vector3.forward;
if (Input.GetKey(KeyCode.S))
direction += Vector3.back;
if (Input.GetKey(KeyCode.A))
direction += Vector3.left;
if (Input.GetKey(KeyCode.D))
direction += Vector3.right;
if (Input.GetKeyDown(KeyCode.Space))
rb.AddForce(Vector3.up * jumpForce, ForceMode.Impulse);
if (Input.GetKey(KeyCode.LeftControl))
Debug.Log("left ctrl active");
direction = direction.normalized;
transform.position += direction * (speed * Time.deltaTime);
}
}
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class Moving : MonoBehaviour
{
public float speed = 5f;
[SerializeField]
private Rigidbody rb;
[SerializeField]
private float jumpForce = 5f;
void Awake(){
rb = GetComponent<Rigidbody>();
}
void Start()
{
}
// Update is called once per frame
void Update()
{
Vector3 direction = Vector3.zero;
if (Input.GetKey(KeyCode.W))
direction += Vector3.forward;
if (Input.GetKey(KeyCode.S))
direction += Vector3.back;
if (Input.GetKey(KeyCode.A))
direction += Vector3.left;
if (Input.GetKey(KeyCode.D))
direction += Vector3.right;
if (Input.GetKeyDown(KeyCode.Space))
rb.AddForce(Vector3.up * jumpForce, ForceMode.Impulse);
if (Input.GetKey(KeyCode.LeftControl))
Debug.Log("left ctrl active");
direction = direction.normalized;
transform.position += direction * (speed * Time.deltaTime);
}
}