monkey spawning working better

This commit is contained in:
AstrlJelly 2023-07-05 16:42:31 -04:00
parent fc48a9b4e9
commit 9af6fc2efa
15 changed files with 384 additions and 135 deletions

View file

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

View file

@ -6,7 +6,7 @@ AnimationClip:
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_Name: YellowClapCornerRIght
m_Name: YellowClapCornerRight
serializedVersion: 6
m_Legacy: 0
m_Compressed: 0
@ -615,7 +615,7 @@ AnimationClip:
m_Level: 0
m_CycleOffset: 0
m_HasAdditiveReferencePose: 0
m_LoopTime: 1
m_LoopTime: 0
m_LoopBlend: 0
m_LoopBlendOrientation: 0
m_LoopBlendPositionY: 0

View file

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

View file

@ -1,5 +1,34 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!1102 &-8633427497819712545
AnimatorState:
serializedVersion: 6
m_ObjectHideFlags: 1
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_Name: Hit
m_Speed: 1
m_CycleOffset: 0
m_Transitions:
- {fileID: -4375039635063083593}
- {fileID: 5249624865959668415}
- {fileID: 6047805055891460750}
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: 0}
m_Tag:
m_SpeedParameter:
m_MirrorParameter:
m_CycleOffsetParameter:
m_TimeParameter:
--- !u!1102 &-7439314227603388980
AnimatorState:
serializedVersion: 6
@ -7,7 +36,7 @@ AnimatorState:
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_Name: YellowPrepareSideFlip
m_Name: Prepare7
m_Speed: 1
m_CycleOffset: 0
m_Transitions: []
@ -33,7 +62,7 @@ AnimatorState:
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_Name: YellowClapCornerRIght
m_Name: Clap6
m_Speed: 1
m_CycleOffset: 0
m_Transitions: []
@ -89,75 +118,78 @@ AnimatorStateMachine:
m_ChildStates:
- serializedVersion: 1
m_State: {fileID: -5742488784257589865}
m_Position: {x: 200, y: 0, z: 0}
m_Position: {x: 30, y: 170, z: 0}
- serializedVersion: 1
m_State: {fileID: 2285785565324196463}
m_Position: {x: 235, y: 65, z: 0}
m_Position: {x: 260, y: 110, z: 0}
- serializedVersion: 1
m_State: {fileID: 977276309770202303}
m_Position: {x: 270, y: 130, z: 0}
m_Position: {x: 260, y: 170, z: 0}
- serializedVersion: 1
m_State: {fileID: 2877844733988479930}
m_Position: {x: 305, y: 195, z: 0}
m_Position: {x: 490, y: 170, z: 0}
- serializedVersion: 1
m_State: {fileID: 9034752867166180580}
m_Position: {x: 340, y: 260, z: 0}
m_Position: {x: -350, y: 250, z: 0}
- serializedVersion: 1
m_State: {fileID: 2281978419273917628}
m_Position: {x: 375, y: 325, z: 0}
m_Position: {x: -200, y: 270, z: 0}
- serializedVersion: 1
m_State: {fileID: -823361394144095262}
m_Position: {x: 410, y: 390, z: 0}
m_Position: {x: -50, y: 250, z: 0}
- serializedVersion: 1
m_State: {fileID: -2720091023925718476}
m_Position: {x: 445, y: 455, z: 0}
m_Position: {x: 260, y: 230, z: 0}
- serializedVersion: 1
m_State: {fileID: -4125054300247356805}
m_Position: {x: 480, y: 520, z: 0}
m_Position: {x: 490, y: 230, z: 0}
- serializedVersion: 1
m_State: {fileID: 3382603783735723998}
m_Position: {x: 515, y: 585, z: 0}
m_Position: {x: 260, y: 290, z: 0}
- serializedVersion: 1
m_State: {fileID: 7328536651840065754}
m_Position: {x: 550, y: 650, z: 0}
m_Position: {x: 490, y: 290, z: 0}
- serializedVersion: 1
m_State: {fileID: 3707721859561589814}
m_Position: {x: 585, y: 715, z: 0}
m_Position: {x: 260, y: 350, z: 0}
- serializedVersion: 1
m_State: {fileID: 4389998403248966162}
m_Position: {x: 620, y: 780, z: 0}
m_Position: {x: 490, y: 350, z: 0}
- serializedVersion: 1
m_State: {fileID: -2922063652206894040}
m_Position: {x: 655, y: 845, z: 0}
m_Position: {x: 260, y: 410, z: 0}
- serializedVersion: 1
m_State: {fileID: 4417181188385744213}
m_Position: {x: 690, y: 910, z: 0}
m_Position: {x: 490, y: 410, z: 0}
- serializedVersion: 1
m_State: {fileID: 8378355223749411486}
m_Position: {x: 725, y: 975, z: 0}
m_Position: {x: 260, y: 470, z: 0}
- serializedVersion: 1
m_State: {fileID: -6536163925367475535}
m_Position: {x: 760, y: 1040, z: 0}
m_Position: {x: 490, y: 470, z: 0}
- serializedVersion: 1
m_State: {fileID: -7439314227603388980}
m_Position: {x: 795, y: 1105, z: 0}
m_Position: {x: 260, y: 530, z: 0}
- serializedVersion: 1
m_State: {fileID: -5651291787114446398}
m_Position: {x: 830, y: 1170, z: 0}
m_Position: {x: 490, y: 530, z: 0}
- serializedVersion: 1
m_State: {fileID: -2924293198537295990}
m_Position: {x: 865, y: 1235, z: 0}
m_Position: {x: 260, y: 590, z: 0}
- serializedVersion: 1
m_State: {fileID: 5815153728966275956}
m_Position: {x: 900, y: 1300, z: 0}
m_Position: {x: 490, y: 590, z: 0}
- serializedVersion: 1
m_State: {fileID: -8633427497819712545}
m_Position: {x: -200, y: 190, z: 0}
m_ChildStateMachines: []
m_AnyStateTransitions: []
m_EntryTransitions: []
m_StateMachineTransitions: {}
m_StateMachineBehaviours: []
m_AnyStatePosition: {x: 50, y: 20, z: 0}
m_AnyStatePosition: {x: -10, y: -30, z: 0}
m_EntryPosition: {x: 50, y: 120, z: 0}
m_ExitPosition: {x: 800, y: 120, z: 0}
m_ExitPosition: {x: 190, y: -150, z: 0}
m_ParentStateMachinePosition: {x: 800, y: 20, z: 0}
m_DefaultState: {fileID: -5742488784257589865}
--- !u!1102 &-5651291787114446398
@ -167,7 +199,7 @@ AnimatorState:
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_Name: YellowClapSideFlip
m_Name: Clap7
m_Speed: 1
m_CycleOffset: 0
m_Transitions: []
@ -186,6 +218,31 @@ AnimatorState:
m_MirrorParameter:
m_CycleOffsetParameter:
m_TimeParameter:
--- !u!1101 &-4375039635063083593
AnimatorStateTransition:
m_ObjectHideFlags: 1
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_Name:
m_Conditions:
- m_ConditionMode: 6
m_ConditionEvent: hitState
m_EventTreshold: 2
m_DstStateMachine: {fileID: 0}
m_DstState: {fileID: 9034752867166180580}
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 &-4125054300247356805
AnimatorState:
serializedVersion: 6
@ -193,7 +250,7 @@ AnimatorState:
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_Name: YellowClapCorner
m_Name: Clap2
m_Speed: 1
m_CycleOffset: 0
m_Transitions: []
@ -219,7 +276,7 @@ AnimatorState:
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_Name: YellowPrepareCornerDown
m_Name: Prepare8
m_Speed: 1
m_CycleOffset: 0
m_Transitions: []
@ -245,7 +302,7 @@ AnimatorState:
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_Name: YellowPrepareUp
m_Name: Prepare5
m_Speed: 1
m_CycleOffset: 0
m_Transitions: []
@ -271,7 +328,7 @@ AnimatorState:
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_Name: YellowPrepareCorner
m_Name: Prepare2
m_Speed: 1
m_CycleOffset: 0
m_Transitions: []
@ -297,7 +354,7 @@ AnimatorState:
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_Name: YellowAshamed
m_Name: Miss
m_Speed: 1
m_CycleOffset: 0
m_Transitions: []
@ -324,7 +381,13 @@ AnimatorController:
m_PrefabAsset: {fileID: 0}
m_Name: YellowMonkey
serializedVersion: 5
m_AnimatorParameters: []
m_AnimatorParameters:
- m_Name: hitState
m_Type: 3
m_DefaultFloat: 0
m_DefaultInt: 0
m_DefaultBool: 0
m_Controller: {fileID: 0}
m_AnimatorLayers:
- serializedVersion: 5
m_Name: Base Layer
@ -345,7 +408,7 @@ AnimatorState:
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_Name: YellowPrepareDown
m_Name: Prepare1
m_Speed: 1
m_CycleOffset: 0
m_Transitions: []
@ -371,7 +434,7 @@ AnimatorState:
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_Name: YellowFrown
m_Name: Barely
m_Speed: 1
m_CycleOffset: 0
m_Transitions: []
@ -397,7 +460,7 @@ AnimatorState:
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_Name: YellowAppear
m_Name: Appear
m_Speed: 1
m_CycleOffset: 0
m_Transitions: []
@ -423,7 +486,7 @@ AnimatorState:
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_Name: YellowClapDown
m_Name: Clap1
m_Speed: 1
m_CycleOffset: 0
m_Transitions: []
@ -449,7 +512,7 @@ AnimatorState:
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_Name: YellowPrepareSide
m_Name: Prepare3
m_Speed: 1
m_CycleOffset: 0
m_Transitions: []
@ -475,7 +538,7 @@ AnimatorState:
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_Name: YellowPrepareCornerUp
m_Name: Yellow
m_Speed: 1
m_CycleOffset: 0
m_Transitions: []
@ -501,7 +564,7 @@ AnimatorState:
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_Name: YellowClapCornerUp
m_Name: Clap4
m_Speed: 1
m_CycleOffset: 0
m_Transitions: []
@ -527,7 +590,7 @@ AnimatorState:
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_Name: YellowClapUp
m_Name: Clap5
m_Speed: 1
m_CycleOffset: 0
m_Transitions: []
@ -546,6 +609,31 @@ AnimatorState:
m_MirrorParameter:
m_CycleOffsetParameter:
m_TimeParameter:
--- !u!1101 &5249624865959668415
AnimatorStateTransition:
m_ObjectHideFlags: 1
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_Name:
m_Conditions:
- m_ConditionMode: 6
m_ConditionEvent: hitState
m_EventTreshold: 1
m_DstStateMachine: {fileID: 0}
m_DstState: {fileID: 2281978419273917628}
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 &5815153728966275956
AnimatorState:
serializedVersion: 6
@ -553,7 +641,7 @@ AnimatorState:
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_Name: YellowClapCornerDown
m_Name: Clap8
m_Speed: 1
m_CycleOffset: 0
m_Transitions: []
@ -572,6 +660,31 @@ AnimatorState:
m_MirrorParameter:
m_CycleOffsetParameter:
m_TimeParameter:
--- !u!1101 &6047805055891460750
AnimatorStateTransition:
m_ObjectHideFlags: 1
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_Name:
m_Conditions:
- m_ConditionMode: 6
m_ConditionEvent: hitState
m_EventTreshold: 0
m_DstStateMachine: {fileID: 0}
m_DstState: {fileID: -823361394144095262}
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 &7328536651840065754
AnimatorState:
serializedVersion: 6
@ -579,7 +692,7 @@ AnimatorState:
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_Name: YellowClapSide
m_Name: Clap3
m_Speed: 1
m_CycleOffset: 0
m_Transitions: []
@ -605,7 +718,7 @@ AnimatorState:
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_Name: YellowPrepareCornerRight
m_Name: Prepare6
m_Speed: 1
m_CycleOffset: 0
m_Transitions: []
@ -631,7 +744,7 @@ AnimatorState:
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_Name: YellowDance
m_Name: Just
m_Speed: 1
m_CycleOffset: 0
m_Transitions: []

