From b66bd382c6ef5902fa51d2131bc1a1a9620bd25b Mon Sep 17 00:00:00 2001 From: AstrlJelly Date: Thu, 26 Jan 2023 18:44:04 -0500 Subject: [PATCH] fixed the input bug tysm ymf <333 ur my hero technically this is a functioning game! gonna get different sfx/sprites working, try to get bezier curves working, then i'll make a pr * fixed that input bug * changed some variable names * getting some more infrastructure for getting the game fully working --- Assets/Resources/Games/dogNinja.prefab | 16 ++++++------ Assets/Scripts/Games/DogNinja/DogNinja.cs | 26 +++++++++++--------- Assets/Scripts/Games/DogNinja/ThrowObject.cs | 22 ++++++----------- 3 files changed, 31 insertions(+), 33 deletions(-) diff --git a/Assets/Resources/Games/dogNinja.prefab b/Assets/Resources/Games/dogNinja.prefab index 011884879..91e2c8902 100644 --- a/Assets/Resources/Games/dogNinja.prefab +++ b/Assets/Resources/Games/dogNinja.prefab @@ -27,7 +27,7 @@ Transform: m_GameObject: {fileID: 119991411479083905} m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} m_LocalPosition: {x: 5.94, y: 1.345, z: 0} - m_LocalScale: {x: 1, y: 1, z: 1} + m_LocalScale: {x: 1.175, y: 1.175, z: 1.175} m_Children: [] m_Father: {fileID: 1671099869309974123} m_RootOrder: 0 @@ -107,8 +107,9 @@ MonoBehaviour: isEligible: 0 triggersAutoplay: 1 startBeat: 0 - CurveFromLeft: {fileID: 1761052573981030483} - CurveFromRight: {fileID: 8610298732975356966} + type: 0 + fromLeft: 0 + curve: {fileID: 0} --- !u!1 &127654075222335198 GameObject: m_ObjectHideFlags: 0 @@ -1260,7 +1261,7 @@ GameObject: m_Icon: {fileID: 0} m_NavMeshLayer: 0 m_StaticEditorFlags: 0 - m_IsActive: 1 + m_IsActive: 0 --- !u!4 &1671099869309974123 Transform: m_ObjectHideFlags: 0 @@ -1801,7 +1802,7 @@ Transform: m_GameObject: {fileID: 5163996841361280296} m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} m_LocalPosition: {x: -17.06, y: 1.345, z: 0} - m_LocalScale: {x: 1, y: 1, z: 1} + m_LocalScale: {x: 1.175, y: 1.175, z: 1.175} m_Children: [] m_Father: {fileID: 1671099869309974123} m_RootOrder: 1 @@ -1881,8 +1882,9 @@ MonoBehaviour: isEligible: 0 triggersAutoplay: 1 startBeat: 0 - CurveFromLeft: {fileID: 1761052573981030483} - CurveFromRight: {fileID: 8610298732975356966} + type: 0 + fromLeft: 0 + curve: {fileID: 0} --- !u!1 &5340671340987037539 GameObject: m_ObjectHideFlags: 0 diff --git a/Assets/Scripts/Games/DogNinja/DogNinja.cs b/Assets/Scripts/Games/DogNinja/DogNinja.cs index 8c8705fc4..2c2e80d14 100644 --- a/Assets/Scripts/Games/DogNinja/DogNinja.cs +++ b/Assets/Scripts/Games/DogNinja/DogNinja.cs @@ -32,7 +32,7 @@ namespace HeavenStudio.Games.Loaders }, new GameAction("ThrowObjectRight", "Throw Right Object") { - function = delegate { DogNinja.instance.ThrowObjectRight(eventCaller.currentEntity.beat); }, + function = delegate { DogNinja.instance.ThrowObjectRight(eventCaller.currentEntity.beat, eventCaller.currentEntity["type"]); }, defaultLength = 2, parameters = new List() { @@ -76,7 +76,7 @@ namespace HeavenStudio.Games public GameObject Dog; public Transform ObjectHolder; public Transform HalvesHolder; - + [Header("Curves")] public BezierCurve3D CurveFromLeft; public BezierCurve3D CurveFromRight; @@ -129,22 +129,24 @@ namespace HeavenStudio.Games public void ThrowObjectLeft(float beat, int ObjType) { - bool fromLeft = true; - Jukebox.PlayOneShotGame("dogNinja/fruit1"); - //GameObject fo = Instantiate(ObjectLeftBase); - //ThrowObject Object = Instantiate(ObjectLeftBase).GetComponent(); - //Object.startBeat = beat; - - //ThrowObjectTEST(); + ThrowObject Object = Instantiate(ObjectLeftBase).GetComponent(); + Object.startBeat = beat; + Object.type = ObjType; + Object.fromLeft = true; + Object.curve = CurveFromLeft; } - public void ThrowObjectRight(float beat) + public void ThrowObjectRight(float beat, int ObjType) { - bool fromLeft = false; - Jukebox.PlayOneShotGame("dogNinja/fruit1"); + + ThrowObject Object = Instantiate(ObjectRightBase).GetComponent(); + Object.startBeat = beat; + Object.type = ObjType; + Object.fromLeft = false; + Object.curve = CurveFromRight; } public void CutEverything(float beat, bool sound) diff --git a/Assets/Scripts/Games/DogNinja/ThrowObject.cs b/Assets/Scripts/Games/DogNinja/ThrowObject.cs index d11098215..f257b01ed 100644 --- a/Assets/Scripts/Games/DogNinja/ThrowObject.cs +++ b/Assets/Scripts/Games/DogNinja/ThrowObject.cs @@ -11,33 +11,30 @@ namespace HeavenStudio.Games.Scripts_DogNinja public class ThrowObject : PlayerActionObject { public float startBeat; + public int type; + public bool fromLeft; bool flying = true; float flyBeats; - public int ObjType; - bool fromLeft; //public ObjectType type; [Header("Curves")] - public BezierCurve3D CurveFromLeft; - public BezierCurve3D CurveFromRight; + public BezierCurve3D curve; private DogNinja game; private void Awake() { game = DogNinja.instance; - - } private void Start() { game.ScheduleInput(startBeat, 1f, InputType.STANDARD_DOWN, Hit, Out, Miss); - + //debug stuff below - Debug.Log("it's a/an "+ObjType); + Debug.Log("it's a/an "+type); } private void Update() @@ -49,12 +46,12 @@ namespace HeavenStudio.Games.Scripts_DogNinja float flyPos = cond.GetPositionFromBeat(startBeat, flyBeats); flyPos *= 0.6f; - if (fromLeft) + /* if (fromLeft) { transform.position = CurveFromLeft.GetPoint(flyPos); } else { transform.position = CurveFromRight.GetPoint(flyPos); - } + } */ // DESTROYS GAME OBJECT! UNINTENTIONALLY! /* if (flyPos > 1f) @@ -64,12 +61,9 @@ namespace HeavenStudio.Games.Scripts_DogNinja } */ } } - + void CutObject() { - //flying = false; - - //game.headAndBodyAnim.Play("BiteR", 0, 0); Jukebox.PlayOneShotGame("dogNinja/fruit2"); //SpawnHalves();