nearly the entire dog ninja rework

lol. didn't think it would be this easy
just a few more things to fix and we're good
This commit is contained in:
AstrlJelly 2024-03-04 15:18:24 -05:00
parent b72440ca3c
commit 76419b93d4
9 changed files with 233 additions and 1569 deletions

View file

@ -97,17 +97,7 @@ MonoBehaviour:
m_Script: {fileID: 11500000, guid: 5ac06902fd6630045a550c76211fcc63, type: 3} m_Script: {fileID: 11500000, guid: 5ac06902fd6630045a550c76211fcc63, type: 3}
m_Name: m_Name:
m_EditorClassIdentifier: m_EditorClassIdentifier:
inList: 0 game: {fileID: 4542966729274958099}
state:
gameObject: {fileID: 119991411479083905}
early: 0
perfect: 0
late: 0
createBeat: 0
eligibleHitsList: []
aceTimes: 0
isEligible: 0
triggersAutoplay: 1
startBeat: 0 startBeat: 0
type: 0 type: 0
fromLeft: 0 fromLeft: 0
@ -115,7 +105,8 @@ MonoBehaviour:
direction: 0 direction: 0
sfxNum: sfxNum:
curve: {fileID: 0} curve: {fileID: 0}
barelyCurve: {fileID: 0} LeftCurve: {fileID: 2592536718110886033}
RightCurve: {fileID: 8538313959133990924}
BarelyLeftCurve: {fileID: 5959598018215963193} BarelyLeftCurve: {fileID: 5959598018215963193}
BarelyRightCurve: {fileID: 4156529297438955755} BarelyRightCurve: {fileID: 4156529297438955755}
HalvesLeftBase: {fileID: 8462363345267808632} HalvesLeftBase: {fileID: 8462363345267808632}
@ -544,17 +535,6 @@ MonoBehaviour:
m_Script: {fileID: 11500000, guid: 6f3ef60f47c093b45a623a707f33c877, type: 3} m_Script: {fileID: 11500000, guid: 6f3ef60f47c093b45a623a707f33c877, type: 3}
m_Name: m_Name:
m_EditorClassIdentifier: m_EditorClassIdentifier:
inList: 0
state:
gameObject: {fileID: 0}
early: 0
perfect: 0
late: 0
createBeat: 0
eligibleHitsList: []
aceTimes: 0
isEligible: 0
triggersAutoplay: 1
startBeat: 0 startBeat: 0
objPos: {x: 0, y: 0, z: 0} objPos: {x: 0, y: 0, z: 0}
lefty: 0 lefty: 0
@ -1695,9 +1675,7 @@ MonoBehaviour:
looping: 0 looping: 0
offset: 0 offset: 0
parameters: [] parameters: []
EligibleHits: []
scheduledInputs: [] scheduledInputs: []
firstEnable: 0
DogAnim: {fileID: 1770250701376598399} DogAnim: {fileID: 1770250701376598399}
BirdAnim: {fileID: 4964290445827434540} BirdAnim: {fileID: 4964290445827434540}
ObjectBase: {fileID: 119991411479083905} ObjectBase: {fileID: 119991411479083905}
@ -1728,6 +1706,8 @@ MonoBehaviour:
- {fileID: 2196219148037962045, guid: 4e56f90ec52abea4ea8c4c7bb6df84d5, type: 3} - {fileID: 2196219148037962045, guid: 4e56f90ec52abea4ea8c4c7bb6df84d5, type: 3}
- {fileID: -6292424158522327523, guid: 4e56f90ec52abea4ea8c4c7bb6df84d5, type: 3} - {fileID: -6292424158522327523, guid: 4e56f90ec52abea4ea8c4c7bb6df84d5, type: 3}
- {fileID: 2053246660185171032, guid: 4e56f90ec52abea4ea8c4c7bb6df84d5, type: 3} - {fileID: 2053246660185171032, guid: 4e56f90ec52abea4ea8c4c7bb6df84d5, type: 3}
queuePrepare: 0
preparing: 0
--- !u!1 &3156757135167865752 --- !u!1 &3156757135167865752
GameObject: GameObject:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0
@ -4165,17 +4145,6 @@ MonoBehaviour:
m_Script: {fileID: 11500000, guid: 6f3ef60f47c093b45a623a707f33c877, type: 3} m_Script: {fileID: 11500000, guid: 6f3ef60f47c093b45a623a707f33c877, type: 3}
m_Name: m_Name:
m_EditorClassIdentifier: m_EditorClassIdentifier:
inList: 0
state:
gameObject: {fileID: 0}
early: 0
perfect: 0
late: 0
createBeat: 0
eligibleHitsList: []
aceTimes: 0
isEligible: 0
triggersAutoplay: 1
startBeat: 0 startBeat: 0
objPos: {x: 0, y: 0, z: 0} objPos: {x: 0, y: 0, z: 0}
lefty: 1 lefty: 1
@ -4730,15 +4699,17 @@ MonoBehaviour:
m_lineSpacingMax: 0 m_lineSpacingMax: 0
m_paragraphSpacing: 0 m_paragraphSpacing: 0
m_charWidthMaxAdj: 0 m_charWidthMaxAdj: 0
m_enableWordWrapping: 1 m_TextWrappingMode: 1
m_wordWrappingRatios: 0.4 m_wordWrappingRatios: 0.4
m_overflowMode: 0 m_overflowMode: 0
m_linkedTextComponent: {fileID: 0} m_linkedTextComponent: {fileID: 0}
parentLinkedComponent: {fileID: 0} parentLinkedComponent: {fileID: 0}
m_enableKerning: 1 m_enableKerning: 1
m_ActiveFontFeatures: 00000000
m_enableExtraPadding: 0 m_enableExtraPadding: 0
checkPaddingRequired: 0 checkPaddingRequired: 0
m_isRichText: 1 m_isRichText: 1
m_EmojiFallbackSupport: 1
m_parseCtrlCharacters: 1 m_parseCtrlCharacters: 1
m_isOrthographic: 0 m_isOrthographic: 0
m_isCullingEnabled: 0 m_isCullingEnabled: 0

View file