View file

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

View file

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

View file

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

View file

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

View file

@ -705,7 +705,7 @@ AnimationClip:
m_Level: 0
m_CycleOffset: 0
m_HasAdditiveReferencePose: 0
m_LoopTime: 1
m_LoopTime: 0
m_LoopBlend: 0
m_LoopBlendOrientation: 0
m_LoopBlendPositionY: 0
@ -2245,36 +2245,6 @@ AnimationClip:
classID: 4
script: {fileID: 0}
m_EulerEditorCurves:
- curve:
serializedVersion: 2
m_Curve: []
m_PreInfinity: 2
m_PostInfinity: 2
m_RotationOrder: 4
attribute: m_LocalEulerAngles.z
path: MonkeyBody
classID: 4
script: {fileID: 0}
- curve:
serializedVersion: 2
m_Curve: []
m_PreInfinity: 2
m_PostInfinity: 2
m_RotationOrder: 4
attribute: m_LocalEulerAngles.y
path: MonkeyBody
classID: 4
script: {fileID: 0}
- curve:
serializedVersion: 2
m_Curve: []
m_PreInfinity: 2
m_PostInfinity: 2
m_RotationOrder: 4
attribute: m_LocalEulerAngles.x
path: MonkeyBody
classID: 4
script: {fileID: 0}
- curve:
serializedVersion: 2
m_Curve: []
@ -2335,6 +2305,36 @@ AnimationClip:
path: LeftHand
classID: 4
script: {fileID: 0}
- curve:
serializedVersion: 2
m_Curve: []
m_PreInfinity: 2
m_PostInfinity: 2
m_RotationOrder: 4
attribute: m_LocalEulerAngles.z
path: MonkeyBody
classID: 4
script: {fileID: 0}
- curve:
serializedVersion: 2
m_Curve: []
m_PreInfinity: 2
m_PostInfinity: 2
m_RotationOrder: 4
attribute: m_LocalEulerAngles.y
path: MonkeyBody
classID: 4
script: {fileID: 0}
- curve:
serializedVersion: 2
m_Curve: []
m_PreInfinity: 2
m_PostInfinity: 2
m_RotationOrder: 4
attribute: m_LocalEulerAngles.x
path: MonkeyBody
classID: 4
script: {fileID: 0}
- curve:
serializedVersion: 2
m_Curve: []

