From 177f7158c1c3a21cbf7544359dbc1e25269ebe3c Mon Sep 17 00:00:00 2001 From: Pasha Bibko <156938226+PashaBibko@users.noreply.github.com> Date: Tue, 18 Nov 2025 10:22:28 +0000 Subject: [PATCH] Added basic player movement --- Assets/Materials/GreenMat.mat | 83 ++++++++++++++++ Assets/Materials/GreenMat.mat.meta | 8 ++ Assets/Scenes/SampleScene.unity | 101 +++++++++++++++++++- Assets/Scripts/GlobalOrbitalUpdater.cs | 18 ---- Assets/Scripts/GlobalOrbitalUpdater.cs.meta | 11 --- Assets/Scripts/OrbitalPosition.cs | 4 +- Assets/Scripts/PlayerController.cs | 8 ++ 7 files changed, 199 insertions(+), 34 deletions(-) create mode 100644 Assets/Materials/GreenMat.mat create mode 100644 Assets/Materials/GreenMat.mat.meta delete mode 100644 Assets/Scripts/GlobalOrbitalUpdater.cs delete mode 100644 Assets/Scripts/GlobalOrbitalUpdater.cs.meta diff --git a/Assets/Materials/GreenMat.mat b/Assets/Materials/GreenMat.mat new file mode 100644 index 0000000..350f06a --- /dev/null +++ b/Assets/Materials/GreenMat.mat @@ -0,0 +1,83 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!21 &2100000 +Material: + serializedVersion: 8 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: GreenMat + m_Shader: {fileID: 46, guid: 0000000000000000f000000000000000, type: 0} + m_Parent: {fileID: 0} + m_ModifiedSerializedProperties: 0 + m_ValidKeywords: [] + m_InvalidKeywords: [] + m_LightmapFlags: 4 + m_EnableInstancingVariants: 0 + m_DoubleSidedGI: 0 + m_CustomRenderQueue: -1 + stringTagMap: {} + disabledShaderPasses: [] + m_LockedProperties: + m_SavedProperties: + serializedVersion: 3 + m_TexEnvs: + - _BumpMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _DetailAlbedoMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _DetailMask: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _DetailNormalMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _EmissionMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _MainTex: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _MetallicGlossMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _OcclusionMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ParallaxMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + m_Ints: [] + m_Floats: + - _BumpScale: 1 + - _Cutoff: 0.5 + - _DetailNormalMapScale: 1 + - _DstBlend: 0 + - _GlossMapScale: 1 + - _Glossiness: 0.5 + - _GlossyReflections: 1 + - _Metallic: 0 + - _Mode: 0 + - _OcclusionStrength: 1 + - _Parallax: 0.02 + - _SmoothnessTextureChannel: 0 + - _SpecularHighlights: 1 + - _SrcBlend: 1 + - _UVSec: 0 + - _ZWrite: 1 + m_Colors: + - _Color: {r: 0, g: 1, b: 0, a: 1} + - _EmissionColor: {r: 0, g: 0, b: 0, a: 1} + m_BuildTextureStacks: [] diff --git a/Assets/Materials/GreenMat.mat.meta b/Assets/Materials/GreenMat.mat.meta new file mode 100644 index 0000000..cea6f55 --- /dev/null +++ b/Assets/Materials/GreenMat.mat.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 2b4111cfdf7255c48b4c3dbcf9e202a6 +NativeFormatImporter: + externalObjects: {} + mainObjectFileID: 2100000 + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scenes/SampleScene.unity b/Assets/Scenes/SampleScene.unity index e989160..1b969d0 100644 --- a/Assets/Scenes/SampleScene.unity +++ b/Assets/Scenes/SampleScene.unity @@ -164,8 +164,8 @@ Transform: 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_LocalScale: {x: 0.4, y: 0.4, z: 0.4} + m_ConstrainProportionsScale: 1 m_Children: [] m_Father: {fileID: 0} m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} @@ -203,7 +203,7 @@ MeshRenderer: m_RenderingLayerMask: 1 m_RendererPriority: 0 m_Materials: - - {fileID: 2100000, guid: a7292488fc42280428b7d5183069b410, type: 2} + - {fileID: 2100000, guid: 2b4111cfdf7255c48b4c3dbcf9e202a6, type: 2} m_StaticBatchInfo: firstSubMesh: 0 subMeshCount: 0 @@ -325,9 +325,104 @@ Transform: m_Children: [] m_Father: {fileID: 0} m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!1 &1486841466 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1486841468} + - component: {fileID: 1486841467} + m_Layer: 0 + m_Name: Light + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!108 &1486841467 +Light: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1486841466} + m_Enabled: 1 + serializedVersion: 10 + m_Type: 1 + m_Shape: 0 + m_Color: {r: 1, g: 1, b: 1, a: 1} + m_Intensity: 1 + m_Range: 10 + m_SpotAngle: 30 + m_InnerSpotAngle: 21.80208 + m_CookieSize: 10 + m_Shadows: + m_Type: 1 + m_Resolution: -1 + m_CustomResolution: -1 + m_Strength: 1 + m_Bias: 0.05 + m_NormalBias: 0.4 + m_NearPlane: 0.2 + m_CullingMatrixOverride: + e00: 1 + e01: 0 + e02: 0 + e03: 0 + e10: 0 + e11: 1 + e12: 0 + e13: 0 + e20: 0 + e21: 0 + e22: 1 + e23: 0 + e30: 0 + e31: 0 + e32: 0 + e33: 1 + m_UseCullingMatrixOverride: 0 + m_Cookie: {fileID: 0} + m_DrawHalo: 0 + m_Flare: {fileID: 0} + m_RenderMode: 0 + m_CullingMask: + serializedVersion: 2 + m_Bits: 4294967295 + m_RenderingLayerMask: 1 + m_Lightmapping: 4 + m_LightShadowCasterMode: 0 + m_AreaSize: {x: 1, y: 1} + m_BounceIntensity: 1 + m_ColorTemperature: 6570 + m_UseColorTemperature: 0 + m_BoundingSphereOverride: {x: 0, y: 0, z: 0, w: 0} + m_UseBoundingSphereOverride: 0 + m_UseViewFrustumForShadowCasterCull: 1 + m_ShadowRadius: 0 + m_ShadowAngle: 0 +--- !u!4 &1486841468 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1486841466} + 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: 0} + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} --- !u!1660057539 &9223372036854775807 SceneRoots: m_ObjectHideFlags: 0 m_Roots: - {fileID: 519420032} - {fileID: 104400498} + - {fileID: 1486841468} diff --git a/Assets/Scripts/GlobalOrbitalUpdater.cs b/Assets/Scripts/GlobalOrbitalUpdater.cs deleted file mode 100644 index 46b111f..0000000 --- a/Assets/Scripts/GlobalOrbitalUpdater.cs +++ /dev/null @@ -1,18 +0,0 @@ -using System.Collections; -using System.Collections.Generic; -using UnityEngine; - -public class GlobalOrbitalUpdater : MonoBehaviour -{ - // Start is called before the first frame update - void Start() - { - - } - - // Update is called once per frame - void Update() - { - - } -} diff --git a/Assets/Scripts/GlobalOrbitalUpdater.cs.meta b/Assets/Scripts/GlobalOrbitalUpdater.cs.meta deleted file mode 100644 index 99285c8..0000000 --- a/Assets/Scripts/GlobalOrbitalUpdater.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: c730cd22059933a4f89df9280cb3216d -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: -1100 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Scripts/OrbitalPosition.cs b/Assets/Scripts/OrbitalPosition.cs index be6b1d1..d4a4c90 100644 --- a/Assets/Scripts/OrbitalPosition.cs +++ b/Assets/Scripts/OrbitalPosition.cs @@ -19,8 +19,8 @@ public class GlobalOrbitalPositionManager : MonoBehaviour List m_ObjectInstances = new(); - [SerializeField, Range(0f, 1f)] float m_RadiusSpeed = 0.5f; - [SerializeField, Range(0f, 1f)] float m_DistanceSpeed = 0.5f; + [SerializeField, Range(0f, Mathf.PI * 2)] float m_RadiusSpeed = 2f; + [SerializeField, Range(0f, 2f)] float m_DistanceSpeed = 2f; [RuntimeInitializeOnLoadMethod(RuntimeInitializeLoadType.BeforeSceneLoad)] private static void OnApplicationStart() diff --git a/Assets/Scripts/PlayerController.cs b/Assets/Scripts/PlayerController.cs index bca044b..d44fed7 100644 --- a/Assets/Scripts/PlayerController.cs +++ b/Assets/Scripts/PlayerController.cs @@ -8,4 +8,12 @@ public class PlayerController : OrbitalPositionBehaviour { m_OrbitalPosition.DistanceFromCentre = 10; } + + public void Update() + { + if (Input.GetKeyDown(KeyCode.Space)) + { + m_OrbitalPosition.DistanceFromCentre += 1; + } + } }