diff --git a/Assets/Scenes/Testing Scenes/YeetScene.unity b/Assets/Scenes/Testing Scenes/YeetScene.unity new file mode 100644 index 0000000..0fb8847 --- /dev/null +++ b/Assets/Scenes/Testing Scenes/YeetScene.unity @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:591ff66476d7a4ed20246a21b182793f83ee71fd0cb3d3b68dd80a74078c5995 +size 15783 diff --git a/Assets/Scenes/Testing Scenes/YeetScene.unity.meta b/Assets/Scenes/Testing Scenes/YeetScene.unity.meta new file mode 100644 index 0000000..015fc57 --- /dev/null +++ b/Assets/Scenes/Testing Scenes/YeetScene.unity.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: 7d479bacc53922e4498008816aade241 +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Behaviours.meta b/Assets/Scripts/Behaviours.meta new file mode 100644 index 0000000..ce3c2d4 --- /dev/null +++ b/Assets/Scripts/Behaviours.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 408c7b3fd4c3afc4c9187c4ad234f2f2 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Behaviours/IYeetable.cs b/Assets/Scripts/Behaviours/IYeetable.cs new file mode 100644 index 0000000..106cf80 --- /dev/null +++ b/Assets/Scripts/Behaviours/IYeetable.cs @@ -0,0 +1,9 @@ +using System.Collections; +using System.Collections.Generic; +using UnityEngine; + +public interface IYeetable +{ + void Hold(GameObject child); + void Yeet(); +} diff --git a/Assets/Scripts/Behaviours/IYeetable.cs.meta b/Assets/Scripts/Behaviours/IYeetable.cs.meta new file mode 100644 index 0000000..284f831 --- /dev/null +++ b/Assets/Scripts/Behaviours/IYeetable.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 2bbcd198578c95d40a2dd8f089364686 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Behaviours/YeetController.cs b/Assets/Scripts/Behaviours/YeetController.cs new file mode 100644 index 0000000..a0874f3 --- /dev/null +++ b/Assets/Scripts/Behaviours/YeetController.cs @@ -0,0 +1,61 @@ +using System.Collections; +using System.Collections.Generic; +using UnityEngine; + +public class YeetController : MonoBehaviour, IYeetable +{ + public GameObject parent { get; set; } + + public float yeetVelocity = 10f; + public float yeetDuration = 2f; + + public enum YeetState { Unheld, Held, Yeeting }; + public YeetState yeetState { get; private set; } = YeetState.Unheld; + + private GameObject _child; + private float _time; + + public void Hold(GameObject child) + { + _child = child; + _child.transform.parent = parent.transform; + + yeetState = YeetState.Held; + } + + public void Yeet() + { + _child.transform.parent = null; + _child.transform.rotation = parent.transform.rotation; + yeetState = YeetState.Yeeting; + _time = yeetDuration; + } + + // Start is called before the first frame update + void Start() + { + + } + + // Update is called once per frame + void Update() + { + switch(yeetState) + { + case YeetState.Yeeting: + _child.transform.position += _child.transform.forward * yeetVelocity * Time.deltaTime; + _time -= Time.deltaTime; + + if(_time <= 0f) + { + yeetState = YeetState.Unheld; + } + break; + case YeetState.Held: + break; + case YeetState.Unheld: + _child = null; + break; + } + } +} \ No newline at end of file diff --git a/Assets/Scripts/Behaviours/YeetController.cs.meta b/Assets/Scripts/Behaviours/YeetController.cs.meta new file mode 100644 index 0000000..99845bf --- /dev/null +++ b/Assets/Scripts/Behaviours/YeetController.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 188bb300967eea14fb681a94fc31f911 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Player Scripts/PlayerInputController.cs b/Assets/Scripts/Player Scripts/PlayerInputController.cs index 7f7bf68..0fee96f 100644 --- a/Assets/Scripts/Player Scripts/PlayerInputController.cs +++ b/Assets/Scripts/Player Scripts/PlayerInputController.cs @@ -28,13 +28,18 @@ public class PlayerInputController : MonoBehaviour private Vector3 m_desiredDirection; private bool m_recievedInput => m_desiredDirection.magnitude != 0; + private YeetController m_yeetController; - + public GameObject child; + public GameObject body; private void Awake() { m_input = GetComponent(); m_controller = GetComponent(); + m_yeetController = GetComponent(); + + body = this.gameObject; } @@ -42,6 +47,7 @@ public class PlayerInputController : MonoBehaviour { ApplyRotation(); ApplyMovement(); + LockAxis(Vector3.up); } @@ -51,6 +57,36 @@ public class PlayerInputController : MonoBehaviour m_desiredDirection = new Vector3(m_recievedInput.x, 0.0f, m_recievedInput.y); } + private void OnTriggerEnter(Collider collider) + { + Debug.Log("Bang!"); + child = collider.gameObject; + } + + private void OnTriggerExit(Collider collider) + { + child = null; + } + + private void OnYeet() + { + m_yeetController.parent = body; + switch (m_yeetController.yeetState) + { + case YeetController.YeetState.Unheld: + if(child) + m_yeetController.Hold(child); + // Grab nearest baby + break; + case YeetController.YeetState.Held: + m_yeetController.Yeet(); + // Yeet baby + break; + case YeetController.YeetState.Yeeting: + // Cooldown? + break; + } + } private void ApplyRotation() { @@ -70,7 +106,8 @@ public class PlayerInputController : MonoBehaviour m_controller.Move(transform.forward * speed * Time.deltaTime); } - - - + private void LockAxis(Vector3 axis) + { + transform.position = Vector3.ProjectOnPlane(transform.position, axis); + } } diff --git a/Assets/Scripts/Player.meta b/Assets/Scripts/Player.meta new file mode 100644 index 0000000..7059f87 --- /dev/null +++ b/Assets/Scripts/Player.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 0899cb5e9885fc441bc2cfd3746b0ed9 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Player/ControllerBase.cs b/Assets/Scripts/Player/ControllerBase.cs new file mode 100644 index 0000000..84b2865 --- /dev/null +++ b/Assets/Scripts/Player/ControllerBase.cs @@ -0,0 +1,65 @@ +using System.Collections; +using System.Collections.Generic; +using UnityEngine; + +public class ControllerBase : MonoBehaviour +{ + public CharacterController characterController; + public float speed = 6f; + public float sensitivity = 10f; + public GameObject body; + public GameObject testChild; + + public YeetController yeetController; + + void Start() + { + + } + + // Update is called once per frame + void Update() + { + Move(); + //Rotate(); + + if(Input.GetButtonDown("Fire1")) + { + yeetController.parent = body; + switch(yeetController.yeetState) + { + case YeetController.YeetState.Unheld: + yeetController.Hold(testChild); + // Grab nearest baby + break; + case YeetController.YeetState.Held: + yeetController.Yeet(); + // Yeet baby + break; + case YeetController.YeetState.Yeeting: + // Cooldown? + break; + } + + } + + } + + void Move() + { + float horizontal = Input.GetAxis("Horizontal"); + float vertical = Input.GetAxis("Vertical"); + + Vector3 move = transform.forward * vertical + transform.right * horizontal; + characterController.Move(speed * Time.deltaTime * move); + } + + void Rotate() + { + float horizontal = Input.GetAxis("Mouse Y"); + + body.transform.Rotate(0, horizontal * sensitivity, 0); + } + + +} diff --git a/Assets/Scripts/Player/ControllerBase.cs.meta b/Assets/Scripts/Player/ControllerBase.cs.meta new file mode 100644 index 0000000..0dd2592 --- /dev/null +++ b/Assets/Scripts/Player/ControllerBase.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 5f1380fc8f7b79446aa26ea089b4362a +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Settings/Input/PlayerControls.inputactions b/Assets/Settings/Input/PlayerControls.inputactions index f39d097..eee88a5 100644 --- a/Assets/Settings/Input/PlayerControls.inputactions +++ b/Assets/Settings/Input/PlayerControls.inputactions @@ -12,6 +12,14 @@ "expectedControlType": "Vector2", "processors": "", "interactions": "" + }, + { + "name": "Yeet", + "type": "Button", + "id": "23ebbd64-55ef-42f7-9f88-d2ea6b5f9677", + "expectedControlType": "Button", + "processors": "", + "interactions": "" } ], "bindings": [ @@ -135,6 +143,28 @@ "action": "Movement", "isComposite": false, "isPartOfComposite": true + }, + { + "name": "", + "id": "e7da0e69-0039-470a-bf8f-079ca8b3c3d6", + "path": "/buttonSouth", + "interactions": "", + "processors": "", + "groups": "", + "action": "Yeet", + "isComposite": false, + "isPartOfComposite": false + }, + { + "name": "", + "id": "21a02656-d443-4954-a0f5-6fc8b87f7107", + "path": "/space", + "interactions": "", + "processors": "", + "groups": "", + "action": "Yeet", + "isComposite": false, + "isPartOfComposite": false } ] } diff --git a/Assets/World Assets/Prefabs/YeetyPlayer Variant.prefab b/Assets/World Assets/Prefabs/YeetyPlayer Variant.prefab new file mode 100644 index 0000000..513e05b --- /dev/null +++ b/Assets/World Assets/Prefabs/YeetyPlayer Variant.prefab @@ -0,0 +1,110 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!114 &1051237570 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 33932531309654967} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 188bb300967eea14fb681a94fc31f911, type: 3} + m_Name: + m_EditorClassIdentifier: + yeetVelocity: 10 + yeetDuration: 2 +--- !u!1001 &2714160732044909285 +PrefabInstance: + m_ObjectHideFlags: 0 + serializedVersion: 2 + m_Modification: + m_TransformParent: {fileID: 0} + m_Modifications: + - target: {fileID: 2725293204815276921, guid: 47d3f018734864140ba302f6972ba575, type: 3} + propertyPath: m_Mesh + value: + objectReference: {fileID: 0} + - target: {fileID: 2725293204815276924, guid: 47d3f018734864140ba302f6972ba575, type: 3} + propertyPath: m_Mesh + value: + objectReference: {fileID: 0} + - target: {fileID: 2725293204815276924, guid: 47d3f018734864140ba302f6972ba575, type: 3} + propertyPath: m_Convex + value: 1 + objectReference: {fileID: 0} + - target: {fileID: 2725293204815276924, guid: 47d3f018734864140ba302f6972ba575, type: 3} + propertyPath: m_IsTrigger + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 2725293204815276927, guid: 47d3f018734864140ba302f6972ba575, type: 3} + propertyPath: m_Mesh + value: + objectReference: {fileID: 0} + - target: {fileID: 2725293205319018834, guid: 47d3f018734864140ba302f6972ba575, type: 3} + propertyPath: m_Name + value: YeetyPlayer Variant + objectReference: {fileID: 0} + - target: {fileID: 2725293205319018844, guid: 47d3f018734864140ba302f6972ba575, type: 3} + propertyPath: m_RootOrder + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 2725293205319018844, guid: 47d3f018734864140ba302f6972ba575, type: 3} + propertyPath: m_LocalPosition.x + value: 1.2684288 + objectReference: {fileID: 0} + - target: {fileID: 2725293205319018844, guid: 47d3f018734864140ba302f6972ba575, type: 3} + propertyPath: m_LocalPosition.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 2725293205319018844, guid: 47d3f018734864140ba302f6972ba575, type: 3} + propertyPath: m_LocalPosition.z + value: -6.7718506 + objectReference: {fileID: 0} + - target: {fileID: 2725293205319018844, guid: 47d3f018734864140ba302f6972ba575, type: 3} + propertyPath: m_LocalRotation.w + value: 1 + objectReference: {fileID: 0} + - target: {fileID: 2725293205319018844, guid: 47d3f018734864140ba302f6972ba575, type: 3} + propertyPath: m_LocalRotation.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 2725293205319018844, guid: 47d3f018734864140ba302f6972ba575, type: 3} + propertyPath: m_LocalRotation.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 2725293205319018844, guid: 47d3f018734864140ba302f6972ba575, type: 3} + propertyPath: m_LocalRotation.z + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 2725293205319018844, guid: 47d3f018734864140ba302f6972ba575, type: 3} + propertyPath: m_LocalEulerAnglesHint.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 2725293205319018844, guid: 47d3f018734864140ba302f6972ba575, type: 3} + propertyPath: m_LocalEulerAnglesHint.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 2725293205319018844, guid: 47d3f018734864140ba302f6972ba575, type: 3} + propertyPath: m_LocalEulerAnglesHint.z + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 2725293205319018846, guid: 47d3f018734864140ba302f6972ba575, type: 3} + propertyPath: m_SlopeLimit + value: 90 + objectReference: {fileID: 0} + - target: {fileID: 2725293205319018847, guid: 47d3f018734864140ba302f6972ba575, type: 3} + propertyPath: body + value: + objectReference: {fileID: 0} + - target: {fileID: 2725293205319018847, guid: 47d3f018734864140ba302f6972ba575, type: 3} + propertyPath: testChild + value: + objectReference: {fileID: 0} + m_RemovedComponents: [] + m_SourcePrefab: {fileID: 100100000, guid: 47d3f018734864140ba302f6972ba575, type: 3} +--- !u!1 &33932531309654967 stripped +GameObject: + m_CorrespondingSourceObject: {fileID: 2725293205319018834, guid: 47d3f018734864140ba302f6972ba575, type: 3} + m_PrefabInstance: {fileID: 2714160732044909285} + m_PrefabAsset: {fileID: 0} diff --git a/Assets/World Assets/Prefabs/YeetyPlayer Variant.prefab.meta b/Assets/World Assets/Prefabs/YeetyPlayer Variant.prefab.meta new file mode 100644 index 0000000..f280892 --- /dev/null +++ b/Assets/World Assets/Prefabs/YeetyPlayer Variant.prefab.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: c3cc089e72190e74aab4c6592121b553 +PrefabImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Packages/manifest.json b/Packages/manifest.json index 8e41497..e8d4675 100644 --- a/Packages/manifest.json +++ b/Packages/manifest.json @@ -10,7 +10,7 @@ "com.unity.render-pipelines.universal": "8.3.1", "com.unity.test-framework": "1.1.19", "com.unity.textmeshpro": "3.0.1", - "com.unity.timeline": "1.3.6", + "com.unity.timeline": "1.3.7", "com.unity.ugui": "1.0.0", "com.unity.modules.ai": "1.0.0", "com.unity.modules.androidjni": "1.0.0", diff --git a/Packages/packages-lock.json b/Packages/packages-lock.json index 2538027..9ef1db4 100644 --- a/Packages/packages-lock.json +++ b/Packages/packages-lock.json @@ -124,10 +124,15 @@ "url": "https://packages.unity.com" }, "com.unity.timeline": { - "version": "1.3.6", + "version": "1.3.7", "depth": 0, "source": "registry", - "dependencies": {}, + "dependencies": { + "com.unity.modules.director": "1.0.0", + "com.unity.modules.animation": "1.0.0", + "com.unity.modules.audio": "1.0.0", + "com.unity.modules.particlesystem": "1.0.0" + }, "url": "https://packages.unity.com" }, "com.unity.ugui": { diff --git a/ProjectSettings/InputManager.asset b/ProjectSettings/InputManager.asset index 1d06bcb..1a96a75 100644 --- a/ProjectSettings/InputManager.asset +++ b/ProjectSettings/InputManager.asset @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:776c8b6c71e1101973e1f3ab569cf9058b857372a8a19210b50b3c1c6a1a42a6 -size 10218 +oid sha256:a5dce8dac1e4beac1b902d7d1db11b3e4785a6f1a97d9fe2d4d0885289b163e4 +size 9731 diff --git a/ProjectSettings/TimelineSettings.asset b/ProjectSettings/TimelineSettings.asset new file mode 100644 index 0000000..c6c19d5 --- /dev/null +++ b/ProjectSettings/TimelineSettings.asset @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:4333bb60f63529ab4ad88b65fe5dfaf7af05a7b4f2b9d64ad4e970ad17cc1514 +size 411