View file

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

View file

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

View file

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

View file

@ -22,7 +22,7 @@ namespace HeavenStudio.Games.Loaders
},
parameters = new List<Param>()
{
new Param("amount", new EntityTypes.Integer(1, 8, 4), "Monkeys to spawn", "How many monkeys will spawn over the course of this block"),
new Param("amount", new EntityTypes.Integer(1, 8, 4), "Monkeys to Spawn", "How many monkeys will spawn over the course of this block"),
},
defaultLength = 8f,
resizable = true
@ -33,9 +33,13 @@ namespace HeavenStudio.Games.Loaders
var e = eventCaller.currentEntity;
MonkeyWatch.StartClapping(e.beat, e["start"]);
},
preFunction = delegate {
MonkeyWatch.PreStartClapping(eventCaller.currentEntity.beat);
},
preFunctionLength = 1,
parameters = new List<Param>()
{
new Param("start", new EntityTypes.Integer(0, 0, 60), "Start Where", "Where on the clock will the monkey start? (Set to zero to be automatic)"),
new Param("start", new EntityTypes.Integer(0, 60, 0), "Start Where", "Where on the clock will the monkey start? (Set to zero to be automatic)"),
},
defaultLength = 2f,
inactiveFunction = delegate {
@ -115,7 +119,7 @@ namespace HeavenStudio.Games
Dictionary<double, OffbeatMonkey> offbeatMonkeys = new Dictionary<double, OffbeatMonkey>();
List<RiqEntity> customMonkeys = new List<RiqEntity>();
List<GameObject> watchHoles = new List<GameObject>();
List<Animator> activeMonkeys = new List<Animator>();
Dictionary<int, Animator> activeMonkeys = new Dictionary<int, Animator>();
public struct OffbeatMonkey
{
@ -127,49 +131,16 @@ namespace HeavenStudio.Games
static OffbeatMonkey wantOffbeat;
static double wantClapping = double.MinValue;
public static bool startedClapping;
static bool wantPrepare;
bool cameraMove;
int currentMonkey;
static int lastMonkeySpawned;
static int lastMonkeySpawned = 0;
public static MonkeyWatch instance;
void Awake()
{
instance = this;
var songPos = Conductor.instance.songPositionInBeats;
customMonkeys = EventCaller.GetAllInGameManagerList("monkeyWatch", new string[] { "customMonkey" });
var offbeatEvents = EventCaller.GetAllInGameManagerList("monkeyWatch", new string[] { "offbeatMonkeys" });
for (int i = 0; i < offbeatEvents.Count; i++)
{
if (offbeatEvents[i].beat >= songPos)
{
offbeatMonkeys.Add(
Mathf.Round((float)offbeatEvents[i].beat),
new OffbeatMonkey{
mute = offbeatEvents[i]["mute"],
length = offbeatEvents[i].length,
}
);
}
}
var clapEvents = EventCaller.GetAllInGameManagerList("monkeyWatch", new string[] { "startClapping" });
var appearEvents = EventCaller.GetAllInGameManagerList("monkeyWatch", new string[] { "monkeysAppear" });
if (appearEvents.Count == 0 || clapEvents.Find(x => x.beat >= songPos).beat < appearEvents.Find(x => x.beat >= songPos).beat) {
MonkeysAppear(songPos, 0, 4);
}
monkeyPlayer.UpdateRotation(lastMonkeySpawned*6);
// put all the watch holes in a list
for (int i = 0; i < watchHoleParent.childCount; i++) {
watchHoles.Add(watchHoleParent.GetChild(i).gameObject);
Debug.Log(watchHoleParent.GetChild(i).name);
}
Update();
}
private void Start()
@ -179,6 +150,44 @@ namespace HeavenStudio.Games
public override void OnGameSwitch(double beat)
{
var events = GameManager.instance.Beatmap.Entities.FindAll(c => c.datamodel.Split('/')[0] == "monkeyWatch");
customMonkeys = events.FindAll(x => x.datamodel.Split('/')[1].Equals("customMonkey"));
for (int i = 0; i < watchHoleParent.childCount; i++)
watchHoles.Add(watchHoleParent.GetChild(i).gameObject);
// check if monkeys should spawn by default
var firstStartClapping = events.Find(x => x.beat >= beat && x.datamodel.Split('/')[1].Equals("startClapping"));
var firstAppearEvent = events.Find(x => x.beat >= beat && x.datamodel.Split('/')[1].Equals("monkeysAppear"));
if (firstStartClapping != null) {
if (firstStartClapping["start"] != 0) lastMonkeySpawned = firstStartClapping["start"];
if (firstAppearEvent == null || firstStartClapping.beat < firstAppearEvent.beat) {
for (int i = 0; i < (firstStartClapping == null ? 4 : firstStartClapping["amount"]); i++) SpawnMonkey(true);
}
}
var offbeatEvents = events.FindAll(x => x.datamodel.Split('/')[1].Equals("offbeatMonkeys"));
for (int i = 0; i < offbeatEvents.Count; i++)
{
var eventBeat = Mathf.Round((float)offbeatEvents[i].beat);
if (eventBeat >= beat)
{
offbeatMonkeys.Add(
// adjusts beat to always align with Clapping()
eventBeat + ((eventBeat + firstStartClapping.beat) % 2),
new OffbeatMonkey {
mute = offbeatEvents[i]["mute"],
length = offbeatEvents[i].length,
}
);
}
}
monkeyPlayer.UpdateRotation(lastMonkeySpawned * -6);
cameraTransform.transform.eulerAngles = new Vector3(0, 0, lastMonkeySpawned * -6);
double offBeat = double.MinValue;
if (wantOffbeat.length != 0)
{
@ -194,6 +203,17 @@ namespace HeavenStudio.Games
Clapping(wantClapping, offBeat + wantOffbeat.length);
wantClapping = double.MinValue;
}
if (wantPrepare) {
MonkeyPrepare(true);
wantPrepare = false;
}
Update();
}
public override void OnPlay(double beat)
{
OnGameSwitch(beat);
}
void OnDestroy()
@ -202,6 +222,7 @@ namespace HeavenStudio.Games
if (queuedInputs.Count > 0) queuedInputs.Clear();
if (offbeatMonkeys.Count > 0) offbeatMonkeys.Clear();
startedClapping = false;
lastMonkeySpawned = 0;
}
foreach (var evt in scheduledInputs) evt.Disable();
@ -210,32 +231,77 @@ namespace HeavenStudio.Games
public void Update()
{
if (cameraMove) {
cameraTransform.transform.eulerAngles += Vector3.back * (6 * Time.deltaTime);
cameraTransform.transform.eulerAngles -= new Vector3(0, 0, (5 * (Conductor.instance.songBpm / 100) * Time.deltaTime));
}
GameCamera.additionalPosition = cameraTransform.GetChild(0).position;
}
void SpawnMonkey(bool instant)
{
var watchHole = watchHoles[lastMonkeySpawned].transform.GetSiblingIndex();
if (instant) watchHoles[watchHole].GetComponent<Animator>().Play("HoleOpen", 0, 1);
else watchHoles[watchHole].GetComponent<Animator>().DoScaledAnimationAsync("HoleOpen", 0.25f);
var monkey = Instantiate(yellowMonkey, watchHoles[watchHole].transform.position, new Quaternion(0, 0, 0, 0), watchHoleParent).GetComponent<Animator>();
activeMonkeys.Add(watchHole, monkey);
if (instant) monkey.Play("Appear", 0, 1);
else monkey.DoScaledAnimationAsync("Appear", 0.5f);
lastMonkeySpawned++;
if (lastMonkeySpawned >= 60) lastMonkeySpawned = 0;
}
int MonkeyAngle(int monkey)
{
return monkey switch {
>= 4 and <= 12 => 2,
>= 12 and <= 19 => 3,
>= 19 and <= 27 => 4,
>= 27 and <= 34 => 5,
>= 34 and <= 42 => 6,
>= 42 and <= 49 => 7,
>= 49 and <= 56 => 8,
_ => 1,
};
}
public void MonkeyPrepare(bool instant = false)
{
Debug.Log("prepare :3");
if (instant) activeMonkeys[currentMonkey].Play($"Prepare{MonkeyAngle(currentMonkey)}", 0, 1);
else activeMonkeys[currentMonkey].DoScaledAnimationAsync($"Prepare{MonkeyAngle(currentMonkey)}", 0.5f);
currentMonkey++;
}
public void MonkeysAppear(double beat, float length, int monkeyAmount)
{
var appear = new List<BeatAction.Action>();
for (int i = 0; i < monkeyAmount; i++)
{
var x = i;
appear.Add(new BeatAction.Action(beat + (x / (monkeyAmount / length)), delegate {
Debug.Log(watchHoles[x].transform.position);
activeMonkeys.Add(Instantiate(yellowMonkey, watchHoles[x].transform.position, new Quaternion(0, 0, 0, 0), watchHoleParent).GetComponent<Animator>());
}));
appear.Add(new BeatAction.Action(beat + (i / (monkeyAmount / length)), delegate { SpawnMonkey(false); }));
}
BeatAction.New(gameObject, appear);
}
public static void PreStartClapping(double beat)
{
if (GameManager.instance.currentGame == "monkeyWatch") {
BeatAction.New(instance.gameObject, new List<BeatAction.Action>() {
new BeatAction.Action(beat - 1, delegate { instance.MonkeyPrepare(); }),
});
} else {
wantPrepare = true;
}
}
public static void StartClapping(double beat, int start)
{
if (GameManager.instance.currentGame is "monkeyWatch") {
instance.Clapping(beat);
} else {
ClappingInactive(beat);
if (lastMonkeySpawned != 0) lastMonkeySpawned = start;
}
}
@ -247,8 +313,6 @@ namespace HeavenStudio.Games
void Clapping(double beat, double inputCheck = double.MinValue)
{
//activeMonkeys[currentMonkey].DoScaledAnimationAsync("YellowPrepareDown", 0.5f);
currentMonkey++;
cameraMove = true;
//cameraTransform.transform.eulerAngles += Vector3.back*6;
if (offbeatMonkeys.ContainsKey(beat)) {
@ -259,16 +323,24 @@ namespace HeavenStudio.Games
inputCheck = (beat - 2) + offbeatMonkeys[beat - 2].length;
}
if (inputCheck <= beat) ScheduleInput(beat, 1f, InputType.STANDARD_DOWN, JustYellow, Miss, Nothing);
if (inputCheck <= beat) {
ScheduleInput(beat, 1f, InputType.STANDARD_DOWN, JustYellow, Miss, Nothing);
}
BeatAction.New(gameObject, new List<BeatAction.Action>() {
new BeatAction.Action(beat + 2, delegate { Clapping(beat + 2, inputCheck); }),
new BeatAction.Action(beat + 2, delegate { SpawnMonkey(false); }),
});
}
void WatchMonkeys()
{
}
public static void WarnPinkMonkeys(double beat, float length, bool mute)
{
wantOffbeat = new OffbeatMonkey{
wantOffbeat = new OffbeatMonkey {
beat = beat,
length = length,
mute = true,
@ -312,16 +384,20 @@ namespace HeavenStudio.Games
public void PinkMonkeys(double beat, float length, bool mute, List<RiqEntity> monkeys)
{
var actions = new List<BeatAction.Action>();
if (monkeys.Count == 0) {
for (int i = 2; i < length; i++) {
ScheduleInput(beat, i + 0.5, InputType.STANDARD_DOWN, JustPink, Miss, Nothing);
actions.Add(new BeatAction.Action(beat + i - 0.5, delegate { MonkeyPrepare(); }));
}
} else {
for (int i = 0; i < monkeys.Count; i++)
{
ScheduleInput(beat, monkeys[i].beat - beat, InputType.STANDARD_DOWN, (monkeys[i]["sfx"] == 3 ? JustYellow : JustPink), Miss, Nothing);
actions.Add(new BeatAction.Action(monkeys[i].beat - 1, delegate { MonkeyPrepare(); }));
}
}
BeatAction.New(gameObject, actions);
}
void JustYellow(PlayerActionEvent caller, float state)
@ -351,11 +427,21 @@ namespace HeavenStudio.Games
}
monkeyPlayer.MonkeyAnim.DoScaledAnimationAsync(whichAnim, 0.5f);
monkeyPlayer.ClickerAnim.DoScaledAnimationAsync("Click", 0.5f);
MonkeyPrepare();
var anim = activeMonkeys[currentMonkey - 1];
anim.DoScaledAnimationAsync($"Clap{MonkeyAngle(currentMonkey - 1)}", 0.5f);
anim.SetInteger("hitState", (whichAnim == "PlayerClapBarely" ? 1 : 2));
}
void Miss(PlayerActionEvent caller)
{
monkeyPlayer.ClickerAnim.DoScaledAnimationAsync("Click", 0.5f);
MonkeyPrepare();
var anim = activeMonkeys[currentMonkey - 1];
anim.SetBool("hasHit", true);
anim.SetInteger("hitState", 0);
}
void Nothing(PlayerActionEvent caller) {}
@ -370,6 +456,15 @@ namespace HeavenStudio.Games
7 +
7 +
4
0
4
12
19
27
34
42
49
*/
}
}

View file

@ -0,0 +1,30 @@
using System.Collections;
using System.Collections.Generic;
using System;
using UnityEngine;
using NaughtyBezierCurves;
using HeavenStudio.Util;
namespace HeavenStudio.Games.Scripts_MonkeyWatch
{
public class WatchMonkeyHandler : MonoBehaviour
{
private MonkeyWatch game;
private void Awake()
{
game = MonkeyWatch.instance;
}
private void Start()
{
}
private void Update()
{
}
}
}

View file

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