@ -54,31 +54,6 @@ AnimatorState:
m_MirrorParameter: m_MirrorParameter:
m_CycleOffsetParameter: m_CycleOffsetParameter:
m_TimeParameter: m_TimeParameter:
--- !u!1101 &-8879658034113408578
AnimatorStateTransition:
m_ObjectHideFlags: 1
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_Name:
m_Conditions:
- m_ConditionMode: 1
m_ConditionEvent: needPrepare
m_EventTreshold: 0
m_DstStateMachine: {fileID: 0}
m_DstState: {fileID: 5009988345090580314}
m_Solo: 0
m_Mute: 0
m_IsExit: 0
serializedVersion: 3
m_TransitionDuration: 0
m_TransitionOffset: 0
m_ExitTime: 1
m_HasExitTime: 1
m_HasFixedDuration: 0
m_InterruptionSource: 0
m_OrderedInterruption: 1
m_CanTransitionToSelf: 1
--- !u!1102 &-7628548708072257747 --- !u!1102 &-7628548708072257747
AnimatorState: AnimatorState:
serializedVersion: 6 serializedVersion: 6
@ -333,31 +308,6 @@ AnimatorController:
m_IKPass: 0 m_IKPass: 0
m_SyncedLayerAffectsTiming: 0 m_SyncedLayerAffectsTiming: 0
m_Controller: {fileID: 9100000} m_Controller: {fileID: 9100000}
--- !u!1101 &634343083532807637
AnimatorStateTransition:
m_ObjectHideFlags: 1
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_Name:
m_Conditions:
- m_ConditionMode: 2
m_ConditionEvent: needPrepare
m_EventTreshold: 0
m_DstStateMachine: {fileID: 0}
m_DstState: {fileID: 1628397019354410076}
m_Solo: 0
m_Mute: 0
m_IsExit: 0
serializedVersion: 3
m_TransitionDuration: 0
m_TransitionOffset: 0
m_ExitTime: 1
m_HasExitTime: 1
m_HasFixedDuration: 1
m_InterruptionSource: 0
m_OrderedInterruption: 1
m_CanTransitionToSelf: 1
--- !u!1102 &1183219720229009387 --- !u!1102 &1183219720229009387
AnimatorState: AnimatorState:
serializedVersion: 6 serializedVersion: 6
@ -368,9 +318,7 @@ AnimatorState:
m_Name: Prepare m_Name: Prepare
m_Speed: 1 m_Speed: 1
m_CycleOffset: 0 m_CycleOffset: 0
m_Transitions: m_Transitions: []
- {fileID: -8879658034113408578}
- {fileID: 634343083532807637}
m_StateMachineBehaviours: [] m_StateMachineBehaviours: []
m_Position: {x: 50, y: 50, z: 0} m_Position: {x: 50, y: 50, z: 0}
m_IKOnFeet: 0 m_IKOnFeet: 0
@ -563,9 +511,6 @@ AnimatorStateMachine:
- serializedVersion: 1 - serializedVersion: 1
m_State: {fileID: 4106059006902303284} m_State: {fileID: 4106059006902303284}
m_Position: {x: 400, y: 90, z: 0} m_Position: {x: 400, y: 90, z: 0}
- serializedVersion: 1
m_State: {fileID: 5009988345090580314}
m_Position: {x: 620, y: -110, z: 0}
m_ChildStateMachines: [] m_ChildStateMachines: []
m_AnyStateTransitions: [] m_AnyStateTransitions: []
m_EntryTransitions: [] m_EntryTransitions: []
@ -576,33 +521,6 @@ AnimatorStateMachine:
m_ExitPosition: {x: 420, y: 210, z: 0} m_ExitPosition: {x: 420, y: 210, z: 0}
m_ParentStateMachinePosition: {x: 800, y: 20, z: 0} m_ParentStateMachinePosition: {x: 800, y: 20, z: 0}
m_DefaultState: {fileID: 1628397019354410076} m_DefaultState: {fileID: 1628397019354410076}
--- !u!1102 &5009988345090580314
AnimatorState:
serializedVersion: 6
m_ObjectHideFlags: 1
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_Name: PrepareIdle
m_Speed: 1
m_CycleOffset: 0
m_Transitions:
- {fileID: 7023587105086888360}
m_StateMachineBehaviours: []
m_Position: {x: 50, y: 50, z: 0}
m_IKOnFeet: 0
m_WriteDefaultValues: 1
m_Mirror: 0
m_SpeedParameterActive: 0
m_MirrorParameterActive: 0
m_CycleOffsetParameterActive: 0
m_TimeParameterActive: 0
m_Motion: {fileID: 7400000, guid: f9b4fb8d229e1d840b1663408bebfd18, type: 2}
m_Tag:
m_SpeedParameter:
m_MirrorParameter:
m_CycleOffsetParameter:
m_TimeParameter:
--- !u!1101 &5032805319851727948 --- !u!1101 &5032805319851727948
AnimatorStateTransition: AnimatorStateTransition:
m_ObjectHideFlags: 1 m_ObjectHideFlags: 1
@ -669,31 +587,6 @@ AnimatorStateTransition:
m_InterruptionSource: 0 m_InterruptionSource: 0
m_OrderedInterruption: 1 m_OrderedInterruption: 1
m_CanTransitionToSelf: 1 m_CanTransitionToSelf: 1
--- !u!1101 &7023587105086888360
AnimatorStateTransition:
m_ObjectHideFlags: 1
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_Name:
m_Conditions:
- m_ConditionMode: 2
m_ConditionEvent: needPrepare
m_EventTreshold: 0
m_DstStateMachine: {fileID: 0}
m_DstState: {fileID: 1628397019354410076}
m_Solo: 0
m_Mute: 0
m_IsExit: 0
serializedVersion: 3
m_TransitionDuration: 0
m_TransitionOffset: 0
m_ExitTime: 1
m_HasExitTime: 1
m_HasFixedDuration: 1
m_InterruptionSource: 0
m_OrderedInterruption: 1
m_CanTransitionToSelf: 1
--- !u!1102 &7232969264737895159 --- !u!1102 &7232969264737895159
AnimatorState: AnimatorState:
serializedVersion: 6 serializedVersion: 6
@ -701,11 +594,10 @@ AnimatorState:
m_CorrespondingSourceObject: {fileID: 0} m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0} m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0} m_PrefabAsset: {fileID: 0}
m_Name: UnPrepare m_Name: Unprepare
m_Speed: 1 m_Speed: 1
m_CycleOffset: 0 m_CycleOffset: 0
m_Transitions: m_Transitions: []
- {fileID: 7451574809715408383}
m_StateMachineBehaviours: [] m_StateMachineBehaviours: []
m_Position: {x: 50, y: 50, z: 0} m_Position: {x: 50, y: 50, z: 0}
m_IKOnFeet: 0 m_IKOnFeet: 0
@ -721,28 +613,6 @@ AnimatorState:
m_MirrorParameter: m_MirrorParameter:
m_CycleOffsetParameter: m_CycleOffsetParameter:
m_TimeParameter: m_TimeParameter:
--- !u!1101 &7451574809715408383
AnimatorStateTransition:
m_ObjectHideFlags: 1
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_Name:
m_Conditions: []
m_DstStateMachine: {fileID: 0}
m_DstState: {fileID: 1628397019354410076}
m_Solo: 0
m_Mute: 0
m_IsExit: 0
serializedVersion: 3
m_TransitionDuration: 0
m_TransitionOffset: 0
m_ExitTime: 1
m_HasExitTime: 1
m_HasFixedDuration: 1
m_InterruptionSource: 0
m_OrderedInterruption: 1
m_CanTransitionToSelf: 1
--- !u!1102 &8456159042725552206 --- !u!1102 &8456159042725552206
AnimatorState: AnimatorState:
serializedVersion: 6 serializedVersion: 6

