mirror of
https://github.com/RHeavenStudio/HeavenStudio.git
synced 2025-06-13 05:47:40 +02:00
Some new curves
This commit is contained in:
@ -7,50 +7,31 @@ using HeavenStudio.Util;
|
||||
|
||||
namespace HeavenStudio.Games.Scripts_WorkingDough
|
||||
{
|
||||
public class BGBall : MonoBehaviour
|
||||
public class BGBall : SuperCurveObject
|
||||
{
|
||||
public double startBeat;
|
||||
public float firstBeatsToTravel = 3f;
|
||||
public float secondBeatsToTravel = 1f;
|
||||
public float thirdBeatsToTravel = 3f;
|
||||
public enum CurveStage
|
||||
private double startBeat = double.MinValue;
|
||||
private Path path;
|
||||
|
||||
public void Init(double beat)
|
||||
{
|
||||
Conveyer = 0,
|
||||
StartFall = 1,
|
||||
Fall = 2
|
||||
startBeat = beat;
|
||||
path = WorkingDough.instance.GetPath("BGBall");
|
||||
Update();
|
||||
}
|
||||
public CurveStage currentCurveStage;
|
||||
[NonSerialized] public BezierCurve3D firstCurve;
|
||||
[NonSerialized] public BezierCurve3D secondCurve;
|
||||
[NonSerialized] public BezierCurve3D thirdCurve;
|
||||
|
||||
private void Update()
|
||||
{
|
||||
var cond = Conductor.instance;
|
||||
|
||||
float flyPos = 0f;
|
||||
|
||||
switch (currentCurveStage)
|
||||
if (cond.isPlaying && !cond.isPaused)
|
||||
{
|
||||
case CurveStage.Conveyer:
|
||||
flyPos = cond.GetPositionFromBeat(startBeat, firstBeatsToTravel);
|
||||
transform.position = firstCurve.GetPoint(flyPos);
|
||||
if (flyPos > 1f)
|
||||
{
|
||||
currentCurveStage = CurveStage.StartFall;
|
||||
}
|
||||
break;
|
||||
case CurveStage.StartFall:
|
||||
flyPos = cond.GetPositionFromBeat(startBeat + firstBeatsToTravel, secondBeatsToTravel);
|
||||
transform.position = secondCurve.GetPoint(flyPos);
|
||||
if (flyPos > 1f) currentCurveStage = CurveStage.Fall;
|
||||
break;
|
||||
case CurveStage.Fall:
|
||||
flyPos = cond.GetPositionFromBeat(startBeat + secondBeatsToTravel + firstBeatsToTravel, thirdBeatsToTravel);
|
||||
|
||||
transform.position = thirdCurve.GetPoint(flyPos);
|
||||
if (flyPos > 1f) GameObject.Destroy(gameObject);
|
||||
break;
|
||||
double beat = cond.songPositionInBeats;
|
||||
if (startBeat != double.MinValue)
|
||||
{
|
||||
Vector3 pos = GetPathPositionFromBeat(path, Math.Max(startBeat, beat), startBeat);
|
||||
transform.position = pos;
|
||||
if (beat >= startBeat + 9) Destroy(gameObject);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -7,55 +7,31 @@ using HeavenStudio.Util;
|
||||
|
||||
namespace HeavenStudio.Games.Scripts_WorkingDough
|
||||
{
|
||||
public enum FlyingStage
|
||||
public class NPCDoughBall : SuperCurveObject
|
||||
{
|
||||
EnteringUp = 0,
|
||||
EnteringDown = 1,
|
||||
ExitingUp = 2,
|
||||
ExitingDown = 3
|
||||
}
|
||||
public class NPCDoughBall : MonoBehaviour
|
||||
{
|
||||
public double startBeat;
|
||||
private double startBeat = double.MinValue;
|
||||
private Path path;
|
||||
|
||||
public FlyingStage currentFlyingStage = FlyingStage.EnteringUp;
|
||||
|
||||
|
||||
[NonSerialized] public BezierCurve3D enterUpCurve;
|
||||
[NonSerialized] public BezierCurve3D enterDownCurve;
|
||||
[NonSerialized] public BezierCurve3D exitUpCurve;
|
||||
[NonSerialized] public BezierCurve3D exitDownCurve;
|
||||
public void Init(double beat)
|
||||
{
|
||||
startBeat = beat;
|
||||
path = WorkingDough.instance.GetPath("NPCBall");
|
||||
Update();
|
||||
}
|
||||
|
||||
private void Update()
|
||||
{
|
||||
var cond = Conductor.instance;
|
||||
|
||||
float flyPos = 0f;
|
||||
|
||||
switch (currentFlyingStage) {
|
||||
case FlyingStage.EnteringUp:
|
||||
flyPos = cond.GetPositionFromBeat(startBeat, 0.5f);
|
||||
transform.position = enterUpCurve.GetPoint(flyPos);
|
||||
if (flyPos > 1f) currentFlyingStage = FlyingStage.EnteringDown;
|
||||
break;
|
||||
case FlyingStage.EnteringDown:
|
||||
flyPos = cond.GetPositionFromBeat(startBeat + 0.5f, 0.5f);
|
||||
|
||||
transform.position = enterDownCurve.GetPoint(flyPos);
|
||||
if (flyPos > 1f) currentFlyingStage = FlyingStage.ExitingUp;
|
||||
break;
|
||||
case FlyingStage.ExitingUp:
|
||||
flyPos = cond.GetPositionFromBeat(startBeat + 1f, 0.5f);
|
||||
|
||||
transform.position = exitUpCurve.GetPoint(flyPos);
|
||||
if (flyPos > 1f) currentFlyingStage = FlyingStage.ExitingDown;
|
||||
break;
|
||||
case FlyingStage.ExitingDown:
|
||||
flyPos = cond.GetPositionFromBeat(startBeat + 1.5f, 0.5f);
|
||||
|
||||
transform.position = exitDownCurve.GetPoint(flyPos);
|
||||
if (flyPos > 1f) GameObject.Destroy(gameObject);
|
||||
break;
|
||||
if (cond.isPlaying && !cond.isPaused)
|
||||
{
|
||||
double beat = cond.songPositionInBeats;
|
||||
if (startBeat > double.MinValue)
|
||||
{
|
||||
Vector3 pos = GetPathPositionFromBeat(path, Math.Max(beat, startBeat), startBeat);
|
||||
transform.position = pos;
|
||||
if (beat >= startBeat + 2) Destroy(gameObject);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -102,7 +102,10 @@ namespace HeavenStudio.Games.Loaders
|
||||
|
||||
namespace HeavenStudio.Games
|
||||
{
|
||||
using HeavenStudio.Games.Scripts_DoubleDate;
|
||||
using Scripts_WorkingDough;
|
||||
using System.Net.Sockets;
|
||||
|
||||
public class WorkingDough : Minigame
|
||||
{
|
||||
[Header("Components")]
|
||||
@ -173,10 +176,6 @@ namespace HeavenStudio.Games
|
||||
string gandwMovingAnimName;
|
||||
|
||||
[Header("Curves")]
|
||||
public BezierCurve3D npcEnterUpCurve;
|
||||
public BezierCurve3D npcEnterDownCurve;
|
||||
public BezierCurve3D npcExitUpCurve;
|
||||
public BezierCurve3D npcExitDownCurve;
|
||||
public BezierCurve3D playerEnterUpCurve;
|
||||
public BezierCurve3D playerEnterDownCurve;
|
||||
public BezierCurve3D playerExitUpCurve;
|
||||
@ -187,12 +186,29 @@ namespace HeavenStudio.Games
|
||||
public BezierCurve3D playerBarelyCurveSecond;
|
||||
public BezierCurve3D playerWrongInputTooWeakFirstCurve;
|
||||
public BezierCurve3D playerWrongInputTooWeakSecondCurve;
|
||||
public BezierCurve3D firstBGCurveBig;
|
||||
public BezierCurve3D secondBGCurveBig;
|
||||
public BezierCurve3D thirdBGCurveBig;
|
||||
public BezierCurve3D firstBGCurveSmall;
|
||||
public BezierCurve3D secondBGCurveSmall;
|
||||
public BezierCurve3D thirdBGCurveSmall;
|
||||
[SerializeField] SuperCurveObject.Path[] ballBouncePaths;
|
||||
new void OnDrawGizmos()
|
||||
{
|
||||
base.OnDrawGizmos();
|
||||
foreach (SuperCurveObject.Path path in ballBouncePaths)
|
||||
{
|
||||
if (path.preview)
|
||||
{
|
||||
smallBallNPC.GetComponent<NPCDoughBall>().DrawEditorGizmo(path);
|
||||
}
|
||||
}
|
||||
}
|
||||
public SuperCurveObject.Path GetPath(string name)
|
||||
{
|
||||
foreach (SuperCurveObject.Path path in ballBouncePaths)
|
||||
{
|
||||
if (path.name == name)
|
||||
{
|
||||
return path;
|
||||
}
|
||||
}
|
||||
return default(SuperCurveObject.Path);
|
||||
}
|
||||
|
||||
[Header("Resources")]
|
||||
public Sprite whiteArrowSprite;
|
||||
@ -272,13 +288,9 @@ namespace HeavenStudio.Games
|
||||
var spawnedBall = GameObject.Instantiate(objectToSpawn, ballHolder);
|
||||
|
||||
var ballComponent = spawnedBall.GetComponent<NPCDoughBall>();
|
||||
ballComponent.startBeat = beat;
|
||||
ballComponent.exitUpCurve = npcExitUpCurve;
|
||||
ballComponent.enterUpCurve = npcEnterUpCurve;
|
||||
ballComponent.exitDownCurve = npcExitDownCurve;
|
||||
ballComponent.enterDownCurve = npcEnterDownCurve;
|
||||
|
||||
spawnedBall.SetActive(true);
|
||||
ballComponent.Init(beat);
|
||||
|
||||
|
||||
if (isBig && !bigMode)
|
||||
{
|
||||
@ -309,12 +321,7 @@ namespace HeavenStudio.Games
|
||||
var spawnedBall = GameObject.Instantiate(objectToSpawn, ballHolder);
|
||||
|
||||
var ballComponent = spawnedBall.GetComponent<NPCDoughBall>();
|
||||
ballComponent.startBeat = beat - 1f;
|
||||
ballComponent.exitUpCurve = npcExitUpCurve;
|
||||
ballComponent.enterUpCurve = npcEnterUpCurve;
|
||||
ballComponent.exitDownCurve = npcExitDownCurve;
|
||||
ballComponent.enterDownCurve = npcEnterDownCurve;
|
||||
ballComponent.currentFlyingStage = (FlyingStage)(2 - (int)Math.Abs(offSet));
|
||||
ballComponent.Init(beat);
|
||||
|
||||
if (isBig && !bigMode)
|
||||
{
|
||||
@ -718,12 +725,8 @@ namespace HeavenStudio.Games
|
||||
var spawnedBall = GameObject.Instantiate(objectToSpawn, ballHolder);
|
||||
|
||||
var ballComponent = spawnedBall.GetComponent<BGBall>();
|
||||
ballComponent.startBeat = beat;
|
||||
ballComponent.firstCurve = isBig ? firstBGCurveBig : firstBGCurveSmall;
|
||||
ballComponent.secondCurve = isBig ? secondBGCurveBig : secondBGCurveSmall;
|
||||
ballComponent.thirdCurve = isBig ? thirdBGCurveBig : thirdBGCurveSmall;
|
||||
|
||||
spawnedBall.SetActive(true);
|
||||
ballComponent.Init(beat);
|
||||
BeatAction.New(instance.gameObject, new List<BeatAction.Action>()
|
||||
{
|
||||
new BeatAction.Action(beat + 9f, delegate { if (!spaceshipRisen) spaceshipAnimator.Play("AbsorbBall", 0, 0); }),
|
||||
|
Reference in New Issue
Block a user