mirror of
https://github.com/RHeavenStudioPlus/HeavenStudioPlus.git
synced 2024-11-10 03:35:10 +00:00
Rhythm Rally: Feature complete!
This commit is contained in:
parent
69cd51533b
commit
c0a6a39a66
4 changed files with 207 additions and 33 deletions
|
@ -231,6 +231,53 @@ TrailRenderer:
|
|||
m_MinVertexDistance: 0
|
||||
m_Autodestruct: 0
|
||||
m_Emitting: 1
|
||||
--- !u!1 &1257124471349076628
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
serializedVersion: 6
|
||||
m_Component:
|
||||
- component: {fileID: 5158384670841200219}
|
||||
- component: {fileID: 2314256703083581536}
|
||||
m_Layer: 10
|
||||
m_Name: Point 0
|
||||
m_TagString: Untagged
|
||||
m_Icon: {fileID: 0}
|
||||
m_NavMeshLayer: 0
|
||||
m_StaticEditorFlags: 0
|
||||
m_IsActive: 1
|
||||
--- !u!4 &5158384670841200219
|
||||
Transform:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 1257124471349076628}
|
||||
m_LocalRotation: {x: 0, y: -0.9677092, z: 0, w: 0.25206932}
|
||||
m_LocalPosition: {x: -0.122241914, y: 0, z: -2}
|
||||
m_LocalScale: {x: 1, y: 1, z: 1}
|
||||
m_Children: []
|
||||
m_Father: {fileID: 506835011669317729}
|
||||
m_RootOrder: 0
|
||||
m_LocalEulerAnglesHint: {x: 0, y: -150.8, z: 0}
|
||||
--- !u!114 &2314256703083581536
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 1257124471349076628}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: b0cca3244f403c24f819a870f31cdc29, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
curve: {fileID: 5538105623002387221}
|
||||
handleType: 0
|
||||
leftHandleLocalPosition: {x: 0, y: -0.55, z: 0.88}
|
||||
rightHandleLocalPosition: {x: -0, y: 0.55, z: -0.88}
|
||||
--- !u!1 &1501271021389222783
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
|
@ -568,8 +615,8 @@ MonoBehaviour:
|
|||
m_EditorClassIdentifier:
|
||||
curve: {fileID: 10327036049174933}
|
||||
handleType: 0
|
||||
leftHandleLocalPosition: {x: 0, y: 0.4, z: 0}
|
||||
rightHandleLocalPosition: {x: -0, y: -0.4, z: -0}
|
||||
leftHandleLocalPosition: {x: 0, y: 0.3, z: 0}
|
||||
rightHandleLocalPosition: {x: -0, y: -0.3, z: -0}
|
||||
--- !u!1 &2034480636994138272
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
|
@ -1010,6 +1057,53 @@ MonoBehaviour:
|
|||
handleType: 0
|
||||
leftHandleLocalPosition: {x: 0, y: -0.5382855, z: 0.5024216}
|
||||
rightHandleLocalPosition: {x: -0, y: 0.5382855, z: -0.5024216}
|
||||
--- !u!1 &4009041324107224318
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
serializedVersion: 6
|
||||
m_Component:
|
||||
- component: {fileID: 2465361459840967449}
|
||||
- component: {fileID: 2886349517281533004}
|
||||
m_Layer: 10
|
||||
m_Name: Point 1
|
||||
m_TagString: Untagged
|
||||
m_Icon: {fileID: 0}
|
||||
m_NavMeshLayer: 0
|
||||
m_StaticEditorFlags: 0
|
||||
m_IsActive: 1
|
||||
--- !u!4 &2465361459840967449
|
||||
Transform:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 4009041324107224318}
|
||||
m_LocalRotation: {x: 0, y: -0.9677092, z: 0, w: 0.25206932}
|
||||
m_LocalPosition: {x: 1, y: 0, z: 0}
|
||||
m_LocalScale: {x: 1, y: 1, z: 1}
|
||||
m_Children: []
|
||||
m_Father: {fileID: 506835011669317729}
|
||||
m_RootOrder: 1
|
||||
m_LocalEulerAnglesHint: {x: 0, y: -150.8, z: 0}
|
||||
--- !u!114 &2886349517281533004
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 4009041324107224318}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: b0cca3244f403c24f819a870f31cdc29, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
curve: {fileID: 6371738825610660614}
|
||||
handleType: 0
|
||||
leftHandleLocalPosition: {x: 0, y: 0.55, z: 0.88}
|
||||
rightHandleLocalPosition: {x: -0, y: -0.55, z: -0.88}
|
||||
--- !u!1 &4052947733920485538
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
|
@ -1369,8 +1463,61 @@ MonoBehaviour:
|
|||
m_EditorClassIdentifier:
|
||||
curve: {fileID: 10327036049174933}
|
||||
handleType: 0
|
||||
leftHandleLocalPosition: {x: 0, y: -0.4, z: 0}
|
||||
rightHandleLocalPosition: {x: -0, y: 0.4, z: -0}
|
||||
leftHandleLocalPosition: {x: 0, y: -0.3, z: 0}
|
||||
rightHandleLocalPosition: {x: -0, y: 0.3, z: -0}
|
||||
--- !u!1 &5678911816253455763
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
serializedVersion: 6
|
||||
m_Component:
|
||||
- component: {fileID: 506835011669317729}
|
||||
- component: {fileID: 5538105623002387221}
|
||||
m_Layer: 10
|
||||
m_Name: MissCurve
|
||||
m_TagString: Untagged
|
||||
m_Icon: {fileID: 0}
|
||||
m_NavMeshLayer: 0
|
||||
m_StaticEditorFlags: 0
|
||||
m_IsActive: 1
|
||||
--- !u!4 &506835011669317729
|
||||
Transform:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 5678911816253455763}
|
||||
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
|
||||
m_LocalPosition: {x: 0, y: 0, z: 0}
|
||||
m_LocalScale: {x: 1, y: 1, z: 1}
|
||||
m_Children:
|
||||
- {fileID: 5158384670841200219}
|
||||
- {fileID: 2465361459840967449}
|
||||
m_Father: {fileID: 227248172885675867}
|
||||
m_RootOrder: 3
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
--- !u!114 &5538105623002387221
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 5678911816253455763}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: 066a41e004f415b4eb74d5e61a2aadbe, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
curveColor: {r: 0, g: 1, b: 0, a: 1}
|
||||
startPointColor: {r: 1, g: 0, b: 0, a: 1}
|
||||
endPointColor: {r: 0, g: 0, b: 1, a: 1}
|
||||
sampling: 25
|
||||
keyPoints:
|
||||
- {fileID: 2314256703083581536}
|
||||
- {fileID: 2886349517281533004}
|
||||
normalizedTime: 0.5
|
||||
--- !u!1 &6399112775887748606
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
|
@ -1747,6 +1894,7 @@ MonoBehaviour:
|
|||
serveCurve: {fileID: 6371738825610660614}
|
||||
returnCurve: {fileID: 2715991891693212353}
|
||||
tossCurve: {fileID: 10327036049174933}
|
||||
missCurve: {fileID: 5538105623002387221}
|
||||
ballHitFX: {fileID: 8205255986357351166}
|
||||
playerAnim: {fileID: 9089436218394572253}
|
||||
opponentAnim: {fileID: 4559734961269837672}
|
||||
|
@ -1758,6 +1906,7 @@ MonoBehaviour:
|
|||
serveBeat: 0
|
||||
targetBeat: 0
|
||||
tossBeat: 0
|
||||
missBeat: 0
|
||||
tossLength: 0
|
||||
paddlers: {fileID: 2423225589381961324}
|
||||
--- !u!1 &8205255986357351166
|
||||
|
@ -1872,6 +2021,7 @@ Transform:
|
|||
- {fileID: 1845910055258765698}
|
||||
- {fileID: 2492954830728060394}
|
||||
- {fileID: 9077140957458773248}
|
||||
- {fileID: 506835011669317729}
|
||||
m_Father: {fileID: 4631944531018638297}
|
||||
m_RootOrder: 4
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
|
@ -2739,16 +2889,16 @@ Transform:
|
|||
m_CorrespondingSourceObject: {fileID: 9109367605909020171, guid: cebeb8610d89fb34688750080a285ddb, type: 3}
|
||||
m_PrefabInstance: {fileID: 7108288251017691004}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
--- !u!4 &7291063904195614871 stripped
|
||||
Transform:
|
||||
m_CorrespondingSourceObject: {fileID: -8679921383154817045, guid: cebeb8610d89fb34688750080a285ddb, type: 3}
|
||||
m_PrefabInstance: {fileID: 7108288251017691004}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
--- !u!1 &7954728381481796141 stripped
|
||||
GameObject:
|
||||
m_CorrespondingSourceObject: {fileID: 919132149155446097, guid: cebeb8610d89fb34688750080a285ddb, type: 3}
|
||||
m_PrefabInstance: {fileID: 7108288251017691004}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
--- !u!4 &7291063904195614871 stripped
|
||||
Transform:
|
||||
m_CorrespondingSourceObject: {fileID: -8679921383154817045, guid: cebeb8610d89fb34688750080a285ddb, type: 3}
|
||||
m_PrefabInstance: {fileID: 7108288251017691004}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
--- !u!95 &9089436218394572253
|
||||
Animator:
|
||||
serializedVersion: 3
|
||||
|
|
|
@ -27,7 +27,9 @@ namespace RhythmHeavenMania.Games.RhythmRally
|
|||
{
|
||||
if (!game.served || game.missed || !game.started) return;
|
||||
|
||||
float stateBeat = Conductor.instance.GetPositionFromMargin(game.targetBeat, 1f);
|
||||
var cond = Conductor.instance;
|
||||
|
||||
float stateBeat = cond.GetPositionFromMargin(game.targetBeat, 1f);
|
||||
StateCheck(stateBeat);
|
||||
|
||||
if (PlayerInput.Pressed())
|
||||
|
@ -41,6 +43,10 @@ namespace RhythmHeavenMania.Games.RhythmRally
|
|||
Miss();
|
||||
Jukebox.PlayOneShot("miss");
|
||||
playerAnim.Play("Swing", 0, 0);
|
||||
|
||||
game.missCurve.KeyPoints[0].Position = game.ball.transform.position;
|
||||
game.missCurve.transform.localScale = new Vector3(state.early ? 1f : -1f, 1f, 1f);
|
||||
game.missBeat = cond.songPositionInBeats;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -52,6 +58,7 @@ namespace RhythmHeavenMania.Games.RhythmRally
|
|||
if (stateBeat > Minigame.EndTime())
|
||||
{
|
||||
Miss();
|
||||
game.ball.SetActive(false);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -93,8 +100,6 @@ namespace RhythmHeavenMania.Games.RhythmRally
|
|||
whistleBeat = game.targetBeat + 0.5f;
|
||||
}
|
||||
|
||||
game.ball.SetActive(false);
|
||||
|
||||
MultiSound.Play(new MultiSound.Sound[] { new MultiSound.Sound("rhythmRally/Whistle", whistleBeat) });
|
||||
}
|
||||
|
||||
|
|
|
@ -23,6 +23,7 @@ namespace RhythmHeavenMania.Games.RhythmRally
|
|||
public BezierCurve3D serveCurve;
|
||||
public BezierCurve3D returnCurve;
|
||||
public BezierCurve3D tossCurve;
|
||||
public BezierCurve3D missCurve;
|
||||
public GameObject ballHitFX;
|
||||
|
||||
|
||||
|
@ -39,6 +40,7 @@ namespace RhythmHeavenMania.Games.RhythmRally
|
|||
public float serveBeat;
|
||||
public float targetBeat;
|
||||
public float tossBeat;
|
||||
public float missBeat;
|
||||
public float tossLength;
|
||||
private bool inPose;
|
||||
|
||||
|
@ -146,9 +148,9 @@ namespace RhythmHeavenMania.Games.RhythmRally
|
|||
|
||||
if (!missed)
|
||||
{
|
||||
float curveHeight = 1f;
|
||||
if (rallySpeed == RallySpeed.Fast && served)
|
||||
curveHeight = 0.5f;
|
||||
float curveHeight = 1.25f;
|
||||
if ((rallySpeed == RallySpeed.Fast && served) || rallySpeed == RallySpeed.SuperFast)
|
||||
curveHeight = 0.75f;
|
||||
else if (rallySpeed == RallySpeed.Fast && !served && hitPosition1 >= 1f)
|
||||
curveHeight = 2f;
|
||||
else if (rallySpeed == RallySpeed.Slow)
|
||||
|
@ -156,6 +158,10 @@ namespace RhythmHeavenMania.Games.RhythmRally
|
|||
|
||||
curveToUse.transform.localScale = new Vector3(1f, curveHeight, 1f);
|
||||
ball.transform.position = curveToUse.GetPoint(Mathf.Max(0, curvePosition));
|
||||
|
||||
// Make ball inactive before it passes through the floor.
|
||||
if (curvePosition > 1.05f)
|
||||
ball.SetActive(false);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -163,6 +169,14 @@ namespace RhythmHeavenMania.Games.RhythmRally
|
|||
{
|
||||
TossUpdate(tossBeat, tossLength);
|
||||
}
|
||||
else
|
||||
{
|
||||
var missPosition = cond.GetPositionFromBeat(missBeat, 1f);
|
||||
ball.transform.position = missCurve.GetPoint(Mathf.Max(0, missPosition));
|
||||
|
||||
if (missPosition > 1f)
|
||||
ball.SetActive(false);
|
||||
}
|
||||
}
|
||||
|
||||
// TODO: Make conditional so ball shadow only appears when over table.
|
||||
|
@ -189,10 +203,19 @@ namespace RhythmHeavenMania.Games.RhythmRally
|
|||
|
||||
// Check if paddler should do ready animation.
|
||||
bool readyToPrep;
|
||||
if (rallySpeed == RallySpeed.Slow || (!served && rallySpeed == RallySpeed.Fast))
|
||||
readyToPrep = timeBeforeNextHit <= 2f;
|
||||
else
|
||||
readyToPrep = timeBeforeNextHit <= 1f;
|
||||
switch (rallySpeed)
|
||||
{
|
||||
case RallySpeed.Slow:
|
||||
case RallySpeed.Fast:
|
||||
readyToPrep = timeBeforeNextHit <= 2f;
|
||||
break;
|
||||
case RallySpeed.SuperFast:
|
||||
readyToPrep = timeBeforeNextHit <= 0.5f;
|
||||
break;
|
||||
default:
|
||||
readyToPrep = timeBeforeNextHit <= 1f;
|
||||
break;
|
||||
}
|
||||
|
||||
// Paddler ready animation.
|
||||
if (readyToPrep && !opponentServing && !inPose)
|
||||
|
@ -264,6 +287,9 @@ namespace RhythmHeavenMania.Games.RhythmRally
|
|||
if (!ball.activeSelf)
|
||||
ball.SetActive(true);
|
||||
|
||||
if (!ballTrail.gameObject.activeSelf)
|
||||
ballTrail.gameObject.SetActive(true);
|
||||
|
||||
served = true;
|
||||
missed = false;
|
||||
started = true;
|
||||
|
@ -301,6 +327,9 @@ namespace RhythmHeavenMania.Games.RhythmRally
|
|||
|
||||
public void Toss(float beat, float length, float height, bool firstToss = false)
|
||||
{
|
||||
// Hide trail while tossing to prevent weirdness while teleporting ball.
|
||||
ballTrail.gameObject.SetActive(false);
|
||||
|
||||
tossCurve.transform.localScale = new Vector3(1f, height, 1f);
|
||||
tossBeat = beat;
|
||||
tossLength = length;
|
||||
|
@ -313,25 +342,15 @@ namespace RhythmHeavenMania.Games.RhythmRally
|
|||
|
||||
if (!ball.activeSelf)
|
||||
ball.SetActive(true);
|
||||
|
||||
StartCoroutine(TossTrailCo());
|
||||
}
|
||||
|
||||
// Hide the trail for one frame to avoid shenanigans when teleporting the ball.
|
||||
IEnumerator TossTrailCo()
|
||||
{
|
||||
ballTrail.emitting = false;
|
||||
TossUpdate(tossBeat, tossLength);
|
||||
|
||||
yield return null;
|
||||
|
||||
ballTrail.emitting = true;
|
||||
}
|
||||
|
||||
private void TossUpdate(float beat, float duration)
|
||||
{
|
||||
var tossPosition = Conductor.instance.GetPositionFromBeat(beat, duration);
|
||||
ball.transform.position = tossCurve.GetPoint(Mathf.Clamp(tossPosition, 0, 1));
|
||||
|
||||
if (tossPosition > 1.05f)
|
||||
ball.SetActive(false);
|
||||
}
|
||||
|
||||
public void PlayWhistle()
|
||||
|
|
|
@ -330,7 +330,7 @@ namespace RhythmHeavenMania
|
|||
} ),
|
||||
}),
|
||||
|
||||
new Minigame("rhythmRally", "Rhythm Rally \n<color=#eb5454>[WIP don't use]</color>", "FFFFFF", true, false, new List<GameAction>()
|
||||
new Minigame("rhythmRally", "Rhythm Rally", "FFFFFF", true, false, new List<GameAction>()
|
||||
{
|
||||
new GameAction("bop", delegate { RhythmRally.instance.Bop(eventCaller.currentEntity.beat, eventCaller.currentEntity.length); }, 0.5f, true),
|
||||
new GameAction("whistle", delegate { RhythmRally.instance.PlayWhistle(); }, 0.5f),
|
||||
|
|
Loading…
Reference in a new issue