View file

@ -450,7 +450,7 @@ AnimationClip:
m_Level: 0 m_Level: 0
m_CycleOffset: 0 m_CycleOffset: 0
m_HasAdditiveReferencePose: 0 m_HasAdditiveReferencePose: 0
m_LoopTime: 1 m_LoopTime: 0
m_LoopBlend: 0 m_LoopBlend: 0
m_LoopBlendOrientation: 0 m_LoopBlendOrientation: 0
m_LoopBlendPositionY: 0 m_LoopBlendPositionY: 0

View file

@ -1,8 +0,0 @@
fileFormatVersion: 2
guid: f9b4fb8d229e1d840b1663408bebfd18
NativeFormatImporter:
externalObjects: {}
mainObjectFileID: 0
userData:
assetBundleName:
assetBundleVariant:

View file

@ -492,7 +492,7 @@ AnimationClip:
m_Level: 0 m_Level: 0
m_CycleOffset: 0 m_CycleOffset: 0
m_HasAdditiveReferencePose: 0 m_HasAdditiveReferencePose: 0
m_LoopTime: 1 m_LoopTime: 0
m_LoopBlend: 0 m_LoopBlend: 0
m_LoopBlendOrientation: 0 m_LoopBlendOrientation: 0
m_LoopBlendPositionY: 0 m_LoopBlendPositionY: 0

View file

