mirror of
https://github.com/RHeavenStudioPlus/HeavenStudioPlus.git
synced 2024-11-14 05:35:08 +00:00
Trick on the Class: update 2mo old code
This commit is contained in:
parent
4bd2879381
commit
3112e208d7
3 changed files with 79 additions and 86 deletions
|
@ -891,7 +891,7 @@ Transform:
|
||||||
m_PrefabAsset: {fileID: 0}
|
m_PrefabAsset: {fileID: 0}
|
||||||
m_GameObject: {fileID: 3418795074043480354}
|
m_GameObject: {fileID: 3418795074043480354}
|
||||||
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
|
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
|
||||||
m_LocalPosition: {x: -3.51, y: -7.09, z: -4.6045647}
|
m_LocalPosition: {x: -4.1600003, y: -7.09, z: -4.6045647}
|
||||||
m_LocalScale: {x: 1, y: 1, z: 1}
|
m_LocalScale: {x: 1, y: 1, z: 1}
|
||||||
m_Children: []
|
m_Children: []
|
||||||
m_Father: {fileID: 2005696115261101270}
|
m_Father: {fileID: 2005696115261101270}
|
||||||
|
@ -1758,6 +1758,9 @@ MonoBehaviour:
|
||||||
m_Script: {fileID: 11500000, guid: c32cb0e1f34c12c4f9440880fee8ff29, type: 3}
|
m_Script: {fileID: 11500000, guid: c32cb0e1f34c12c4f9440880fee8ff29, type: 3}
|
||||||
m_Name:
|
m_Name:
|
||||||
m_EditorClassIdentifier:
|
m_EditorClassIdentifier:
|
||||||
|
EligibleHits: []
|
||||||
|
scheduledInputs: []
|
||||||
|
firstEnable: 0
|
||||||
ballPrefab: {fileID: 7208854294000353610}
|
ballPrefab: {fileID: 7208854294000353610}
|
||||||
planePrefab: {fileID: 6092229326248261130}
|
planePrefab: {fileID: 6092229326248261130}
|
||||||
shockPrefab: {fileID: 7208854294000353610}
|
shockPrefab: {fileID: 7208854294000353610}
|
||||||
|
@ -1984,7 +1987,7 @@ Transform:
|
||||||
m_GameObject: {fileID: 7310611812045732801}
|
m_GameObject: {fileID: 7310611812045732801}
|
||||||
m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
|
m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
|
||||||
m_LocalPosition: {x: -1.4372144, y: -0.0925674, z: 0}
|
m_LocalPosition: {x: -1.4372144, y: -0.0925674, z: 0}
|
||||||
m_LocalScale: {x: 1, y: 1, z: 1}
|
m_LocalScale: {x: 1, y: 1, z: 1.25}
|
||||||
m_Children:
|
m_Children:
|
||||||
- {fileID: 1420343226113066666}
|
- {fileID: 1420343226113066666}
|
||||||
- {fileID: 1376113234299623101}
|
- {fileID: 1376113234299623101}
|
||||||
|
@ -2017,7 +2020,7 @@ Transform:
|
||||||
m_PrefabAsset: {fileID: 0}
|
m_PrefabAsset: {fileID: 0}
|
||||||
m_GameObject: {fileID: 7716535561277334307}
|
m_GameObject: {fileID: 7716535561277334307}
|
||||||
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
|
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
|
||||||
m_LocalPosition: {x: 7.69, y: 3.3324628, z: -2.448287}
|
m_LocalPosition: {x: 7.04, y: 3.3324628, z: -2.448287}
|
||||||
m_LocalScale: {x: 1, y: 1, z: 1}
|
m_LocalScale: {x: 1, y: 1, z: 1}
|
||||||
m_Children: []
|
m_Children: []
|
||||||
m_Father: {fileID: 2005696115261101270}
|
m_Father: {fileID: 2005696115261101270}
|
||||||
|
|
|
@ -12,8 +12,6 @@ namespace HeavenStudio.Games.Scripts_TrickClass
|
||||||
{
|
{
|
||||||
public bool flyType;
|
public bool flyType;
|
||||||
public float startBeat;
|
public float startBeat;
|
||||||
bool flying = true;
|
|
||||||
bool dodged = false;
|
|
||||||
bool miss = false;
|
bool miss = false;
|
||||||
|
|
||||||
float flyBeats;
|
float flyBeats;
|
||||||
|
@ -21,6 +19,7 @@ namespace HeavenStudio.Games.Scripts_TrickClass
|
||||||
public int type;
|
public int type;
|
||||||
|
|
||||||
[NonSerialized] public BezierCurve3D curve;
|
[NonSerialized] public BezierCurve3D curve;
|
||||||
|
PlayerActionEvent hitProg;
|
||||||
|
|
||||||
private TrickClass game;
|
private TrickClass game;
|
||||||
|
|
||||||
|
@ -34,16 +33,15 @@ namespace HeavenStudio.Games.Scripts_TrickClass
|
||||||
|
|
||||||
float flyPos = cond.GetPositionFromBeat(startBeat, flyBeats);
|
float flyPos = cond.GetPositionFromBeat(startBeat, flyBeats);
|
||||||
transform.position = curve.GetPoint(flyPos);
|
transform.position = curve.GetPoint(flyPos);
|
||||||
|
hitProg = game.ScheduleInput(startBeat, dodgeBeats, InputType.STANDARD_ALT_DOWN, DodgeJustOrNg, DodgeMiss, DodgeThrough);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Update is called once per frame
|
// Update is called once per frame
|
||||||
void Update()
|
void Update()
|
||||||
{
|
|
||||||
if (flying)
|
|
||||||
{
|
{
|
||||||
var cond = Conductor.instance;
|
var cond = Conductor.instance;
|
||||||
|
|
||||||
float flyPos = cond.GetPositionFromBeat(startBeat, flyBeats);
|
float flyPos = cond.GetPositionFromBeat(startBeat, flyBeats);
|
||||||
|
|
||||||
if (flyPos <= 1f)
|
if (flyPos <= 1f)
|
||||||
{
|
{
|
||||||
if (!miss)
|
if (!miss)
|
||||||
|
@ -68,7 +66,7 @@ namespace HeavenStudio.Games.Scripts_TrickClass
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
transform.position = curve.GetPoint(1f);
|
transform.position = curve.GetPoint(miss ? 1f : 0.9f);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (flyPos > 1f)
|
if (flyPos > 1f)
|
||||||
|
@ -79,51 +77,6 @@ namespace HeavenStudio.Games.Scripts_TrickClass
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!(dodged || miss))
|
|
||||||
{
|
|
||||||
float normalizedBeat = cond.GetPositionFromMargin(startBeat + dodgeBeats, 1f);
|
|
||||||
StateCheck(normalizedBeat);
|
|
||||||
|
|
||||||
if (PlayerInput.Pressed())
|
|
||||||
{
|
|
||||||
if (state.perfect)
|
|
||||||
{
|
|
||||||
dodged = true;
|
|
||||||
MultiSound.Play(new MultiSound.Sound[] {
|
|
||||||
new MultiSound.Sound("trickClass/ball_impact", startBeat + flyBeats, volume: 0.75f),
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
// no input?
|
|
||||||
if (Conductor.instance.GetPositionFromBeat(startBeat, dodgeBeats) >= Minigame.EndTime())
|
|
||||||
{
|
|
||||||
Jukebox.PlayOneShotGame(GetDodgeSound());
|
|
||||||
miss = true;
|
|
||||||
switch (type)
|
|
||||||
{
|
|
||||||
case (int) TrickClass.TrickObjType.Plane:
|
|
||||||
curve = TrickClass.instance.planeMissCurve;
|
|
||||||
flyBeats = 4f;
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
curve = TrickClass.instance.ballMissCurve;
|
|
||||||
flyBeats = 1.25f;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
startBeat += dodgeBeats;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public override void OnAce()
|
|
||||||
{
|
|
||||||
TrickClass.instance.PlayerDodge();
|
|
||||||
dodged = true;
|
|
||||||
MultiSound.Play(new MultiSound.Sound[] {
|
|
||||||
new MultiSound.Sound(GetDodgeSound(), startBeat + flyBeats, volume: 0.5f),
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public string GetDodgeSound()
|
public string GetDodgeSound()
|
||||||
|
@ -134,5 +87,45 @@ namespace HeavenStudio.Games.Scripts_TrickClass
|
||||||
return "trickClass/ball_impact";
|
return "trickClass/ball_impact";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void DodgeJustOrNg(PlayerActionEvent caller, float state)
|
||||||
|
{
|
||||||
|
if (state <= -1f || state >= 1f)
|
||||||
|
{
|
||||||
|
//NG
|
||||||
|
game.PlayerDodge();
|
||||||
|
MultiSound.Play(new MultiSound.Sound[] {
|
||||||
|
new MultiSound.Sound("trickClass/ball_impact", startBeat + flyBeats, volume: 0.75f),
|
||||||
|
});
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
//just
|
||||||
|
game.PlayerDodge();
|
||||||
|
MultiSound.Play(new MultiSound.Sound[] {
|
||||||
|
new MultiSound.Sound("trickClass/ball_impact", startBeat + flyBeats, volume: 0.75f),
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void DodgeMiss(PlayerActionEvent caller)
|
||||||
|
{
|
||||||
|
Jukebox.PlayOneShotGame(GetDodgeSound());
|
||||||
|
miss = true;
|
||||||
|
switch (type)
|
||||||
|
{
|
||||||
|
case (int) TrickClass.TrickObjType.Plane:
|
||||||
|
curve = game.planeMissCurve;
|
||||||
|
flyBeats = 4f;
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
curve = game.ballMissCurve;
|
||||||
|
flyBeats = 1.25f;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
startBeat += dodgeBeats;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void DodgeThrough(PlayerActionEvent caller) {}
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -12,9 +12,8 @@ namespace HeavenStudio.Games.Loaders
|
||||||
public static class MobTrickLoader
|
public static class MobTrickLoader
|
||||||
{
|
{
|
||||||
public static Minigame AddGame(EventCaller eventCaller) {
|
public static Minigame AddGame(EventCaller eventCaller) {
|
||||||
return new Minigame("trickClass", "Trick on the Class\n<color=#eb5454>[WIP don't use]</color>", "C0171D", false, false, new List<GameAction>()
|
return new Minigame("trickClass", "Trick on the Class\n<color=#eb5454>[WIP]</color>", "C0171D", false, false, new List<GameAction>()
|
||||||
{
|
{
|
||||||
new GameAction("bop", delegate { var e = eventCaller.currentEntity; TrickClass.instance.Bop(e.beat, e.length); }, 1, true),
|
|
||||||
new GameAction("toss", delegate
|
new GameAction("toss", delegate
|
||||||
{
|
{
|
||||||
TrickClass.instance.TossObject(eventCaller.currentEntity.beat, eventCaller.currentEntity.type);
|
TrickClass.instance.TossObject(eventCaller.currentEntity.beat, eventCaller.currentEntity.type);
|
||||||
|
@ -22,6 +21,7 @@ namespace HeavenStudio.Games.Loaders
|
||||||
{
|
{
|
||||||
new Param("type", TrickClass.TrickObjType.Ball, "Object", "The object to toss")
|
new Param("type", TrickClass.TrickObjType.Ball, "Object", "The object to toss")
|
||||||
}),
|
}),
|
||||||
|
new GameAction("bop", delegate { var e = eventCaller.currentEntity; TrickClass.instance.Bop(e.beat, e.length); }, 1, true, hidden: true),
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -34,7 +34,7 @@ namespace HeavenStudio.Games
|
||||||
**/
|
**/
|
||||||
|
|
||||||
using Scripts_TrickClass;
|
using Scripts_TrickClass;
|
||||||
public class TrickClass : MonoBehaviour
|
public class TrickClass : Minigame
|
||||||
{
|
{
|
||||||
public enum TrickObjType {
|
public enum TrickObjType {
|
||||||
Plane,
|
Plane,
|
||||||
|
@ -69,14 +69,11 @@ namespace HeavenStudio.Games
|
||||||
{
|
{
|
||||||
var cond = Conductor.instance;
|
var cond = Conductor.instance;
|
||||||
if (cond.ReportBeat(ref bop.lastReportedBeat, bop.startBeat % 1))
|
if (cond.ReportBeat(ref bop.lastReportedBeat, bop.startBeat % 1))
|
||||||
{
|
|
||||||
if (cond.songPositionInBeats >= bop.startBeat && cond.songPositionInBeats < bop.startBeat + bop.length)
|
|
||||||
{
|
{
|
||||||
//TODO: bop animation
|
//TODO: bop animation
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
if (PlayerInput.Pressed())
|
if (PlayerInput.Pressed() && !IsExpectingInputNow())
|
||||||
{
|
{
|
||||||
PlayerDodge();
|
PlayerDodge();
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue