joe prepare animation

- bg effect preview (buggy)
- adjusted path of hit items
- adjusted particle limits and spawning
- rain is now affected by wind
- cont. work on joe expressions

- animation helper sync scale now plays thru events properly
- adjusted timing windows
This commit is contained in:
minenice55 2022-08-07 19:40:06 -04:00
parent bd0d05772a
commit 3f7af6a0eb
9 changed files with 278 additions and 145 deletions

View file

@ -12636,7 +12636,7 @@ ParticleSystem:
y:
serializedVersion: 2
minMaxState: 0
scalar: -2.5
scalar: -1
minScalar: 0
maxCurve:
serializedVersion: 2
@ -15293,8 +15293,8 @@ MonoBehaviour:
m_EditorClassIdentifier:
curve: {fileID: 6630505047486178256}
handleType: 0
leftHandleLocalPosition: {x: -4, y: -1, z: -0}
rightHandleLocalPosition: {x: 4, y: 1, z: 0}
leftHandleLocalPosition: {x: -3, y: -1.5, z: -0}
rightHandleLocalPosition: {x: 3, y: 1.5, z: 0}
--- !u!1 &1315523421705938671
GameObject:
m_ObjectHideFlags: 0
@ -20613,7 +20613,7 @@ Transform:
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1795663421957276498}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 20, y: -3.5, z: -2}
m_LocalPosition: {x: 15, y: -3.5, z: -2}
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children: []
m_Father: {fileID: 4689631526136439814}
@ -20727,8 +20727,8 @@ MonoBehaviour:
m_EditorClassIdentifier:
curve: {fileID: 7440330371911974480}
handleType: 0
leftHandleLocalPosition: {x: -12, y: -1, z: -0}
rightHandleLocalPosition: {x: 12, y: 1, z: 0}
leftHandleLocalPosition: {x: -6, y: -2, z: -0}
rightHandleLocalPosition: {x: 6, y: 2, z: 0}
--- !u!1 &2109778452581044891
GameObject:
m_ObjectHideFlags: 0
@ -21601,7 +21601,7 @@ ParticleSystem:
boxThickness: {x: 0, y: 0, z: 0}
radiusThickness: 1
donutRadius: 0.2
m_Position: {x: 0, y: -3, z: 0}
m_Position: {x: 0, y: 0, z: 0}
m_Rotation: {x: 0, y: 0, z: 0}
m_Scale: {x: 0, y: 0, z: 0}
placementMode: 0
@ -36426,8 +36426,8 @@ MonoBehaviour:
m_EditorClassIdentifier:
curve: {fileID: 4654694281393269592}
handleType: 0
leftHandleLocalPosition: {x: -1.5, y: 2.5, z: 0}
rightHandleLocalPosition: {x: 1.5, y: -2.5, z: -0}
leftHandleLocalPosition: {x: 0, y: 1, z: 0.024614334}
rightHandleLocalPosition: {x: -0, y: -1, z: -0.024614334}
--- !u!1 &3040834920837458945
GameObject:
m_ObjectHideFlags: 0
@ -52124,7 +52124,7 @@ ParticleSystem:
startRotation:
serializedVersion: 2
minMaxState: 0
scalar: 0
scalar: 1.5707963
minScalar: 0
maxCurve:
serializedVersion: 2
@ -52175,7 +52175,7 @@ ParticleSystem:
m_PostInfinity: 2
m_RotationOrder: 4
randomizeRotationDirection: 0
maxNumParticles: 1000
maxNumParticles: 1280
size3D: 0
rotation3D: 0
gravityModifier:
@ -52240,9 +52240,9 @@ ParticleSystem:
boxThickness: {x: 0, y: 0, z: 0}
radiusThickness: 1
donutRadius: 0.2
m_Position: {x: 0, y: 12, z: 0}
m_Position: {x: 10, y: 14, z: 0}
m_Rotation: {x: -90, y: 0, z: 0}
m_Scale: {x: 40, y: 16, z: 1}
m_Scale: {x: 60, y: 16, z: 1}
placementMode: 0
m_MeshMaterialIndex: 0
m_MeshNormalOffset: 0
@ -52493,7 +52493,7 @@ ParticleSystem:
rateOverDistance:
serializedVersion: 2
minMaxState: 0
scalar: 10
scalar: 15
minScalar: 0
maxCurve:
serializedVersion: 2
@ -53921,11 +53921,11 @@ ParticleSystem:
randomizePerFrame: 0
ExternalForcesModule:
serializedVersion: 2
enabled: 0
enabled: 1
multiplierCurve:
serializedVersion: 2
minMaxState: 0
scalar: 1
scalar: 8
minScalar: 1
maxCurve:
serializedVersion: 2
@ -55304,7 +55304,7 @@ ParticleSystem:
m_EnergyLossOnCollision:
serializedVersion: 2
minMaxState: 0
scalar: 0
scalar: 1
minScalar: 0
maxCurve:
serializedVersion: 2
@ -56355,13 +56355,13 @@ ParticleSystemRenderer:
m_SortingLayerID: 0
m_SortingLayer: 0
m_SortingOrder: 0
m_RenderMode: 0
m_RenderMode: 1
m_SortMode: 4
m_MinParticleSize: 0
m_MaxParticleSize: 0.5
m_CameraVelocityScale: 0
m_VelocityScale: 0
m_LengthScale: 2
m_LengthScale: 1
m_SortingFudge: 0
m_NormalDirection: 1
m_ShadowBias: 0
@ -56372,7 +56372,7 @@ ParticleSystemRenderer:
m_EnableGPUInstancing: 1
m_ApplyActiveColorSpace: 1
m_AllowRoll: 1
m_FreeformStretching: 0
m_FreeformStretching: 1
m_RotateWithStretchDirection: 1
m_VertexStreams: 00010304
m_Mesh: {fileID: 0}
@ -76698,7 +76698,7 @@ Transform:
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 5016970758835767014}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 20, y: -3.5, z: 0}
m_LocalPosition: {x: 15, y: -3.5, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children: []
m_Father: {fileID: 5150790184898265248}
@ -76718,8 +76718,8 @@ MonoBehaviour:
m_EditorClassIdentifier:
curve: {fileID: 3313832072412894528}
handleType: 0
leftHandleLocalPosition: {x: -1, y: 2, z: 0}
rightHandleLocalPosition: {x: 1, y: -2, z: -0}
leftHandleLocalPosition: {x: -1, y: 3, z: 0}
rightHandleLocalPosition: {x: 1, y: -3, z: -0}
--- !u!1 &5218911297968347512
GameObject:
m_ObjectHideFlags: 0
@ -86602,8 +86602,8 @@ MonoBehaviour:
m_EditorClassIdentifier:
curve: {fileID: 6630505047486178256}
handleType: 0
leftHandleLocalPosition: {x: -1, y: 1.5, z: 0}
rightHandleLocalPosition: {x: 1, y: -1.5, z: -0}
leftHandleLocalPosition: {x: 0, y: 2, z: 0}
rightHandleLocalPosition: {x: -0, y: -2, z: -0}
--- !u!1 &5905694198237952078
GameObject:
m_ObjectHideFlags: 0
@ -86825,7 +86825,7 @@ ParticleSystem:
startSpeed:
serializedVersion: 2
minMaxState: 0
scalar: 5
scalar: 3
minScalar: 5
maxCurve:
serializedVersion: 2
@ -101868,8 +101868,8 @@ MonoBehaviour:
m_EditorClassIdentifier:
curve: {fileID: 692487349845718181}
handleType: 0
leftHandleLocalPosition: {x: -8, y: -2, z: -0}
rightHandleLocalPosition: {x: 8, y: 2, z: 0}
leftHandleLocalPosition: {x: -5, y: -2, z: -0}
rightHandleLocalPosition: {x: 5, y: 2, z: 0}
--- !u!1 &7015206745496403491
GameObject:
m_ObjectHideFlags: 0
@ -101942,7 +101942,7 @@ Transform:
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 7031693769840288682}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 18, y: -3.5, z: 0.15}
m_LocalPosition: {x: 14, y: -3.5, z: 0.15}
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children: []
m_Father: {fileID: 1675496839687250270}
@ -101962,8 +101962,8 @@ MonoBehaviour:
m_EditorClassIdentifier:
curve: {fileID: 692487349845718181}
handleType: 0
leftHandleLocalPosition: {x: -5, y: 3, z: 0}
rightHandleLocalPosition: {x: 5, y: -3, z: -0}
leftHandleLocalPosition: {x: -2, y: 3, z: 0}
rightHandleLocalPosition: {x: 2, y: -3, z: -0}
--- !u!1 &7117799636702328791
GameObject:
m_ObjectHideFlags: 0
@ -102139,8 +102139,8 @@ MonoBehaviour:
m_EditorClassIdentifier:
curve: {fileID: 210535419838892513}
handleType: 0
leftHandleLocalPosition: {x: -2, y: -3.5, z: -0}
rightHandleLocalPosition: {x: 2, y: 3.5, z: 0}
leftHandleLocalPosition: {x: -2.5, y: -3.5, z: -0}
rightHandleLocalPosition: {x: 2.5, y: 3.5, z: 0}
--- !u!1 &7395954162971010416
GameObject:
m_ObjectHideFlags: 0
@ -102349,7 +102349,7 @@ WindZone:
m_WindMain: 0
m_WindTurbulence: 1
m_WindPulseMagnitude: 0.5
m_WindPulseFrequency: 0.01
m_WindPulseFrequency: 0.033333335
--- !u!1 &7655509461159504414
GameObject:
m_ObjectHideFlags: 0
@ -102375,7 +102375,7 @@ Transform:
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 7655509461159504414}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 12, y: -3.5, z: 0}
m_LocalPosition: {x: 11, y: -3.5, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children: []
m_Father: {fileID: 7654967304496385897}
@ -102395,8 +102395,8 @@ MonoBehaviour:
m_EditorClassIdentifier:
curve: {fileID: 210535419838892513}
handleType: 0
leftHandleLocalPosition: {x: -1.5, y: 2, z: 0}
rightHandleLocalPosition: {x: 1.5, y: -2, z: -0}
leftHandleLocalPosition: {x: -0.5, y: 2, z: 0}
rightHandleLocalPosition: {x: 0.5, y: -2, z: -0}
--- !u!1 &7660798116759458000
GameObject:
m_ObjectHideFlags: 0
@ -107433,8 +107433,8 @@ MonoBehaviour:
m_EditorClassIdentifier:
curve: {fileID: 4654694281393269592}
handleType: 0
leftHandleLocalPosition: {x: -2, y: -2.5, z: -0}
rightHandleLocalPosition: {x: 2, y: 2.5, z: 0}
leftHandleLocalPosition: {x: -4, y: -2, z: 0}
rightHandleLocalPosition: {x: 4, y: 2, z: -0}
--- !u!1 &7919762816917508181
GameObject:
m_ObjectHideFlags: 0
@ -117671,8 +117671,8 @@ MonoBehaviour:
m_EditorClassIdentifier:
curve: {fileID: 3313832072412894528}
handleType: 0
leftHandleLocalPosition: {x: -10, y: -5, z: -0}
rightHandleLocalPosition: {x: 10, y: 5, z: 0}
leftHandleLocalPosition: {x: -6, y: -3, z: -0}
rightHandleLocalPosition: {x: 6, y: 3, z: 0}
--- !u!1 &9202986449610168952
GameObject:
m_ObjectHideFlags: 0

View file

@ -4229,15 +4229,6 @@ AnimationClip:
path: Body
classID: 212
script: {fileID: 0}
- curve:
- time: 0
value: {fileID: 8497358629359107968, guid: 868cd67f05ca7c646bae00fcc2ba7eaa, type: 3}
- time: 0.1
value: {fileID: 4149267612586432800, guid: 868cd67f05ca7c646bae00fcc2ba7eaa, type: 3}
attribute: m_Sprite
path: Head
classID: 212
script: {fileID: 0}
- curve:
- time: 0
value: {fileID: 0}
@ -5024,13 +5015,6 @@ AnimationClip:
typeID: 212
customType: 23
isPPtrCurve: 1
- serializedVersion: 2
path: 130111906
attribute: 0
script: {fileID: 0}
typeID: 212
customType: 23
isPPtrCurve: 1
- serializedVersion: 2
path: 3951233754
attribute: 0
@ -5130,8 +5114,6 @@ AnimationClip:
- {fileID: 9058691655761496151, guid: 868cd67f05ca7c646bae00fcc2ba7eaa, type: 3}
- {fileID: 9058691655761496151, guid: 868cd67f05ca7c646bae00fcc2ba7eaa, type: 3}
- {fileID: 9058691655761496151, guid: 868cd67f05ca7c646bae00fcc2ba7eaa, type: 3}
- {fileID: 8497358629359107968, guid: 868cd67f05ca7c646bae00fcc2ba7eaa, type: 3}
- {fileID: 4149267612586432800, guid: 868cd67f05ca7c646bae00fcc2ba7eaa, type: 3}
- {fileID: 0}
- {fileID: -3126141815255192416, guid: 868cd67f05ca7c646bae00fcc2ba7eaa, type: 3}
- {fileID: -3724082816408167037, guid: 868cd67f05ca7c646bae00fcc2ba7eaa, type: 3}
@ -14412,16 +14394,16 @@ AnimationClip:
intParameter: 0
messageOptions: 0
- time: 0.95
functionName: SetFaceExpressionForced
data:
objectReferenceParameter: {fileID: 0}
floatParameter: 0
intParameter: 0
messageOptions: 0
- time: 1.1666666
functionName: MarkCanEmote
data:
objectReferenceParameter: {fileID: 0}
floatParameter: 0
intParameter: 0
messageOptions: 0
- time: 0.95
functionName: SetFaceExpressionForced
data:
objectReferenceParameter: {fileID: 0}
floatParameter: 0
intParameter: 0
messageOptions: 0

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.9 MiB

After

Width:  |  Height:  |  Size: 3.9 MiB

View file

@ -13,7 +13,10 @@ namespace HeavenStudio.Games.Loaders
public static Minigame AddGame(EventCaller eventCaller) {
return new Minigame("karateman", "Karate Man [INDEV REWORK]", "70A8D8", false, false, new List<GameAction>()
{
new GameAction("bop", delegate { }, 0.5f, true),
new GameAction("bop", delegate { KarateMan.instance.ToggleBop(eventCaller.currentEntity.toggle); }, 0.5f, true, new List<Param>()
{
new Param("toggle", true, "Bop", "Whether to bop to the beat or not")
}),
new GameAction("hit", delegate { var e = eventCaller.currentEntity; KarateMan.instance.CreateItem(e.beat, e.type); }, 2, false,
new List<Param>()
{
@ -32,7 +35,7 @@ namespace HeavenStudio.Games.Loaders
{
new Param("type", KarateMan.HitThree.HitThree, "Type", "The warning text to show")
}),
new GameAction("prepare", delegate { }, 1f, true),
new GameAction("prepare", delegate { var e = eventCaller.currentEntity; KarateMan.instance.Prepare(e.beat, e.length);}, 1f, true),
new GameAction("set background effects", delegate { var e = eventCaller.currentEntity; KarateMan.instance.SetBgAndShadowCol(e.beat, e.length, e.type, e.type2, e.colorA, e.colorB, e.type3); }, 0.5f, true, new List<Param>()
{
new Param("type", KarateMan.BackgroundType.Yellow, "Background Type", "The preset background type"),
@ -56,8 +59,8 @@ namespace HeavenStudio.Games.Loaders
new GameAction("particle effects", delegate { var e = eventCaller.currentEntity; KarateMan.instance.SetParticleEffect(e.beat, e.type, e.valA, e.valB); }, 0.5f, false, new List<Param>()
{
new Param("type", KarateMan.ParticleType.None, "Particle Type", "The type of particle effect to spawn. Using \"None\" will stop all effects"),
new Param("valA", new EntityTypes.Float(0f, 64f, 1f), "Wind Strength", "The strength of the particle wind. (Does not work on the Rain particle.)"),
new Param("valB", new EntityTypes.Float(1f, 12f, 1f), "Particle Intensity", "The intensity of the particle effect")
new Param("valA", new EntityTypes.Float(0f, 64f, 1f), "Wind Strength", "The strength of the particle wind"),
new Param("valB", new EntityTypes.Float(1f, 16f, 1f), "Particle Intensity", "The intensity of the particle effect")
}),
new GameAction("force facial expression", delegate { KarateMan.instance.SetFaceExpression(eventCaller.currentEntity.type); }, 0.5f, false, new List<Param>()
{
@ -280,6 +283,9 @@ namespace HeavenStudio.Games
private void Update()
{
var cond = Conductor.instance;
if (!cond.isPlaying)
SetBgEffectsToLast(cond.songPositionInBeats);
switch (currentBgEffect)
{
case BackgroundFXType.Sunburst:
@ -365,68 +371,80 @@ namespace HeavenStudio.Games
cameraReturnLength = Mathf.Min(2f, length*0.5f);
}
public void DoWord(float beat, int type)
public void DoWord(float beat, int type, bool doSound = true)
{
String word = "NoPose";
float clear = 0f;
switch (type)
{
case (int) HitThree.HitTwo:
Word.Play("Word02");
wordClearTime = beat + 4f;
MultiSound.Play(new MultiSound.Sound[]
{
new MultiSound.Sound("karateman/hit", beat + 0.5f, offset: hitVoiceOffset),
new MultiSound.Sound("karateman/two", beat + 1f),
}, forcePlay: true);
word = "Word02";
clear = beat + 4f;
if (doSound)
MultiSound.Play(new MultiSound.Sound[]
{
new MultiSound.Sound("karateman/hit", beat + 0.5f, offset: hitVoiceOffset),
new MultiSound.Sound("karateman/two", beat + 1f),
}, forcePlay: true);
break;
case (int) HitThree.HitThree:
Word.Play("Word03");
wordClearTime = beat + 4f;
MultiSound.Play(new MultiSound.Sound[]
{
new MultiSound.Sound("karateman/hit", beat + 0.5f, offset: hitVoiceOffset),
new MultiSound.Sound("karateman/three", beat + 1f),
}, forcePlay: true);
word = "Word03";
clear = beat + 4f;
if (doSound)
MultiSound.Play(new MultiSound.Sound[]
{
new MultiSound.Sound("karateman/hit", beat + 0.5f, offset: hitVoiceOffset),
new MultiSound.Sound("karateman/three", beat + 1f),
}, forcePlay: true);
break;
case (int) HitThree.HitThreeAlt:
Word.Play("Word03");
wordClearTime = beat + 4f;
MultiSound.Play(new MultiSound.Sound[]
{
new MultiSound.Sound("karateman/hitAlt", beat + 0.5f, offset: hitVoiceOffset),
new MultiSound.Sound("karateman/threeAlt", beat + 1f),
}, forcePlay: true);
word = "Word03";
clear = beat + 4f;
if (doSound)
MultiSound.Play(new MultiSound.Sound[]
{
new MultiSound.Sound("karateman/hitAlt", beat + 0.5f, offset: hitVoiceOffset),
new MultiSound.Sound("karateman/threeAlt", beat + 1f),
}, forcePlay: true);
break;
case (int) HitThree.HitFour:
Word.Play("Word04");
wordClearTime = beat + 4f;
MultiSound.Play(new MultiSound.Sound[]
{
new MultiSound.Sound("karateman/hit", beat + 0.5f, offset: hitVoiceOffset),
new MultiSound.Sound("karateman/four", beat + 1f),
}, forcePlay: true);
word = "Word04";
clear = beat + 4f;
if (doSound)
MultiSound.Play(new MultiSound.Sound[]
{
new MultiSound.Sound("karateman/hit", beat + 0.5f, offset: hitVoiceOffset),
new MultiSound.Sound("karateman/four", beat + 1f),
}, forcePlay: true);
break;
case (int) HitThree.Grr:
Word.Play("Word01");
wordClearTime = beat + 1f;
word = "Word01";
clear = beat + 1f;
break;
case (int) HitThree.Warning:
Word.Play("Word05");
wordClearTime = beat + 1f;
word = "Word05";
clear = beat + 1f;
break;
case (int) HitThree.Combo:
Word.Play("Word00");
wordClearTime = beat + 3f;
word = "Word00";
clear = beat + 3f;
break;
case (int) HitThree.HitOne: //really?
Word.Play("Word06");
wordClearTime = beat + 4f;
MultiSound.Play(new MultiSound.Sound[]
{
new MultiSound.Sound("karateman/hit", beat + 0.5f, offset: hitVoiceOffset),
new MultiSound.Sound("karateman/one", beat + 1f),
}, forcePlay: true);
word = "Word06";
clear = beat + 4f;
if (doSound)
MultiSound.Play(new MultiSound.Sound[]
{
new MultiSound.Sound("karateman/hit", beat + 0.5f, offset: hitVoiceOffset),
new MultiSound.Sound("karateman/one", beat + 1f),
}, forcePlay: true);
break;
}
if (Conductor.instance.songPositionInBeats <= clear && Conductor.instance.songPositionInBeats >= beat)
{
Word.Play(word);
wordClearTime = clear;
}
}
public void CreateItem(float beat, int type)
@ -545,6 +563,37 @@ namespace HeavenStudio.Games
return mobj;
}
void SetBgEffectsToLast(float beat)
{
var bgfx = GameManager.instance.Beatmap.entities.FindAll(en => en.datamodel == "karateman/set background effects");
for (int i = 0; i < bgfx.Count; i++)
{
var e = bgfx[i];
if (e.beat > beat)
break;
SetBgAndShadowCol(e.beat, e.length, e.type, e.type2, e.colorA, e.colorB, e.type3);
}
var bgtex = GameManager.instance.Beatmap.entities.FindAll(en => en.datamodel == "karateman/set background texture");
for (int i = 0; i < bgtex.Count; i++)
{
var e = bgtex[i];
if (e.beat > beat)
break;
SetBgTexture(e.type, e.type2, e.colorA, e.colorB);
}
// has issues when creating a new hitx entity so this is deactivated for now
// var hitx = GameManager.instance.Beatmap.entities.FindAll(en => en.datamodel == "karateman/hitX");
// for (int i = 0; i < hitx.Count; i++)
// {
// var e = hitx[i];
// if (e.beat > beat)
// break;
// Debug.Log("hitx");
// DoWord(e.beat, e.type, false);
// }
}
public void SetBgAndShadowCol(float beat, float length, int bgType, int shadowType, Color a, Color b, int fx)
{
SetBgFx(fx, beat, length);
@ -629,7 +678,6 @@ namespace HeavenStudio.Games
float fadeProg = Conductor.instance.GetPositionFromBeat(bgFadeTime, bgFadeDuration);
if (fadeProg <= 1f && fadeProg >= 0)
{
Debug.Log(fadeProg);
return Color.LerpUnclamped(lastCol, nextCol, fadeProg);
}
return next ? nextCol : lastCol;
@ -651,20 +699,20 @@ namespace HeavenStudio.Games
public void SetParticleEffect(float beat, int type, float windStrength, float particleStrength)
{
ParticleSystem.EmissionModule emm = SnowEffect.emission;
ParticleSystem.EmissionModule emm;
switch (type)
{
case (int) ParticleType.Snow:
SnowEffectGO.SetActive(true);
SnowEffect.Play();
emm = SnowEffect.emission;
emm.rateOverTime = particleStrength * 16f;
emm.rateOverTime = particleStrength * 6f;
break;
case (int) ParticleType.Fire:
FireEffectGO.SetActive(true);
FireEffect.Play();
emm = FireEffect.emission;
emm.rateOverTime = particleStrength * 8f;
emm.rateOverTime = particleStrength * 6f;
break;
case (int) ParticleType.Rain:
RainEffectGO.SetActive(true);
@ -681,6 +729,19 @@ namespace HeavenStudio.Games
Wind.windMain = windStrength;
}
public void ToggleBop(bool toggle)
{
if (toggle)
Joe.bop.length = Single.MaxValue;
else
Joe.bop.length = 0;
}
public void Prepare(float beat, float length)
{
Joe.Prepare(beat, length);
}
public void SetFaceExpression(int face)
{
Joe.SetFaceExpression(face);

View file

@ -30,9 +30,11 @@ namespace HeavenStudio.Games.Scripts_KarateMan
public bool wantKick = false;
public bool inKick = false;
float lastChargeTime = Single.MinValue;
float unPrepareTime = Single.MinValue;
bool canEmote = false;
public int wantFace = 0;
bool inSpecial { get { return inCombo || Conductor.instance.GetPositionFromBeat(lastChargeTime, 2.75f) <= 0.25f; } }
bool inSpecial { get { return inCombo || lockedInCombo || Conductor.instance.GetPositionFromBeat(lastChargeTime, 2.75f) <= 0.25f; } }
private void Awake()
{
@ -42,7 +44,15 @@ namespace HeavenStudio.Games.Scripts_KarateMan
private void Update()
{
var cond = Conductor.instance;
if (cond.ReportBeat(ref bop.lastReportedBeat, bop.startBeat % 1, false) && cond.songPositionInBeats > bop.startBeat && !inCombo)
if (unPrepareTime != Single.MinValue && cond.songPositionInBeats >= unPrepareTime)
{
unPrepareTime = Single.MinValue;
anim.speed = 1f;
anim.Play("Beat", -1, 0);
}
if (cond.ReportBeat(ref bop.lastReportedBeat, bop.startBeat % 1, false) && cond.songPositionInBeats > bop.startBeat && cond.songPositionInBeats >= unPrepareTime && !inCombo)
{
anim.speed = 1f;
anim.Play("Beat", -1, 0);
@ -127,6 +137,12 @@ namespace HeavenStudio.Games.Scripts_KarateMan
}
UpdateShadowColour();
if (canEmote && wantFace >= 0)
{
SetFaceExpressionForced(wantFace);
if (wantFace == (int) KarateMan.KarateManFaces.Surprise) wantFace = -1;
}
}
public bool Punch(int forceHand = 0)
@ -136,6 +152,7 @@ namespace HeavenStudio.Games.Scripts_KarateMan
bool straight = false;
anim.speed = 1f;
unPrepareTime = Single.MinValue;
lastChargeTime = Single.MinValue;
inKick = false;
@ -171,6 +188,7 @@ namespace HeavenStudio.Games.Scripts_KarateMan
if (GameManager.instance.currentGame != "karateman") return;
var cond = Conductor.instance;
bop.startBeat = cond.songPositionInBeats + 1f;
unPrepareTime = Single.MinValue;
switch (seq)
{
case 0:
@ -201,6 +219,8 @@ namespace HeavenStudio.Games.Scripts_KarateMan
var cond = Conductor.instance;
lastComboMissTime = beat;
bop.startBeat = beat + 3f;
unPrepareTime = Single.MinValue;
anim.DoNormalizedAnimation("LowKickMiss");
}
public void ForceFailCombo(float beat)
@ -226,6 +246,7 @@ namespace HeavenStudio.Games.Scripts_KarateMan
public void StartKickCharge(float beat)
{
wantKick = true;
unPrepareTime = Single.MinValue;
BeatAction.New(gameObject, new List<BeatAction.Action>()
{
new BeatAction.Action(beat, delegate {
@ -245,7 +266,8 @@ namespace HeavenStudio.Games.Scripts_KarateMan
if (!inKick) return;
//play the kick animation and reset stance
anim.speed = 1f;
bop.startBeat = beat + 2.5f;
bop.startBeat = beat + 1f;
unPrepareTime = Single.MinValue;
lastChargeTime = Single.MinValue;
inKick = false;
@ -270,13 +292,22 @@ namespace HeavenStudio.Games.Scripts_KarateMan
}
}
public void Prepare(float beat, float length)
{
anim.speed = 0f;
anim.Play("Beat", -1, 0);
unPrepareTime = beat + length;
}
public void SetFaceExpressionForced(int face)
{
wantFace = -2;
FaceAnim.DoScaledAnimationAsync("Face" + face.ToString("D2"));
}
public void SetFaceExpression(int face, bool ignoreCheck = false)
{
wantFace = face;
if (canEmote || ignoreCheck)
FaceAnim.DoScaledAnimationAsync("Face" + face.ToString("D2"));
}

View file

@ -239,7 +239,7 @@ namespace HeavenStudio.Games.Scripts_KarateMan
if (prog <= 1f)
{
transform.position = CurrentCurve.GetPoint(prog);
transform.rotation = Quaternion.Euler(0, 0, transform.rotation.eulerAngles.z + (-180f * Time.deltaTime * (1/cond.pitchedSecPerBeat)));
transform.rotation = Quaternion.Euler(0, 0, transform.rotation.eulerAngles.z + (-270f * Time.deltaTime * (1/cond.pitchedSecPerBeat)));
}
else
{
@ -298,7 +298,7 @@ namespace HeavenStudio.Games.Scripts_KarateMan
{
case ItemType.Bulb:
CurrentCurve = ItemCurves[straight ? 1 : 0];
curveTargetBeat = 2f;
curveTargetBeat = straight ? 1f : 1.5f;;
Jukebox.PlayOneShotGame("karateman/lightbulbHit", forcePlay: true);
p = Instantiate(HitParticles[5], HitPosition[1].position, Quaternion.Euler(0, 0, UnityEngine.Random.Range(0f, 360f)), KarateMan.instance.ItemHolder);
@ -322,21 +322,21 @@ namespace HeavenStudio.Games.Scripts_KarateMan
break;
case ItemType.Rock:
CurrentCurve = ItemCurves[1];
curveTargetBeat = 2f;
curveTargetBeat = 1f;
Jukebox.PlayOneShotGame("karateman/rockHit", forcePlay: true);
p = Instantiate(HitParticles[4], HitPosition[1].position, Quaternion.identity, KarateMan.instance.ItemHolder);
p.Play();
break;
case ItemType.Ball:
CurrentCurve = ItemCurves[1];
curveTargetBeat = 2f;
curveTargetBeat = 1f;
Jukebox.PlayOneShotGame("karateman/soccerHit", forcePlay: true);
p = Instantiate(HitParticles[1], HitPosition[1].position, Quaternion.Euler(0, 0, UnityEngine.Random.Range(0f, 360f)), KarateMan.instance.ItemHolder);
p.Play();
break;
case ItemType.Cooking:
CurrentCurve = ItemCurves[1];
curveTargetBeat = 2f;
curveTargetBeat = 1f;
Jukebox.PlayOneShotGame("karateman/cookingPot", forcePlay: true);
p = Instantiate(HitParticles[1], HitPosition[1].position, Quaternion.Euler(0, 0, UnityEngine.Random.Range(0f, 360f)), KarateMan.instance.ItemHolder);
p.Play();
@ -345,14 +345,14 @@ namespace HeavenStudio.Games.Scripts_KarateMan
break;
case ItemType.Alien:
CurrentCurve = ItemCurves[1];
curveTargetBeat = 2f;
curveTargetBeat = 1f;
Jukebox.PlayOneShotGame("karateman/alienHit", forcePlay: true);
p = Instantiate(HitParticles[1], HitPosition[1].position, Quaternion.Euler(0, 0, UnityEngine.Random.Range(0f, 360f)), KarateMan.instance.ItemHolder);
p.Play();
break;
case ItemType.TacoBell:
CurrentCurve = ItemCurves[1];
curveTargetBeat = 2f;
curveTargetBeat = 1f;
Jukebox.PlayOneShotGame("karateman/rockHit", forcePlay: true);
Jukebox.PlayOneShotGame("karateman/tacobell", forcePlay: true);
p = Instantiate(HitParticles[1], HitPosition[1].position, Quaternion.Euler(0, 0, UnityEngine.Random.Range(0f, 360f)), KarateMan.instance.ItemHolder);
@ -360,14 +360,14 @@ namespace HeavenStudio.Games.Scripts_KarateMan
break;
case ItemType.ComboPot1:
CurrentCurve = ItemCurves[straight ? 1 : 0];
curveTargetBeat = 2f;
curveTargetBeat = 1.5f;
Jukebox.PlayOneShotGame("karateman/comboHit1", forcePlay: true);
p = Instantiate(HitParticles[1], HitPosition[1].position, Quaternion.Euler(0, 0, UnityEngine.Random.Range(0f, 360f)), KarateMan.instance.ItemHolder);
p.Play();
break;
case ItemType.ComboPot2:
CurrentCurve = ItemCurves[0];
curveTargetBeat = 2f;
curveTargetBeat = 1.5f;
Jukebox.PlayOneShotGame("karateman/comboHit1", forcePlay: true);
p = Instantiate(HitParticles[1], HitPosition[1].position, Quaternion.Euler(0, 0, UnityEngine.Random.Range(0f, 360f)), KarateMan.instance.ItemHolder);
p.Play();
@ -415,7 +415,7 @@ namespace HeavenStudio.Games.Scripts_KarateMan
break;
default:
CurrentCurve = ItemCurves[straight ? 1 : 0];
curveTargetBeat = 2f;
curveTargetBeat = straight ? 1f : 1.5f;
Jukebox.PlayOneShotGame("karateman/potHit", forcePlay: true);
p = Instantiate(HitParticles[3], HitPosition[1].position, Quaternion.identity, KarateMan.instance.ItemHolder);
p.Play();
@ -505,7 +505,14 @@ namespace HeavenStudio.Games.Scripts_KarateMan
curveTargetBeat = 1f;
Jukebox.PlayOneShot("miss");
status = FlyStatus.NG;
joe.SetFaceExpression((int) KarateMan.KarateManFaces.Sad);
BeatAction.New(joe.gameObject, new List<BeatAction.Action>()
{
new BeatAction.Action(startBeat + 2f, delegate {
joe.SetFaceExpression((int) KarateMan.KarateManFaces.Normal);
}),
});
}
else {
ItemHitEffect(straight);
@ -532,6 +539,16 @@ namespace HeavenStudio.Games.Scripts_KarateMan
else {
ItemHitEffect();
}
BeatAction.New(joe.gameObject, new List<BeatAction.Action>()
{
new BeatAction.Action(startBeat + 4f, delegate {
joe.SetFaceExpression((int) KarateMan.KarateManFaces.Sad);
}),
new BeatAction.Action(startBeat + 6f, delegate {
joe.SetFaceExpression((int) KarateMan.KarateManFaces.Normal);
}),
});
}
}
@ -539,15 +556,20 @@ namespace HeavenStudio.Games.Scripts_KarateMan
public void ItemThrough(PlayerActionEvent caller)
{
var joe = KarateMan.instance.Joe;
if (GameManager.instance.currentGame != "karateman") return;
if (status != FlyStatus.Fly || gameObject == null) return;
BeatAction.New(KarateMan.instance.Joe.gameObject, new List<BeatAction.Action>()
BeatAction.New(joe.gameObject, new List<BeatAction.Action>()
{
new BeatAction.Action(startBeat + 2f, delegate {
//TODO: play miss sound
//deduct flow if applicable
KarateMan.instance.Joe.SetFaceExpression((int) KarateMan.KarateManFaces.Surprise);
})
joe.SetFaceExpression((int) KarateMan.KarateManFaces.Surprise);
}),
new BeatAction.Action(startBeat + 6f, delegate {
if (joe.wantFace == -1)
joe.SetFaceExpression((int) KarateMan.KarateManFaces.Normal);
}),
});
}
@ -576,15 +598,20 @@ namespace HeavenStudio.Games.Scripts_KarateMan
public void ComboStartOut(PlayerActionEvent caller) {}
public void ComboStartThrough(PlayerActionEvent caller)
{
var joe = KarateMan.instance.Joe;
if (GameManager.instance.currentGame != "karateman") return;
if (status != FlyStatus.Fly || gameObject == null) return;
BeatAction.New(KarateMan.instance.Joe.gameObject, new List<BeatAction.Action>()
BeatAction.New(joe.gameObject, new List<BeatAction.Action>()
{
new BeatAction.Action(startBeat + 2f, delegate {
//TODO: play miss sound
//deduct flow if applicable
KarateMan.instance.Joe.SetFaceExpression((int) KarateMan.KarateManFaces.Surprise);
})
joe.SetFaceExpression((int) KarateMan.KarateManFaces.Surprise);
}),
new BeatAction.Action(startBeat + 6f, delegate {
if (joe.wantFace == -1)
joe.SetFaceExpression((int) KarateMan.KarateManFaces.Normal);
}),
});
}
@ -629,7 +656,10 @@ namespace HeavenStudio.Games.Scripts_KarateMan
{
new BeatAction.Action(startBeat + 2f, delegate {
joe.SetFaceExpression((int) KarateMan.KarateManFaces.Sad);
})
}),
new BeatAction.Action(startBeat + 6f, delegate {
joe.SetFaceExpression((int) KarateMan.KarateManFaces.Normal);
}),
});
}
else {
@ -661,11 +691,16 @@ namespace HeavenStudio.Games.Scripts_KarateMan
//TODO: play miss sound
//deduct flow if applicable
joe.SetFaceExpression((int) KarateMan.KarateManFaces.Surprise);
})
}),
new BeatAction.Action(startBeat + 6f, delegate {
if (joe.wantFace == -1)
joe.SetFaceExpression((int) KarateMan.KarateManFaces.Normal);
}),
});
}
else
{
joe.SetFaceExpression((int) KarateMan.KarateManFaces.VerySad);
BeatAction.New(joe.gameObject, new List<BeatAction.Action>()
{
new BeatAction.Action(startBeat + 1.5f, delegate {
@ -674,8 +709,11 @@ namespace HeavenStudio.Games.Scripts_KarateMan
joe.SetShouldComboId(-1);
joe.ComboSequence(4);
}),
new BeatAction.Action(startBeat + 2.5f, delegate {
new BeatAction.Action(startBeat + 2f, delegate {
joe.SetFaceExpression((int) KarateMan.KarateManFaces.VerySad);
}),
new BeatAction.Action(startBeat + 5f, delegate {
joe.SetFaceExpression((int) KarateMan.KarateManFaces.Normal);
})
});
}
@ -704,8 +742,15 @@ namespace HeavenStudio.Games.Scripts_KarateMan
CurrentCurve = ItemCurves[6];
curveTargetBeat = 1f;
Jukebox.PlayOneShot("miss");
joe.SetFaceExpression((int) KarateMan.KarateManFaces.Sad);
status = FlyStatus.NG;
joe.SetFaceExpression((int) KarateMan.KarateManFaces.Sad);
BeatAction.New(joe.gameObject, new List<BeatAction.Action>()
{
new BeatAction.Action(startBeat + 2f, delegate {
joe.SetFaceExpression((int) KarateMan.KarateManFaces.Normal);
}),
});
}
else {
joe.StartKickCharge(startBeat + 1.25f);
@ -728,7 +773,11 @@ namespace HeavenStudio.Games.Scripts_KarateMan
//TODO: play miss sound
//deduct flow if applicable
joe.SetFaceExpression((int) KarateMan.KarateManFaces.Surprise);
})
}),
new BeatAction.Action(startBeat + 6f, delegate {
if (joe.wantFace == -1)
joe.SetFaceExpression((int) KarateMan.KarateManFaces.Normal);
}),
});
}
@ -743,8 +792,17 @@ namespace HeavenStudio.Games.Scripts_KarateMan
CurrentCurve = ItemCurves[8];
curveTargetBeat = 1f;
Jukebox.PlayOneShot("miss");
joe.SetFaceExpression((int) KarateMan.KarateManFaces.Sad);
status = FlyStatus.NG;
BeatAction.New(joe.gameObject, new List<BeatAction.Action>()
{
new BeatAction.Action(startBeat + 1.25f, delegate {
joe.SetFaceExpression((int) KarateMan.KarateManFaces.Sad);
}),
new BeatAction.Action(startBeat + 4.25f, delegate {
joe.SetFaceExpression((int) KarateMan.KarateManFaces.Normal);
}),
});
}
else {
ItemHitEffect();
@ -753,12 +811,13 @@ namespace HeavenStudio.Games.Scripts_KarateMan
startBeat = Conductor.instance.songPositionInBeats;
curveTargetBeat = 3f;
BeatAction.New(joe.gameObject, new List<BeatAction.Action>()
{
new BeatAction.Action(startBeat + 1.25f, delegate {
joe.SetFaceExpression((int) KarateMan.KarateManFaces.Smirk);
}),
new BeatAction.Action(startBeat + 3.25f, delegate {
new BeatAction.Action(startBeat + 4.25f, delegate {
joe.SetFaceExpression((int) KarateMan.KarateManFaces.Normal);
})
});

View file

@ -6,7 +6,7 @@ namespace HeavenStudio.Games
{
public class Minigame : MonoBehaviour
{
public static float earlyTime = 0.1f, perfectTime = 0.06f, lateTime = 0.06f, endTime = 0.1f;
public static float earlyTime = 0.1f, perfectTime = 0.08f, aceEarlyTime = 0.02f, aceLateTime = 0.02f, lateTime = 0.08f, endTime = 0.1f;
public List<Minigame.Eligible> EligibleHits = new List<Minigame.Eligible>();
[System.Serializable]

View file

@ -24,7 +24,7 @@ namespace HeavenStudio.Util
{
float pos = Conductor.instance.GetPositionFromBeat(startTime, length) * timeScale;
anim.Play(animName, animLayer, pos);
anim.speed = 0;
anim.speed = 1f; //not 0 so these can still play their script events
}
/// <summary>
@ -37,7 +37,7 @@ namespace HeavenStudio.Util
public static void DoNormalizedAnimation(this Animator anim, string animName, float pos = 0f, int animLayer = -1)
{
anim.Play(animName, animLayer, pos);
anim.speed = 0;
anim.speed = 1f;
}
/// <summary>