@ -17,7 +17,12 @@ namespace HeavenStudio.Games.Loaders
{ {
new GameAction("Bop", "Bop") new GameAction("Bop", "Bop")
{ {
function = delegate { DogNinja.instance.Bop(eventCaller.currentEntity.beat, eventCaller.currentEntity.length, eventCaller.currentEntity["auto"], eventCaller.currentEntity["toggle"]); }, function = delegate {
var e = eventCaller.currentEntity;
if (eventCaller.gameManager.minigameObj.TryGetComponent(out DogNinja instance)) {
instance.Bop(e.beat, e.length, e["auto"], e["toggle"]);
}
},
resizable = true, resizable = true,
parameters = new List<Param>() parameters = new List<Param>()
{ {
@ -27,17 +32,39 @@ namespace HeavenStudio.Games.Loaders
}, },
new GameAction("Prepare", "Prepare") new GameAction("Prepare", "Prepare")
{ {
function = delegate { DogNinja.instance.Prepare(eventCaller.currentEntity.beat); }, function = delegate {
if (eventCaller.gameManager.minigameObj.TryGetComponent(out DogNinja instance)) {
instance.Prepare(eventCaller.currentEntity.beat);
}
},
defaultLength = 0.5f, defaultLength = 0.5f,
}, },
new GameAction("ThrowObject", "Throw Object") new GameAction("ThrowObject", "Throw Object")
{ {
function = delegate { var e = eventCaller.currentEntity; DogNinja.QueueObject(e.beat, e["direction"], e["typeL"], e["typeR"], e["shouldPrepare"], false); }, // function = delegate {
inactiveFunction = delegate { var e = eventCaller.currentEntity; DogNinja.QueueObject(e.beat, e["direction"], e["typeL"], e["typeR"], e["shouldPrepare"], e["muteThrow"]); }, // var e = eventCaller.currentEntity;
// (int typeL, int typeR) = e["diffObjs"] ? ((int)e["typeL"], (int)e["typeR"]) : ((int)e["type"], (int)e["type"]);
// DogNinja.QueueObject(e.beat, e["direction"], e["diffObjs"], typeL, typeR, e["shouldPrepare"], false, e);
// },
// inactiveFunction = delegate {
// var e = eventCaller.currentEntity;
// (int typeL, int typeR) = e["diffObjs"] ? ((int)e["typeL"], (int)e["typeR"]) : ((int)e["type"], (int)e["type"]);
// DogNinja.QueueObject(e.beat, e["direction"], e["diffObjs"], typeL, typeR, e["shouldPrepare"], e["muteThrow"], e);
// },
preFunction = delegate {
var e = eventCaller.currentEntity;
(int typeL, int typeR) = e["diffObjs"] ? ((int)e["typeL"], (int)e["typeR"]) : ((int)e["type"], (int)e["type"]);
DogNinja.QueueObject(e.beat, e["direction"], e["diffObjs"], e["type"], typeL, typeR, e["shouldPrepare"], e["muteThrow"], e);
},
defaultLength = 2, defaultLength = 2,
parameters = new List<Param>() parameters = new List<Param>()
{ {
new Param("direction", DogNinja.ObjectDirection.Left, "Which Side", "Choose the side(s) the object(s) should be thrown from."), new Param("direction", DogNinja.ObjectDirection.Left, "Which Side", "Choose the side(s) the object(s) should be thrown from."),
new Param("diffObjs", false, "Different Objects", "Toggle if the sides should be different.", new() {
new((x, _) => (bool)x, "typeL", "typeR"),
new((x, _) => !(bool)x, "type"),
}),
new Param("type", DogNinja.ObjectType.Random, "Object", "Choose the object to be thrown."),
new Param("typeL", DogNinja.ObjectType.Random, "Left Object", "Choose the object to be thrown from the left."), new Param("typeL", DogNinja.ObjectType.Random, "Left Object", "Choose the object to be thrown from the left."),
new Param("typeR", DogNinja.ObjectType.Random, "Right Object", "Choose the object to be thrown from the right."), new Param("typeR", DogNinja.ObjectType.Random, "Right Object", "Choose the object to be thrown from the right."),
new Param("shouldPrepare", true, "Prepare", "Toggle if Dog Ninja should automatically prepare for this cue."), new Param("shouldPrepare", true, "Prepare", "Toggle if Dog Ninja should automatically prepare for this cue."),
@ -46,57 +73,27 @@ namespace HeavenStudio.Games.Loaders
}, },
new GameAction("CutEverything", "Mister Eagle's Sign") new GameAction("CutEverything", "Mister Eagle's Sign")
{ {
function = delegate { var e = eventCaller.currentEntity; DogNinja.instance.CutEverything(e.beat, e["toggle"], e["text"]); }, function = delegate {
defaultLength = 0.5f, var e = eventCaller.currentEntity;
if (eventCaller.gameManager.minigameObj.TryGetComponent(out DogNinja instance)) {
instance.CutEverything(e.beat, e.length, e["toggle"], e["text"]);
}
},
defaultLength = 4f,
resizable = true,
parameters = new List<Param>() parameters = new List<Param>()
{ {
new Param("toggle", true, "Play Sound", "Toggle if the sound effect should play for flying in and out."), new Param("toggle", true, "Play Sound", "Toggle if the sound effect should play for flying in."),
new Param("text", "Cut everything!", "Sign Text", "Set the text to be displayed on the sign.") new Param("text", "Cut everything!", "Sign Text", "Set the text to be displayed on the sign.")
} }
}, },
new GameAction("HereWeGo", "Here We Go!") new GameAction("HereWeGo", "Here We Go!")
{ {
function = delegate { DogNinja.instance.HereWeGo(eventCaller.currentEntity.beat); }, function = delegate { DogNinja.HereWeGo(eventCaller.currentEntity.beat); },
inactiveFunction = delegate { DogNinja.HereWeGo(eventCaller.currentEntity.beat); },
defaultLength = 2, defaultLength = 2,
inactiveFunction = delegate { DogNinja.HereWeGoInactive(eventCaller.currentEntity.beat); },
preFunctionLength = 1, preFunctionLength = 1,
}, },
// these are still here for backwards-compatibility but are hidden in the editor
new GameAction("ThrowObjectLeft", "Throw Object Left")
{
function = delegate { var e = eventCaller.currentEntity; DogNinja.QueueObject(e.beat, 0, e["type"], 0, true, false);},
defaultLength = 2,
hidden = true,
parameters = new List<Param>()
{
new Param("type", DogNinja.ObjectType.Random, "Object", "The object to be thrown"),
},
inactiveFunction = delegate { var e = eventCaller.currentEntity; DogNinja.QueueObject(e.beat, 0, e["type"], 0, true, false);},
},
new GameAction("ThrowObjectRight", "Throw Object Right")
{
function = delegate { var e = eventCaller.currentEntity; DogNinja.QueueObject(e.beat, 1, 0, e["type"], true, false);},
defaultLength = 2,
hidden = true,
parameters = new List<Param>()
{
new Param("type", DogNinja.ObjectType.Random, "Object", "The object to be thrown"),
},
inactiveFunction = delegate { var e = eventCaller.currentEntity; DogNinja.QueueObject(e.beat, 1, 0, e["type"], true, false);},
},
new GameAction("ThrowObjectBoth", "Throw Object Both")
{
function = delegate { var e = eventCaller.currentEntity; DogNinja.QueueObject(e.beat, 2, e["typeL"], e["typeR"], true, false);},
defaultLength = 2,
hidden = true,
parameters = new List<Param>()
{
new Param("typeL", DogNinja.ObjectType.Random, "Left Object", "The object on the left to be thrown"),
new Param("typeR", DogNinja.ObjectType.Random, "Right Object", "The object on the right to be thrown"),
},
inactiveFunction = delegate { var e = eventCaller.currentEntity; DogNinja.QueueObject(e.beat, 2, e["typeL"], e["typeR"], true, false);},
},
}, },
new List<string>() { "ntr", "normal" }, new List<string>() { "ntr", "normal" },
"ntrninja", "en", "ntrninja", "en",
@ -108,18 +105,14 @@ namespace HeavenStudio.Games.Loaders
namespace HeavenStudio.Games namespace HeavenStudio.Games
{ {
using Jukebox;
using Scripts_DogNinja; using Scripts_DogNinja;
public class DogNinja : Minigame public class DogNinja : Minigame
{ {
static List<QueuedThrow> queuedThrows = new List<QueuedThrow>();
struct QueuedThrow struct QueuedThrow
{ {
public double beat; public int[] types;
public int direction; public string sfxNumL, sfxNumR;
public int typeL;
public int typeR;
public string sfxNumL;
public string sfxNumR;
} }
[Header("Animators")] [Header("Animators")]
@ -140,10 +133,9 @@ namespace HeavenStudio.Games
[SerializeField] Sprite[] ObjectTypes; [SerializeField] Sprite[] ObjectTypes;
private bool birdOnScreen = false; private bool autoBop;
private const string sfxNum = "dogNinja/"; public bool queuePrepare;
public bool preparing;
public static DogNinja instance;
public enum ObjectDirection public enum ObjectDirection
{ {
@ -152,7 +144,7 @@ namespace HeavenStudio.Games
Both, Both,
} }
public enum ObjectType public enum ObjectType : int
{ {
Random, // random fruit Random, // random fruit
Apple, // fruit Apple, // fruit
@ -195,199 +187,176 @@ namespace HeavenStudio.Games
new("NtrNinjaTouchRelease", new int[] { IAEmptyCat, IAReleaseCat, IAEmptyCat }, new("NtrNinjaTouchRelease", new int[] { IAEmptyCat, IAReleaseCat, IAEmptyCat },
IA_Empty, IA_TouchBasicRelease, IA_Empty); IA_Empty, IA_TouchBasicRelease, IA_Empty);
private void Awake() public override void OnLateBeatPulse(double beat)
{ {
instance = this; if (autoBop && preparing && (DogAnim.IsAnimationNotPlaying() || DogAnim.IsPlayingAnimationNames("Idle"))) {
SetupBopRegion("dogNinja", "Bop", "auto");
}
void OnDestroy()
{
if (!Conductor.instance.isPlaying || Conductor.instance.isPaused)
{
if (queuedThrows.Count > 0) queuedThrows.Clear();
}
foreach (var evt in scheduledInputs)
{
evt.Disable();
}
}
public override void OnBeatPulse(double beat)
{
if (BeatIsInBopRegion(beat) && DogAnim.IsAnimationNotPlaying() || DogAnim.IsPlayingAnimationNames("Idle")) {
DogAnim.DoScaledAnimationAsync("Bop", 0.5f); DogAnim.DoScaledAnimationAsync("Bop", 0.5f);
} }
} }
public override void OnPlay(double beat) => Persist(beat, true);
public override void OnGameSwitch(double beat) => Persist(beat, false);
private void Persist(double beat, bool onPlay)
{
foreach (var e in gameManager.Beatmap.Entities.FindAll(e => e.datamodel is "dogNinja/ThrowObject" && beat > (onPlay ? e.beat : e.beat - 2) && beat < e.beat + 1))
{
QueuedThrow t = new();
if (e.dynamicData.TryGetValue("throwData", out dynamic temp)) {
t = temp;
} else {
QueueObject(e.beat, e["direction"], e["diffObjs"], e["type"], e["typeL"], e["typeR"], e["shouldPrepare"], true, e);
}
ThrowObject(e.beat, e["direction"], e["shouldPrepare"], t.types, t.sfxNumL, t.sfxNumR);
}
}
private void Update() private void Update()
{ {
if (DogAnim.GetBool("needPrepare") && DogAnim.IsAnimationNotPlaying()) // prepare queuing stuff
if (queuePrepare && DogAnim.IsAnimationNotPlaying())
{ {
DogAnim.DoScaledAnimationAsync("Prepare", 0.5f); DogAnim.DoScaledAnimationAsync("Prepare", 0.5f);
DogAnim.SetBool("needPrepare", true); queuePrepare = false;
} }
// controls stuff
if (PlayerInput.GetIsAction(InputAction_TouchPress) && !GameManager.instance.autoplay) if (PlayerInput.GetIsAction(InputAction_TouchPress) && !GameManager.instance.autoplay)
{ {
DogAnim.SetBool("needPrepare", true); queuePrepare = true;
DogAnim.DoScaledAnimationAsync("Prepare", 0.5f); DogAnim.DoScaledAnimationAsync("Prepare", 0.5f);
} }
if (PlayerInput.GetIsAction(InputAction_TouchRelease) && (!IsExpectingInputNow(InputAction_Press)) && (!GameManager.instance.autoplay)) if (PlayerInput.GetIsAction(InputAction_TouchRelease) && (!IsExpectingInputNow(InputAction_Press)) && (!GameManager.instance.autoplay))
{ {
DogAnim.SetBool("needPrepare", false); queuePrepare = false;
DogAnim.DoScaledAnimationAsync("Bop", 0.5f); preparing = false;
DogAnim.DoScaledAnimationAsync("Unprepare", 0.5f);
} }
if (PlayerInput.GetIsAction(InputAction_Press) && !IsExpectingInputNow(InputAction_Press)) if (PlayerInput.GetIsAction(InputAction_Press) && !IsExpectingInputNow(InputAction_Press))
{ {
System.Random rd = new System.Random(); string slice = UnityEngine.Random.Range(0, 1f) < 0.5f ? "WhiffRight" : "WhiffLeft";
string slice;
int LorR = rd.Next(0, 2);
if (LorR < 1)
{
slice = "WhiffRight";
}
else
{
slice = "WhiffLeft";
}
DogAnim.DoScaledAnimationAsync(slice, 0.5f); DogAnim.DoScaledAnimationAsync(slice, 0.5f);
SoundByte.PlayOneShotGame("dogNinja/whiff");
DogAnim.SetBool("needPrepare", false);
}
if (queuedThrows.Count > 0) SoundByte.PlayOneShotGame("dogNinja/whiff");
{ queuePrepare = false;
foreach (var obj in queuedThrows) { ThrowObject(obj.beat, obj.direction, obj.typeL, obj.typeR, obj.sfxNumL, obj.sfxNumR); }
queuedThrows.Clear();
} }
} }
public void Bop(double beat, float length, bool auto, bool bop) public void Bop(double beat, float length, bool auto, bool bop)
{ {
autoBop = auto;
if (!bop) return; if (!bop) return;
List<BeatAction.Action> actions = new();
for (int i = 0; i < length; i++) List<BeatAction.Action> actions = new();
{ for (int i = 0; i < length; i++) {
actions.Add(new(beat + i, delegate { DogAnim.DoScaledAnimationAsync("Bop", 0.5f); })); actions.Add(new(beat + i, delegate { DogAnim.DoScaledAnimationAsync("Bop", 0.5f); }));
} }
if (actions.Count > 0) BeatAction.New(this, actions); if (actions.Count > 0) BeatAction.New(this, actions);
} }
public static void QueueObject(double beat, int direction, int typeL, int typeR, bool prepare, bool muteThrow) public static void QueueObject(double beat, int direction, bool diffObjs, int type, int typeL, int typeR, bool prepare, bool muteThrow, RiqEntity e)
{ {
int ObjSprite = 1; int randomObj = 1;
if (typeL == 0 || typeR == 0) int[] types = diffObjs ? new[] { typeL, typeR } : new[] { type, type };
string[] sfxNums = new string[2];
for (int i = 0; i < 2; i++)
{ {
// random object code. it makes a random number from 1-7 and sets that as the sprite if (types[i] == 0 && (diffObjs || i == 0)) randomObj = UnityEngine.Random.Range((int)ObjectType.Apple, (int)ObjectType.Potato + 1);
System.Random rd = new System.Random(); if (types[i] == 0) types[i] = randomObj;
ObjSprite = rd.Next(1, 7); sfxNums[i] = "dogNinja/" + (types[i] < 7 ? "fruit" : Enum.GetName(typeof(ObjectType), types[i]));
} }
string sfxNumL = "dogNinja/"; if (!muteThrow) {
if (direction is 0 or 2) for (int i = 0; i < (direction == 2 && diffObjs ? 2 : 1); i++) {
{ SoundByte.PlayOneShotGame(sfxNums[i] + "1", beat, forcePlay: true);
sfxNumL += typeL < 7 ? "fruit" : Enum.GetName(typeof(ObjectType), typeL);
if (typeL == 0) typeL = ObjSprite;
if (!muteThrow) SoundByte.PlayOneShotGame(sfxNumL + "1", forcePlay: true);
}
string sfxNumR = "dogNinja/";
if (direction is 1 or 2)
{
sfxNumR += typeR < 7 ? "fruit" : Enum.GetName(typeof(ObjectType), typeR);
if (typeR == 0) typeR = ObjSprite;
if (!(direction == 2 && typeL == typeR) && !muteThrow) SoundByte.PlayOneShotGame(sfxNumR + "1", forcePlay: true);
}
queuedThrows.Add(new QueuedThrow()
{
beat = beat,
direction = direction,
typeL = typeL,
typeR = typeR,
sfxNumL = sfxNumL,
sfxNumR = sfxNumR,
});
prepare = prepare && (PlayerInput.CurrentControlStyle != InputController.ControlStyles.Touch || GameManager.instance.autoplay);
if (prepare) DogNinja.instance.DogAnim.SetBool("needPrepare", true);
}
public void ThrowObject(double beat, int direction, int typeL, int typeR, string sfxNumL, string sfxNumR)
{
// instantiate a game object and give it its variables
if (direction is 0 or 2)
{
WhichObject.sprite = ObjectTypes[typeL];
ThrowObject ObjectL = Instantiate(ObjectBase, gameObject.transform).GetComponent<ThrowObject>();
ObjectL.startBeat = beat;
ObjectL.curve = CurveFromLeft;
ObjectL.fromLeft = true;
ObjectL.direction = direction;
ObjectL.type = typeL;
ObjectL.sfxNum = sfxNumL;
if (direction == 2) ObjectL.shouldSfx = (typeL == typeR);
}
if (direction is 1 or 2)
{
WhichObject.sprite = ObjectTypes[typeR];
ThrowObject ObjectR = Instantiate(ObjectBase, gameObject.transform).GetComponent<ThrowObject>();
ObjectR.startBeat = beat;
ObjectR.curve = CurveFromRight;
ObjectR.fromLeft = false;
ObjectR.direction = direction;
ObjectR.type = typeR;
ObjectR.sfxNum = sfxNumR;
if (direction == 2) ObjectR.shouldSfx = !(typeL == typeR);
}
}
public void CutEverything(double beat, bool sound, string customText)
{
// plays one anim with sfx when it's not on screen, plays a different anim with no sfx when on screen. ez
if (!birdOnScreen)
{
FullBird.SetActive(true);
if (sound)
{
SoundByte.PlayOneShotGame(sfxNum + "bird_flap");
} }
BirdAnim.Play("FlyIn", 0, 0);
birdOnScreen = true;
cutEverythingText.text = customText;
} }
else
if (GameManager.instance.minigameObj.TryGetComponent(out DogNinja instance)) {
instance.ThrowObject(beat, direction, prepare, types, sfxNums[0], sfxNums[1]);
} else {
var queuedThrow = new QueuedThrow() {
types = types,
sfxNumL = sfxNums[0],
sfxNumR = sfxNums[1],
};
// funny static variable workaround :)
if (!e.dynamicData.TryAdd("throwData", queuedThrow)) {
e["throwData"] = queuedThrow;
}
}
}
public void ThrowObject(double beat, int direction, bool prepare, int[] types, string sfxNumL, string sfxNumR)
{
BeatAction.New(this, new() {
new(beat, () => queuePrepare = prepare && (PlayerInput.CurrentControlStyle != InputController.ControlStyles.Touch || GameManager.instance.autoplay))
});
for (int i = 0; i < (direction == 2 ? 2 : 1); i++)
{ {
BirdAnim.Play("FlyOut", 0, 0); bool l = direction is 2 ? i == 0 : direction == 0;
birdOnScreen = false; WhichObject.sprite = ObjectTypes[l ? types[0] : types[1]];
ThrowObject obj = Instantiate(ObjectBase, gameObject.transform).GetComponent<ThrowObject>();
obj.startBeat = beat;
obj.direction = direction;
obj.fromLeft = l;
obj.type = types[i];
obj.sfxNum = l ? sfxNumL : sfxNumR;
if (direction == 2) obj.shouldSfx = l == (types[0] == types[1]);
} }
// if (direction is 0 or 2)
// {
// WhichObject.sprite = ObjectTypes[typeL];
// ThrowObject ObjectL = Instantiate(ObjectBase, gameObject.transform).GetComponent<ThrowObject>();
// ObjectL.startBeat = beat;
// ObjectL.curve = CurveFromLeft;
// ObjectL.fromLeft = true;
// ObjectL.direction = direction;
// ObjectL.type = typeL;
// ObjectL.sfxNum = sfxNumL;
// if (direction == 2) ObjectL.shouldSfx = (typeL == typeR);
// }
// if (direction is 1 or 2)
// {
// WhichObject.sprite = ObjectTypes[typeR];
// ThrowObject ObjectR = Instantiate(ObjectBase, gameObject.transform).GetComponent<ThrowObject>();
// ObjectR.startBeat = beat;
// ObjectR.curve = CurveFromRight;
// ObjectR.fromLeft = false;
// ObjectR.direction = direction;
// ObjectR.type = typeR;
// ObjectR.sfxNum = sfxNumR;
// if (direction == 2) ObjectR.shouldSfx = !(typeL == typeR);
// }
}
public void CutEverything(double beat, float length, bool sound, string customText)
{
if (sound) SoundByte.PlayOneShotGame("dogNinja/bird_flap");
BirdAnim.DoScaledAnimationAsync("FlyIn", 0.5f);
cutEverythingText.text = customText;
BeatAction.New(this, new() {
new(beat + length, () => BirdAnim.Play("FlyOut", 0, 0))
});
} }
public void Prepare(double beat) public void Prepare(double beat)
{ {
if (PlayerInput.CurrentControlStyle == InputController.ControlStyles.Touch && PlayerInput.PlayerHasControl()) return; if (PlayerInput.CurrentControlStyle == InputController.ControlStyles.Touch && PlayerInput.PlayerHasControl()) return;
if (!DogAnim.GetBool("needPrepare")) DogAnim.DoScaledAnimationAsync("Prepare", 0.5f); if (!queuePrepare) DogAnim.DoScaledAnimationAsync("Prepare", 0.5f);
DogAnim.SetBool("needPrepare", true); queuePrepare = true;
} }
public void HereWeGo(double beat) public static void HereWeGo(double beat)
{ {
MultiSound.Play(new MultiSound.Sound[] { MultiSound.Play(new MultiSound.Sound[] {
new MultiSound.Sound(sfxNum+"here", beat), new MultiSound.Sound("dogNinja/here", beat),
new MultiSound.Sound(sfxNum+"we", beat + 0.5f), new MultiSound.Sound("dogNinja/we", beat + 0.5f),
new MultiSound.Sound(sfxNum+"go", beat + 1f) new MultiSound.Sound("dogNinja/go", beat + 1f)
}, forcePlay: true); }, forcePlay: true);
}
public static void HereWeGoInactive(double beat)
{
DogNinja.instance.HereWeGo(beat);
} }
} }
} }

View file

@ -4,7 +4,6 @@ using System;
using UnityEngine; using UnityEngine;
using NaughtyBezierCurves; using NaughtyBezierCurves;
using HeavenStudio.Util;
namespace HeavenStudio.Games.Scripts_DogNinja namespace HeavenStudio.Games.Scripts_DogNinja
{ {
@ -25,11 +24,9 @@ namespace HeavenStudio.Games.Scripts_DogNinja
BezierCurve3D curve; BezierCurve3D curve;
[SerializeField] Transform halvesParent; [SerializeField] Transform halvesParent;
private DogNinja game;
private void Awake() private void Awake()
{ {
game = DogNinja.instance;
bpmModifier = Conductor.instance.songBpm / 100; bpmModifier = Conductor.instance.songBpm / 100;
songPos = Conductor.instance.songPositionInBeatsAsDouble; songPos = Conductor.instance.songPositionInBeatsAsDouble;
} }
@ -41,9 +38,10 @@ namespace HeavenStudio.Games.Scripts_DogNinja
private void Update() private void Update()
{ {
// holy shit
float flyPosHalves = (Conductor.instance.GetPositionFromBeat(songPos, 3f)*(Conductor.instance.GetPositionFromBeat(songPos, 2f)))+Conductor.instance.GetPositionFromBeat(songPos, 1f); float flyPosHalves = (Conductor.instance.GetPositionFromBeat(songPos, 3f)*(Conductor.instance.GetPositionFromBeat(songPos, 2f)))+Conductor.instance.GetPositionFromBeat(songPos, 1f);
flyPosHalves = (flyPosHalves*0.2f)+0.35f; flyPosHalves = (flyPosHalves * 0.2f) + 0.35f;
transform.position = curve.GetPoint(flyPosHalves)+objPos; transform.position = curve.GetPoint(flyPosHalves) + objPos;
float rot = rotSpeed; float rot = rotSpeed;
rot *= lefty ? bpmModifier : -1 * bpmModifier; rot *= lefty ? bpmModifier : -1 * bpmModifier;
@ -51,12 +49,12 @@ namespace HeavenStudio.Games.Scripts_DogNinja
// clean-up logic // clean-up logic
if (flyPosHalves > 1f) { if (flyPosHalves > 1f) {
GameObject.Destroy(gameObject); Destroy(gameObject);
}; };
if ((!Conductor.instance.isPlaying && !Conductor.instance.isPaused) if ((!Conductor.instance.isPlaying && !Conductor.instance.isPaused)
|| GameManager.instance.currentGame != "dogNinja") { || GameManager.instance.currentGame != "dogNinja") {
GameObject.Destroy(gameObject); Destroy(gameObject);
}; };
} }
} }

View file

@ -10,6 +10,8 @@ namespace HeavenStudio.Games.Scripts_DogNinja
{ {
public class ThrowObject : MonoBehaviour public class ThrowObject : MonoBehaviour
{ {
[SerializeField] DogNinja game;
public double startBeat; public double startBeat;
public int type; public int type;
public bool fromLeft; public bool fromLeft;
@ -26,7 +28,9 @@ namespace HeavenStudio.Games.Scripts_DogNinja
[Header("References")] [Header("References")]
public BezierCurve3D curve; public BezierCurve3D curve;
[SerializeField] BezierCurve3D barelyCurve; [SerializeField] BezierCurve3D LeftCurve;
[SerializeField] BezierCurve3D RightCurve;
private BezierCurve3D barelyCurve;
[SerializeField] BezierCurve3D BarelyLeftCurve; [SerializeField] BezierCurve3D BarelyLeftCurve;
[SerializeField] BezierCurve3D BarelyRightCurve; [SerializeField] BezierCurve3D BarelyRightCurve;
[SerializeField] GameObject HalvesLeftBase; [SerializeField] GameObject HalvesLeftBase;
@ -35,32 +39,26 @@ namespace HeavenStudio.Games.Scripts_DogNinja
public Sprite[] objectLeftHalves; public Sprite[] objectLeftHalves;
public Sprite[] objectRightHalves; public Sprite[] objectRightHalves;
private DogNinja game;
private void Awake()
{
game = DogNinja.instance;
DogAnim = game.DogAnim;
}
private void Start() private void Start()
{ {
DogAnim = game.DogAnim;
curve = fromLeft ? LeftCurve : RightCurve;
barelyCurve = fromLeft ? BarelyRightCurve : BarelyLeftCurve; barelyCurve = fromLeft ? BarelyRightCurve : BarelyLeftCurve;
game.ScheduleInput(startBeat, 1f, DogNinja.InputAction_Press, Hit, Miss, Out); game.ScheduleInput(startBeat, 1f, DogNinja.InputAction_Press, Hit, Miss, null);
} }
private void Update() private void Update()
{ {
float flyPos = Conductor.instance.GetPositionFromBeat(startBeat, 1f)+1.1f; float flyPos = game.conductor.GetPositionFromBeat(startBeat, 1f)+1.1f;
float flyPosBarely = Conductor.instance.GetPositionFromBeat(barelyTime, 1f)+1f; float flyPosBarely = game.conductor.GetPositionFromBeat(barelyTime, 1f)+1f;
if (isActive) { if (isActive) {
flyPos *= 0.31f; flyPos *= 0.31f;
transform.position = curve.GetPoint(flyPos); transform.position = curve.GetPoint(flyPos);
objPos = curve.GetPoint(flyPos); objPos = curve.GetPoint(flyPos);
// destroy object when it's off-screen // destroy object when it's off-screen
if (flyPos > 1f) { if (flyPos > 1f) {
GameObject.Destroy(gameObject); Destroy(gameObject);
} }
} else { } else {
flyPosBarely *= 0.3f; flyPosBarely *= 0.3f;
@ -68,78 +66,54 @@ namespace HeavenStudio.Games.Scripts_DogNinja
float rot = fromLeft ? 200f : -200f; float rot = fromLeft ? 200f : -200f;
transform.rotation = Quaternion.Euler(0, 0, transform.rotation.eulerAngles.z + (rot * Time.deltaTime)); transform.rotation = Quaternion.Euler(0, 0, transform.rotation.eulerAngles.z + (rot * Time.deltaTime));
if (flyPosBarely > 1f) { if (flyPosBarely > 1f) {
GameObject.Destroy(gameObject); Destroy(gameObject);
} }
} }
if ((!Conductor.instance.isPlaying && !Conductor.instance.isPaused) if ((!game.conductor.isPlaying && !game.conductor.isPaused)
|| GameManager.instance.currentGame != "dogNinja") { || game.gameManager.currentGame != "dogNinja") {
GameObject.Destroy(gameObject); Destroy(gameObject);
} }
} }
private void SuccessSlice()
{
string slice = "Slice" + direction switch
{
0 => "Left",
1 => "Right",
_ => "Both",
};
DogAnim.DoScaledAnimationAsync(slice, 0.5f);
if (shouldSfx) SoundByte.PlayOneShotGame(sfxNum+"2");
game.WhichLeftHalf.sprite = objectLeftHalves[type-1];
game.WhichRightHalf.sprite = objectRightHalves[type-1];
SpawnHalves LeftHalf = Instantiate(HalvesLeftBase, game.gameObject.transform).GetComponent<SpawnHalves>();
LeftHalf.startBeat = startBeat;
LeftHalf.lefty = fromLeft;
LeftHalf.objPos = objPos;
SpawnHalves RightHalf = Instantiate(HalvesRightBase, game.gameObject.transform).GetComponent<SpawnHalves>();
RightHalf.startBeat = startBeat;
RightHalf.lefty = fromLeft;
RightHalf.objPos = objPos;
GameObject.Destroy(gameObject);
}
private void JustSlice()
{
isActive = false;
barelyTime = Conductor.instance.songPositionInBeatsAsDouble;
string barely = "Barely" + direction switch
{
0 => "Left",
1 => "Right",
2 => "Both",
_ => "Both",
};
DogAnim.DoScaledAnimationAsync(barely, 0.5f);
SoundByte.PlayOneShotGame("dogNinja/barely");
}
private void Hit(PlayerActionEvent caller, float state) private void Hit(PlayerActionEvent caller, float state)
{ {
game.DogAnim.SetBool("needPrepare", false); game.queuePrepare = false;
if (state >= 1f || state <= -1f) JustSlice(); string dir = direction switch {
else SuccessSlice(); 0 => "Left",
1 => "Right",
_ => "Both",
};
if (state >= 1f || state <= -1f) {
isActive = false;
barelyTime = game.conductor.songPositionInBeatsAsDouble;
DogAnim.DoScaledAnimationAsync("Barely" + dir, 0.5f);
SoundByte.PlayOneShotGame("dogNinja/barely");
} else {
DogAnim.DoScaledAnimationAsync("Slice" + dir, 0.5f);
if (shouldSfx) SoundByte.PlayOneShotGame(sfxNum + "2");
Debug.Log("type - 1 : " + (type - 1));
game.WhichLeftHalf.sprite = objectLeftHalves[type - 1];
game.WhichRightHalf.sprite = objectRightHalves[type - 1];
for (int i = 0; i < 2; i++) {
SpawnHalves half = Instantiate(i == 0 ? HalvesLeftBase : HalvesRightBase, game.transform).GetComponent<SpawnHalves>();
half.startBeat = startBeat;
half.lefty = fromLeft;
half.objPos = objPos;
}
Destroy(gameObject);
}
} }
private void Miss(PlayerActionEvent caller) private void Miss(PlayerActionEvent caller)
{ {
if (!DogAnim.GetBool("needPrepare")) return; if (!game.queuePrepare) return;
DogAnim.DoScaledAnimationAsync("UnPrepare", 0.5f); DogAnim.DoScaledAnimationAsync("Unprepare", 0.5f);
DogAnim.SetBool("needPrepare", false); game.queuePrepare = false;
} game.preparing = false;
private void Out(PlayerActionEvent caller)
{
DogAnim.SetBool("needPrepare", false);
} }
} }
} }