mirror of
https://github.com/RHeavenStudio/HeavenStudio.git
synced 2025-06-12 08:57:37 +02:00
facial expressions
- activated thru certain actions (NG input, special moves) or can be forced via entity
This commit is contained in:
@ -56,7 +56,11 @@ namespace HeavenStudio.Games.Loaders
|
||||
{
|
||||
new Param("type", KarateMan.ParticleType.None, "Particle Type", "The type of particle effect to spawn"),
|
||||
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("valB", new EntityTypes.Float(1f, 12f, 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>()
|
||||
{
|
||||
new Param("type", KarateMan.KarateManFaces.Normal, "Facial Expression", "The facial expression to force Joe to. Special moves may override this")
|
||||
}),
|
||||
|
||||
// These are still here for backwards-compatibility but are hidden in the editor
|
||||
@ -155,6 +159,7 @@ namespace HeavenStudio.Games
|
||||
{
|
||||
Plain,
|
||||
Gradient,
|
||||
Radial,
|
||||
Blood,
|
||||
//ManMan?
|
||||
}
|
||||
@ -178,6 +183,18 @@ namespace HeavenStudio.Games
|
||||
Fire,
|
||||
Rain
|
||||
}
|
||||
|
||||
public enum KarateManFaces
|
||||
{
|
||||
Normal,
|
||||
Smirk,
|
||||
Surprise,
|
||||
Sad,
|
||||
Lenny,
|
||||
Happy,
|
||||
VerySad,
|
||||
Blush
|
||||
}
|
||||
|
||||
public Color[] LightBulbColors;
|
||||
public Color[] BackgroundColors;
|
||||
@ -591,5 +608,10 @@ namespace HeavenStudio.Games
|
||||
}
|
||||
Wind.windMain = windStrength;
|
||||
}
|
||||
|
||||
public void SetFaceExpression(int face)
|
||||
{
|
||||
Joe.SetFaceExpression(face);
|
||||
}
|
||||
}
|
||||
}
|
@ -11,6 +11,7 @@ namespace HeavenStudio.Games.Scripts_KarateMan
|
||||
public class KarateManJoe : MonoBehaviour
|
||||
{
|
||||
public Animator anim;
|
||||
public Animator FaceAnim;
|
||||
public GameEvent bop = new GameEvent();
|
||||
public SpriteRenderer[] Shadows;
|
||||
|
||||
@ -29,6 +30,7 @@ namespace HeavenStudio.Games.Scripts_KarateMan
|
||||
public bool wantKick = false;
|
||||
public bool inKick = false;
|
||||
float lastChargeTime = Single.MinValue;
|
||||
bool canEmote = false;
|
||||
|
||||
bool inSpecial { get { return inCombo || Conductor.instance.GetPositionFromBeat(lastChargeTime, 2.75f) <= 0.25f; } }
|
||||
|
||||
@ -44,6 +46,7 @@ namespace HeavenStudio.Games.Scripts_KarateMan
|
||||
{
|
||||
anim.speed = 1f;
|
||||
anim.Play("Beat", -1, 0);
|
||||
lastChargeTime = Single.MinValue;
|
||||
}
|
||||
|
||||
if (inCombo && shouldComboId == -2)
|
||||
@ -71,12 +74,12 @@ namespace HeavenStudio.Games.Scripts_KarateMan
|
||||
if (chargeProg >= 0f && chargeProg < 1f)
|
||||
{
|
||||
anim.DoScaledAnimation("ManCharge", lastChargeTime, 2.75f);
|
||||
bop.startBeat = lastChargeTime + 2.75f;
|
||||
bop.startBeat = lastChargeTime + 1.75f;
|
||||
}
|
||||
else if (chargeProg >= 1f)
|
||||
{
|
||||
anim.speed = 1f;
|
||||
bop.startBeat = lastChargeTime + 2.75f;
|
||||
bop.startBeat = lastChargeTime + 1.75f;
|
||||
lastChargeTime = Single.MinValue;
|
||||
inKick = false;
|
||||
}
|
||||
@ -229,7 +232,7 @@ namespace HeavenStudio.Games.Scripts_KarateMan
|
||||
wantKick = false;
|
||||
inKick = true;
|
||||
lastChargeTime = beat;
|
||||
bop.startBeat = beat + 2.75f;
|
||||
bop.startBeat = beat + 1.75f;
|
||||
}
|
||||
})
|
||||
});
|
||||
@ -247,6 +250,16 @@ namespace HeavenStudio.Games.Scripts_KarateMan
|
||||
anim.DoScaledAnimationAsync("ManKick", 0.5f);
|
||||
}
|
||||
|
||||
public void MarkCanEmote()
|
||||
{
|
||||
canEmote = true;
|
||||
}
|
||||
|
||||
public void MarkNoEmote()
|
||||
{
|
||||
canEmote = false;
|
||||
}
|
||||
|
||||
public void UpdateShadowColour()
|
||||
{
|
||||
foreach (var shadow in Shadows)
|
||||
@ -254,5 +267,16 @@ namespace HeavenStudio.Games.Scripts_KarateMan
|
||||
shadow.color = KarateMan.instance.GetShadowColor();
|
||||
}
|
||||
}
|
||||
|
||||
public void SetFaceExpressionForced(int face)
|
||||
{
|
||||
FaceAnim.DoScaledAnimationAsync("Face" + face.ToString("D2"));
|
||||
}
|
||||
|
||||
public void SetFaceExpression(int face, bool ignoreCheck = false)
|
||||
{
|
||||
if (canEmote || ignoreCheck)
|
||||
FaceAnim.DoScaledAnimationAsync("Face" + face.ToString("D2"));
|
||||
}
|
||||
}
|
||||
}
|
@ -495,6 +495,7 @@ namespace HeavenStudio.Games.Scripts_KarateMan
|
||||
curveTargetBeat = 1f;
|
||||
Jukebox.PlayOneShot("miss");
|
||||
status = FlyStatus.NG;
|
||||
joe.SetFaceExpression((int) KarateMan.KarateManFaces.Sad);
|
||||
}
|
||||
else {
|
||||
ItemHitEffect(straight);
|
||||
@ -530,11 +531,12 @@ namespace HeavenStudio.Games.Scripts_KarateMan
|
||||
{
|
||||
if (GameManager.instance.currentGame != "karateman") return;
|
||||
if (status != FlyStatus.Fly || gameObject == null) return;
|
||||
BeatAction.New(gameObject, new List<BeatAction.Action>()
|
||||
BeatAction.New(KarateMan.instance.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);
|
||||
})
|
||||
});
|
||||
}
|
||||
@ -564,7 +566,16 @@ namespace HeavenStudio.Games.Scripts_KarateMan
|
||||
public void ComboStartOut(PlayerActionEvent caller) {}
|
||||
public void ComboStartThrough(PlayerActionEvent caller)
|
||||
{
|
||||
if (GameManager.instance.currentGame != "karateman") return;
|
||||
if (status != FlyStatus.Fly || gameObject == null) return;
|
||||
BeatAction.New(KarateMan.instance.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);
|
||||
})
|
||||
});
|
||||
}
|
||||
|
||||
public void ComboStartWrongAction(PlayerActionEvent caller, float state)
|
||||
@ -603,9 +614,25 @@ namespace HeavenStudio.Games.Scripts_KarateMan
|
||||
curveTargetBeat = 1f;
|
||||
Jukebox.PlayOneShot("miss");
|
||||
status = FlyStatus.NG;
|
||||
|
||||
BeatAction.New(joe.gameObject, new List<BeatAction.Action>()
|
||||
{
|
||||
new BeatAction.Action(startBeat + 2f, delegate {
|
||||
joe.SetFaceExpression((int) KarateMan.KarateManFaces.Sad);
|
||||
})
|
||||
});
|
||||
}
|
||||
else {
|
||||
ItemHitEffect();
|
||||
BeatAction.New(joe.gameObject, new List<BeatAction.Action>()
|
||||
{
|
||||
new BeatAction.Action(startBeat + 1.5f, delegate {
|
||||
joe.SetFaceExpression((int) KarateMan.KarateManFaces.Happy);
|
||||
}),
|
||||
new BeatAction.Action(startBeat + 3.5f, delegate {
|
||||
joe.SetFaceExpression((int) KarateMan.KarateManFaces.Normal);
|
||||
})
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -616,16 +643,32 @@ namespace HeavenStudio.Games.Scripts_KarateMan
|
||||
if (GameManager.instance.currentGame != "karateman") return;
|
||||
if (status != FlyStatus.Fly || gameObject == null) return;
|
||||
var joe = KarateMan.instance.Joe;
|
||||
if (joe.GetComboId() != comboId || !joe.inCombo) return;
|
||||
BeatAction.New(gameObject, new List<BeatAction.Action>()
|
||||
if (joe.GetComboId() != comboId || !joe.inCombo)
|
||||
{
|
||||
new BeatAction.Action(startBeat + 1.5f, delegate {
|
||||
joe.inCombo = false;
|
||||
joe.SetComboId(-1);
|
||||
joe.SetShouldComboId(-1);
|
||||
joe.ComboSequence(4);
|
||||
})
|
||||
});
|
||||
BeatAction.New(joe.gameObject, new List<BeatAction.Action>()
|
||||
{
|
||||
new BeatAction.Action(startBeat + 2f, delegate {
|
||||
//TODO: play miss sound
|
||||
//deduct flow if applicable
|
||||
joe.SetFaceExpression((int) KarateMan.KarateManFaces.Surprise);
|
||||
})
|
||||
});
|
||||
}
|
||||
else
|
||||
{
|
||||
BeatAction.New(joe.gameObject, new List<BeatAction.Action>()
|
||||
{
|
||||
new BeatAction.Action(startBeat + 1.5f, delegate {
|
||||
joe.inCombo = false;
|
||||
joe.SetComboId(-1);
|
||||
joe.SetShouldComboId(-1);
|
||||
joe.ComboSequence(4);
|
||||
}),
|
||||
new BeatAction.Action(startBeat + 2.5f, delegate {
|
||||
joe.SetFaceExpression((int) KarateMan.KarateManFaces.VerySad);
|
||||
})
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
public void ComboEndWrongAction(PlayerActionEvent caller, float state)
|
||||
@ -651,6 +694,7 @@ namespace HeavenStudio.Games.Scripts_KarateMan
|
||||
CurrentCurve = ItemCurves[6];
|
||||
curveTargetBeat = 1f;
|
||||
Jukebox.PlayOneShot("miss");
|
||||
joe.SetFaceExpression((int) KarateMan.KarateManFaces.Sad);
|
||||
status = FlyStatus.NG;
|
||||
}
|
||||
else {
|
||||
@ -665,13 +709,15 @@ namespace HeavenStudio.Games.Scripts_KarateMan
|
||||
|
||||
public void KickChargeThrough(PlayerActionEvent caller)
|
||||
{
|
||||
var joe = KarateMan.instance.Joe;
|
||||
if (GameManager.instance.currentGame != "karateman") return;
|
||||
if (status != FlyStatus.Fly || gameObject == null) return;
|
||||
BeatAction.New(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
|
||||
joe.SetFaceExpression((int) KarateMan.KarateManFaces.Surprise);
|
||||
})
|
||||
});
|
||||
}
|
||||
@ -687,6 +733,7 @@ namespace HeavenStudio.Games.Scripts_KarateMan
|
||||
CurrentCurve = ItemCurves[8];
|
||||
curveTargetBeat = 1f;
|
||||
Jukebox.PlayOneShot("miss");
|
||||
joe.SetFaceExpression((int) KarateMan.KarateManFaces.Sad);
|
||||
status = FlyStatus.NG;
|
||||
}
|
||||
else {
|
||||
@ -695,6 +742,16 @@ namespace HeavenStudio.Games.Scripts_KarateMan
|
||||
CurrentCurve = ItemCurves[7];
|
||||
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 {
|
||||
joe.SetFaceExpression((int) KarateMan.KarateManFaces.Normal);
|
||||
})
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -705,11 +762,12 @@ namespace HeavenStudio.Games.Scripts_KarateMan
|
||||
{
|
||||
if (GameManager.instance.currentGame != "karateman") return;
|
||||
if (status != FlyStatus.Fly || gameObject == null) return;
|
||||
BeatAction.New(gameObject, new List<BeatAction.Action>()
|
||||
BeatAction.New(KarateMan.instance.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.VerySad);
|
||||
})
|
||||
});
|
||||
}
|
||||
|
Reference in New Issue
Block a user