2023-01-19 17:18:55 +00:00
|
|
|
using HeavenStudio.Util;
|
|
|
|
using System;
|
|
|
|
using System.Collections.Generic;
|
|
|
|
using UnityEngine;
|
|
|
|
using NaughtyBezierCurves;
|
|
|
|
|
|
|
|
namespace HeavenStudio.Games.Loaders
|
|
|
|
{
|
|
|
|
using static Minigames;
|
|
|
|
public static class RvlWorkingDoughLoader
|
|
|
|
{
|
|
|
|
public static Minigame AddGame(EventCaller eventCaller)
|
|
|
|
{
|
2023-04-02 02:28:23 +00:00
|
|
|
return new Minigame("workingDough", "Working Dough", "000000", false, false, new List<GameAction>()
|
2023-01-19 17:18:55 +00:00
|
|
|
{
|
|
|
|
new GameAction("beat intervals", "Start Interval")
|
|
|
|
{
|
2023-01-22 19:22:39 +00:00
|
|
|
function = delegate { var e = eventCaller.currentEntity; WorkingDough.instance.SetIntervalStart(e.beat, e.length); },
|
2023-01-19 17:18:55 +00:00
|
|
|
preFunction = delegate { var e = eventCaller.currentEntity; WorkingDough.PreSetIntervalStart(e.beat, e.length); },
|
2023-01-20 15:48:30 +00:00
|
|
|
defaultLength = 8f,
|
2023-01-19 17:18:55 +00:00
|
|
|
resizable = true,
|
2023-01-22 19:22:39 +00:00
|
|
|
priority = 2
|
2023-01-19 17:18:55 +00:00
|
|
|
},
|
|
|
|
new GameAction("small ball", "Small Ball")
|
|
|
|
{
|
2023-01-22 19:22:39 +00:00
|
|
|
function = delegate { var e = eventCaller.currentEntity; WorkingDough.instance.OnSpawnBall(e.beat, false); },
|
2023-01-19 17:18:55 +00:00
|
|
|
preFunction = delegate { var e = eventCaller.currentEntity; WorkingDough.PreSpawnBall(e.beat, false); },
|
|
|
|
defaultLength = 0.5f,
|
2023-01-22 19:22:39 +00:00
|
|
|
priority = 1
|
2023-01-19 17:18:55 +00:00
|
|
|
},
|
|
|
|
new GameAction("big ball", "Big Ball")
|
|
|
|
{
|
2023-01-22 19:22:39 +00:00
|
|
|
function = delegate { var e = eventCaller.currentEntity; WorkingDough.instance.OnSpawnBall(e.beat, true); },
|
2023-01-19 17:18:55 +00:00
|
|
|
preFunction = delegate { var e = eventCaller.currentEntity; WorkingDough.PreSpawnBall(e.beat, true); },
|
|
|
|
defaultLength = 0.5f,
|
2023-01-22 19:22:39 +00:00
|
|
|
priority = 1
|
2023-01-19 17:18:55 +00:00
|
|
|
},
|
|
|
|
new GameAction("launch spaceship", "Launch Spaceship")
|
|
|
|
{
|
|
|
|
function = delegate { var e = eventCaller.currentEntity; WorkingDough.instance.LaunchShip(e.beat, e.length); },
|
|
|
|
defaultLength = 4f,
|
2023-01-20 15:48:30 +00:00
|
|
|
resizable = true,
|
2023-01-22 19:22:39 +00:00
|
|
|
priority = 0
|
2023-01-19 17:18:55 +00:00
|
|
|
},
|
|
|
|
new GameAction("rise spaceship", "Rise Up Spaceship")
|
|
|
|
{
|
|
|
|
function = delegate { var e = eventCaller.currentEntity; WorkingDough.instance.RiseUpShip(e.beat, e.length); },
|
|
|
|
defaultLength = 4f,
|
2023-01-20 15:48:30 +00:00
|
|
|
resizable = true,
|
2023-01-22 19:22:39 +00:00
|
|
|
priority = 0
|
2023-01-19 17:18:55 +00:00
|
|
|
},
|
|
|
|
new GameAction("lift dough dudes", "Lift Dough Dudes")
|
|
|
|
{
|
|
|
|
function = delegate { var e = eventCaller.currentEntity; WorkingDough.instance.Elevate(e.beat, e.length, e["toggle"]); },
|
|
|
|
defaultLength = 4f,
|
|
|
|
parameters = new List<Param>()
|
|
|
|
{
|
|
|
|
new Param("toggle", false, "Go Up?", "Toggle to go Up or Down.")
|
|
|
|
},
|
2023-01-20 15:48:30 +00:00
|
|
|
resizable = true,
|
2023-01-22 19:22:39 +00:00
|
|
|
priority = 0
|
2023-01-19 17:18:55 +00:00
|
|
|
},
|
|
|
|
new GameAction("instant lift", "Instant Lift")
|
|
|
|
{
|
|
|
|
function = delegate { var e = eventCaller.currentEntity; WorkingDough.instance.InstantElevation(e["toggle"]); },
|
|
|
|
parameters = new List<Param>()
|
|
|
|
{
|
|
|
|
new Param("toggle", true, "Go Up?", "Toggle to go Up or Down.")
|
|
|
|
},
|
|
|
|
defaultLength = 0.5f,
|
2023-01-22 19:22:39 +00:00
|
|
|
priority = 0
|
2023-01-19 17:18:55 +00:00
|
|
|
},
|
|
|
|
new GameAction("mr game and watch enter or exit", "Mr. G&W Enter or Exit")
|
|
|
|
{
|
|
|
|
function = delegate { var e = eventCaller.currentEntity; WorkingDough.instance.GANDWEnterOrExit(e.beat, e.length, e["toggle"]); },
|
|
|
|
defaultLength = 4f,
|
|
|
|
parameters = new List<Param>()
|
|
|
|
{
|
|
|
|
new Param("toggle", false, "Should exit?", "Toggle to make him leave or enter.")
|
|
|
|
},
|
2023-01-20 15:48:30 +00:00
|
|
|
resizable = true,
|
2023-01-22 19:22:39 +00:00
|
|
|
priority = 0
|
2023-01-19 17:18:55 +00:00
|
|
|
},
|
|
|
|
new GameAction("instant game and watch", "Instant Mr. G&W Enter or Exit")
|
|
|
|
{
|
|
|
|
function = delegate { var e = eventCaller.currentEntity; WorkingDough.instance.InstantGANDWEnterOrExit(e["toggle"]); },
|
|
|
|
parameters = new List<Param>()
|
|
|
|
{
|
|
|
|
new Param("toggle", false, "Exit?", "Toggle to make him leave or enter.")
|
|
|
|
},
|
|
|
|
defaultLength = 0.5f,
|
2023-01-22 19:22:39 +00:00
|
|
|
priority = 0
|
2023-01-19 17:18:55 +00:00
|
|
|
},
|
2023-05-28 17:34:44 +00:00
|
|
|
},
|
|
|
|
new List<string>() {"rvl", "repeat"},
|
|
|
|
"rvldough", "en",
|
|
|
|
new List<string>() {}
|
|
|
|
);
|
2023-01-19 17:18:55 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
namespace HeavenStudio.Games
|
|
|
|
{
|
|
|
|
using Scripts_WorkingDough;
|
|
|
|
public class WorkingDough : Minigame
|
|
|
|
{
|
|
|
|
[Header("Components")]
|
|
|
|
[SerializeField] GameObject doughDudesNPC; //Jump animations
|
|
|
|
public GameObject doughDudesPlayer; //Jump animations
|
|
|
|
[SerializeField] GameObject ballTransporterRightNPC; //Close and open animations
|
|
|
|
[SerializeField] GameObject ballTransporterLeftNPC; //Close and open animations
|
|
|
|
[SerializeField] GameObject ballTransporterRightPlayer; //Close and open animations
|
|
|
|
[SerializeField] GameObject ballTransporterLeftPlayer; //Close and open animations
|
|
|
|
[SerializeField] GameObject npcImpact;
|
|
|
|
[SerializeField] GameObject playerImpact;
|
|
|
|
[SerializeField] GameObject smallBallNPC;
|
|
|
|
[SerializeField] GameObject bigBallNPC;
|
|
|
|
[SerializeField] Transform ballHolder;
|
|
|
|
[SerializeField] SpriteRenderer arrowSRLeftNPC;
|
|
|
|
[SerializeField] SpriteRenderer arrowSRRightNPC;
|
|
|
|
[SerializeField] SpriteRenderer arrowSRLeftPlayer;
|
|
|
|
[SerializeField] SpriteRenderer arrowSRRightPlayer;
|
|
|
|
[SerializeField] GameObject NPCBallTransporters;
|
|
|
|
[SerializeField] GameObject PlayerBallTransporters;
|
|
|
|
[SerializeField] GameObject playerEnterSmallBall;
|
|
|
|
[SerializeField] GameObject playerEnterBigBall;
|
|
|
|
[SerializeField] GameObject missImpact;
|
|
|
|
[SerializeField] Transform breakParticleHolder;
|
|
|
|
[SerializeField] GameObject breakParticleEffect;
|
|
|
|
[SerializeField] Animator backgroundAnimator;
|
|
|
|
[SerializeField] Animator conveyerAnimator;
|
|
|
|
[SerializeField] GameObject smallBGBall;
|
|
|
|
[SerializeField] GameObject bigBGBall;
|
|
|
|
[SerializeField] Animator spaceshipAnimator;
|
|
|
|
[SerializeField] GameObject spaceshipLights;
|
|
|
|
[SerializeField] Animator doughDudesHolderAnim;
|
|
|
|
[SerializeField] Animator gandwAnim;
|
|
|
|
|
|
|
|
[Header("Variables")]
|
|
|
|
public bool intervalStarted;
|
2023-06-10 19:17:06 +00:00
|
|
|
double intervalStartBeat;
|
2023-01-19 17:18:55 +00:00
|
|
|
float risingLength = 4f;
|
2023-06-10 19:17:06 +00:00
|
|
|
double risingStartBeat;
|
2023-01-19 17:18:55 +00:00
|
|
|
float liftingLength = 4f;
|
2023-06-10 19:17:06 +00:00
|
|
|
double liftingStartBeat;
|
2023-01-22 19:22:39 +00:00
|
|
|
public static float beatInterval = 8f;
|
2023-01-19 17:18:55 +00:00
|
|
|
float gandMovingLength = 4f;
|
2023-06-10 19:17:06 +00:00
|
|
|
double gandMovingStartBeat;
|
2023-01-19 17:18:55 +00:00
|
|
|
public bool bigMode;
|
|
|
|
public bool bigModePlayer;
|
|
|
|
static List<QueuedBall> queuedBalls = new List<QueuedBall>();
|
|
|
|
struct QueuedBall
|
|
|
|
{
|
2023-06-10 19:17:06 +00:00
|
|
|
public double beat;
|
2023-01-19 17:18:55 +00:00
|
|
|
public bool isBig;
|
|
|
|
}
|
|
|
|
static List<QueuedInterval> queuedIntervals = new List<QueuedInterval>();
|
|
|
|
struct QueuedInterval
|
|
|
|
{
|
2023-06-10 19:17:06 +00:00
|
|
|
public double beat;
|
2023-01-19 17:18:55 +00:00
|
|
|
public float interval;
|
|
|
|
}
|
|
|
|
private List<GameObject> currentBalls = new List<GameObject>();
|
|
|
|
public bool shouldMiss = true;
|
|
|
|
public bool spaceshipRisen = false;
|
|
|
|
public bool spaceshipRising = false;
|
|
|
|
bool liftingDoughDudes;
|
|
|
|
string liftingAnimName;
|
|
|
|
bool ballTriggerSetInterval = true;
|
2023-01-20 15:48:30 +00:00
|
|
|
bool gandwHasEntered = true;
|
2023-01-19 17:18:55 +00:00
|
|
|
bool gandwMoving;
|
|
|
|
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;
|
|
|
|
public BezierCurve3D playerExitDownCurve;
|
|
|
|
public BezierCurve3D playerMissCurveFirst;
|
|
|
|
public BezierCurve3D playerMissCurveSecond;
|
|
|
|
public BezierCurve3D playerBarelyCurveFirst;
|
|
|
|
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;
|
|
|
|
|
|
|
|
[Header("Resources")]
|
|
|
|
public Sprite whiteArrowSprite;
|
|
|
|
public Sprite redArrowSprite;
|
|
|
|
|
|
|
|
public static WorkingDough instance;
|
|
|
|
|
|
|
|
void Awake()
|
|
|
|
{
|
|
|
|
instance = this;
|
|
|
|
}
|
|
|
|
|
|
|
|
void Start()
|
|
|
|
{
|
|
|
|
shouldMiss = true;
|
|
|
|
ballTriggerSetInterval = true;
|
|
|
|
conveyerAnimator.Play("ConveyerBelt", 0, 0);
|
|
|
|
doughDudesHolderAnim.Play("OnGround", 0, 0);
|
|
|
|
}
|
|
|
|
|
2023-06-10 19:17:06 +00:00
|
|
|
public void SetIntervalStart(double beat, float interval)
|
2023-01-19 17:18:55 +00:00
|
|
|
{
|
|
|
|
Debug.Log("Start Interval");
|
|
|
|
if (!intervalStarted)
|
|
|
|
{
|
2023-01-22 19:22:39 +00:00
|
|
|
instance.ballTriggerSetInterval = false;
|
2023-01-19 17:18:55 +00:00
|
|
|
intervalStarted = true;
|
|
|
|
bigMode = false;
|
|
|
|
BeatAction.New(ballTransporterLeftNPC, new List<BeatAction.Action>()
|
|
|
|
{
|
|
|
|
//Open player transporters
|
|
|
|
new BeatAction.Action(beat + interval - 1f, delegate {
|
|
|
|
ballTransporterLeftPlayer.GetComponent<Animator>().Play("BallTransporterLeftOpen", 0, 0);
|
|
|
|
}),
|
|
|
|
new BeatAction.Action(beat + interval - 1f, delegate {
|
|
|
|
ballTransporterRightPlayer.GetComponent<Animator>().Play("BallTransporterRightOpen", 0, 0);
|
|
|
|
}),
|
|
|
|
|
|
|
|
//End interval
|
|
|
|
new BeatAction.Action(beat + interval, delegate { intervalStarted = false; }),
|
|
|
|
new BeatAction.Action(beat + interval, delegate {ballTriggerSetInterval = true; }),
|
|
|
|
|
|
|
|
//Close npc transporters
|
|
|
|
new BeatAction.Action(beat + interval, delegate {
|
|
|
|
if (bigMode)
|
|
|
|
{
|
|
|
|
NPCBallTransporters.GetComponent<Animator>().Play("NPCExitBigMode", 0, 0);
|
|
|
|
bigMode = false;
|
|
|
|
}
|
|
|
|
}),
|
|
|
|
new BeatAction.Action(beat + interval + 1, delegate { if (!intervalStarted) ballTransporterLeftNPC.GetComponent<Animator>().Play("BallTransporterLeftClose", 0, 0); }),
|
|
|
|
new BeatAction.Action(beat + interval + 1, delegate { if (!intervalStarted) ballTransporterRightNPC.GetComponent<Animator>().Play("BallTransporterRightClose", 0, 0); }),
|
|
|
|
new BeatAction.Action(beat + interval + 1, delegate { if (gandwHasEntered) gandwAnim.Play("MrGameAndWatchLeverDown", 0, 0); }),
|
|
|
|
//Close player transporters
|
|
|
|
new BeatAction.Action(beat + interval * 2 + 1, delegate { ballTransporterLeftPlayer.GetComponent<Animator>().Play("BallTransporterLeftClose", 0, 0); }),
|
|
|
|
new BeatAction.Action(beat + interval * 2 + 1, delegate { ballTransporterRightPlayer.GetComponent<Animator>().Play("BallTransporterRightClose", 0, 0); }),
|
|
|
|
new BeatAction.Action(beat + interval * 2 + 1, delegate {
|
|
|
|
if (bigModePlayer)
|
|
|
|
{
|
|
|
|
PlayerBallTransporters.GetComponent<Animator>().Play("PlayerExitBigMode", 0, 0);
|
|
|
|
bigModePlayer = false;
|
|
|
|
}
|
|
|
|
}),
|
|
|
|
});
|
|
|
|
}
|
|
|
|
beatInterval = interval;
|
|
|
|
intervalStartBeat = beat;
|
|
|
|
}
|
|
|
|
|
2023-06-10 19:17:06 +00:00
|
|
|
public void SpawnBall(double beat, bool isBig)
|
2023-01-19 17:18:55 +00:00
|
|
|
{
|
|
|
|
if (!intervalStarted && ballTriggerSetInterval)
|
|
|
|
{
|
|
|
|
SetIntervalStart(beat, beatInterval);
|
|
|
|
}
|
|
|
|
var objectToSpawn = isBig ? bigBallNPC : smallBallNPC;
|
|
|
|
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);
|
|
|
|
|
|
|
|
if (isBig && !bigMode)
|
|
|
|
{
|
|
|
|
NPCBallTransporters.GetComponent<Animator>().Play("NPCGoBigMode", 0, 0);
|
|
|
|
bigMode = true;
|
|
|
|
}
|
|
|
|
|
2023-01-22 19:22:39 +00:00
|
|
|
MultiSound.Play(new MultiSound.Sound[] {
|
|
|
|
new MultiSound.Sound(isBig ? "workingDough/NPCBigBall" : "workingDough/NPCSmallBall", beat + 1f),
|
|
|
|
});
|
|
|
|
|
2023-01-19 17:18:55 +00:00
|
|
|
arrowSRLeftNPC.sprite = redArrowSprite;
|
|
|
|
BeatAction.New(doughDudesNPC, new List<BeatAction.Action>()
|
|
|
|
{
|
|
|
|
//Jump and play sound
|
|
|
|
new BeatAction.Action(beat + 0.1f, delegate { arrowSRLeftNPC.sprite = whiteArrowSprite; }),
|
|
|
|
new BeatAction.Action(beat + 1f, delegate { doughDudesNPC.GetComponent<Animator>().Play(isBig ? "BigDoughJump" :"SmallDoughJump", 0, 0); }),
|
|
|
|
new BeatAction.Action(beat + 1f, delegate { npcImpact.SetActive(true); }),
|
|
|
|
new BeatAction.Action(beat + 1.1f, delegate { npcImpact.SetActive(false); }),
|
|
|
|
new BeatAction.Action(beat + 1.9f, delegate { arrowSRRightNPC.sprite = redArrowSprite; }),
|
|
|
|
new BeatAction.Action(beat + 2f, delegate { arrowSRRightNPC.sprite = whiteArrowSprite; }),
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
2023-06-10 19:17:06 +00:00
|
|
|
public void InstantExitBall(double beat, bool isBig, double offSet)
|
2023-01-19 17:18:55 +00:00
|
|
|
{
|
|
|
|
var objectToSpawn = isBig ? bigBallNPC : smallBallNPC;
|
|
|
|
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;
|
2023-06-10 19:17:06 +00:00
|
|
|
ballComponent.currentFlyingStage = (FlyingStage)(2 - (int)Math.Abs(offSet));
|
2023-01-19 17:18:55 +00:00
|
|
|
|
|
|
|
if (isBig && !bigMode)
|
|
|
|
{
|
|
|
|
bigMode = true;
|
|
|
|
}
|
2023-01-22 19:22:39 +00:00
|
|
|
|
|
|
|
if (beat >= Conductor.instance.songPositionInBeatsAsDouble)
|
|
|
|
{
|
|
|
|
MultiSound.Play(new MultiSound.Sound[] {
|
|
|
|
new MultiSound.Sound(isBig ? "workingDough/NPCBigBall" : "workingDough/NPCSmallBall", beat),
|
|
|
|
});
|
|
|
|
}
|
2023-01-19 17:18:55 +00:00
|
|
|
|
|
|
|
BeatAction.New(doughDudesNPC, new List<BeatAction.Action>()
|
|
|
|
{
|
|
|
|
new BeatAction.Action(beat - offSet, delegate { spawnedBall.SetActive(true); }),
|
|
|
|
new BeatAction.Action(beat, delegate { doughDudesNPC.GetComponent<Animator>().Play(isBig ? "BigDoughJump" : "SmallDoughJump", 0, 0); } ),
|
|
|
|
new BeatAction.Action(beat, delegate { npcImpact.SetActive(true); } ),
|
|
|
|
new BeatAction.Action(beat + 0.1f, delegate { npcImpact.SetActive(false); }),
|
|
|
|
new BeatAction.Action(beat + 0.9f, delegate { arrowSRRightNPC.sprite = redArrowSprite; }),
|
|
|
|
new BeatAction.Action(beat + 1f, delegate { arrowSRRightNPC.sprite = whiteArrowSprite; }),
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
2023-06-10 19:17:06 +00:00
|
|
|
public static void PreSpawnBall(double beat, bool isBig)
|
2023-01-19 17:18:55 +00:00
|
|
|
{
|
2023-06-10 19:17:06 +00:00
|
|
|
double spawnBeat = beat - 1f;
|
2023-01-19 17:18:55 +00:00
|
|
|
beat -= 1f;
|
|
|
|
if (GameManager.instance.currentGame == "workingDough")
|
|
|
|
{
|
|
|
|
BeatAction.New(instance.gameObject, new List<BeatAction.Action>()
|
|
|
|
{
|
|
|
|
new BeatAction.Action(spawnBeat, delegate
|
|
|
|
{
|
2023-02-17 18:45:18 +00:00
|
|
|
if (!instance.ballTransporterLeftNPC.GetComponent<Animator>().IsPlayingAnimationName("BallTransporterLeftOpened") && !instance.intervalStarted && instance.ballTriggerSetInterval)
|
2023-01-19 17:18:55 +00:00
|
|
|
{
|
|
|
|
instance.ballTransporterLeftNPC.GetComponent<Animator>().Play("BallTransporterLeftOpen", 0, 0);
|
|
|
|
instance.ballTransporterRightNPC.GetComponent<Animator>().Play("BallTransporterRightOpen", 0, 0);
|
|
|
|
if (instance.gandwHasEntered) instance.gandwAnim.Play("GANDWLeverUp", 0, 0);
|
|
|
|
}
|
|
|
|
}),
|
|
|
|
new BeatAction.Action(spawnBeat, delegate { if (instance != null) instance.SpawnBall(beat, isBig); }),
|
2023-01-22 19:22:39 +00:00
|
|
|
// new BeatAction.Action(spawnBeat + instance.beatInterval, delegate { instance.SpawnPlayerBall(beat + instance.beatInterval, isBig); }),
|
2023-01-19 17:18:55 +00:00
|
|
|
});
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
queuedBalls.Add(new QueuedBall()
|
|
|
|
{
|
|
|
|
beat = beat + 1f,
|
|
|
|
isBig = isBig,
|
|
|
|
});
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2023-06-10 19:17:06 +00:00
|
|
|
public void OnSpawnBall(double beat, bool isBig)
|
2023-01-22 19:22:39 +00:00
|
|
|
{
|
|
|
|
beat -= 1f;
|
|
|
|
BeatAction.New(instance.gameObject, new List<BeatAction.Action>()
|
|
|
|
{
|
|
|
|
new BeatAction.Action(beat + beatInterval, delegate { instance.SpawnPlayerBall(beat + beatInterval, isBig); }),
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
2023-06-10 19:17:06 +00:00
|
|
|
public void OnSpawnBallInactive(double beat, bool isBig)
|
2023-01-22 19:22:39 +00:00
|
|
|
{
|
|
|
|
queuedBalls.Add(new QueuedBall()
|
|
|
|
{
|
|
|
|
beat = beat + 1f,
|
|
|
|
isBig = isBig,
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
2023-06-10 19:17:06 +00:00
|
|
|
public void SpawnPlayerBall(double beat, bool isBig)
|
2023-01-19 17:18:55 +00:00
|
|
|
{
|
|
|
|
var objectToSpawn = isBig ? playerEnterBigBall : playerEnterSmallBall;
|
|
|
|
var spawnedBall = GameObject.Instantiate(objectToSpawn, ballHolder);
|
|
|
|
|
|
|
|
var ballComponent = spawnedBall.GetComponent<PlayerEnterDoughBall>();
|
|
|
|
ballComponent.startBeat = beat;
|
|
|
|
ballComponent.firstCurve = playerEnterUpCurve;
|
|
|
|
ballComponent.secondCurve = playerEnterDownCurve;
|
|
|
|
ballComponent.deletingAutomatically = false;
|
|
|
|
currentBalls.Add(spawnedBall);
|
|
|
|
|
|
|
|
if (isBig && !bigModePlayer)
|
|
|
|
{
|
|
|
|
PlayerBallTransporters.GetComponent<Animator>().Play("PlayerGoBigMode", 0, 0);
|
|
|
|
bigModePlayer = true;
|
|
|
|
}
|
|
|
|
|
|
|
|
//shouldMiss = true;
|
|
|
|
if (isBig)
|
|
|
|
{
|
|
|
|
ScheduleInput(beat, 1, InputType.STANDARD_ALT_DOWN, JustBig, MissBig, Nothing);
|
|
|
|
ScheduleUserInput(beat, 1, InputType.STANDARD_DOWN, WrongInputBig, Nothing, Nothing);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
ScheduleInput(beat, 1, InputType.STANDARD_DOWN, JustSmall, MissSmall, Nothing);
|
|
|
|
ScheduleUserInput(beat, 1, InputType.STANDARD_ALT_DOWN, WrongInputSmall, Nothing, Nothing);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
BeatAction.New(doughDudesPlayer, new List<BeatAction.Action>()
|
|
|
|
{
|
|
|
|
new BeatAction.Action(beat, delegate { spawnedBall.SetActive(true); }),
|
|
|
|
new BeatAction.Action(beat, delegate { arrowSRLeftPlayer.sprite = redArrowSprite; }),
|
|
|
|
new BeatAction.Action(beat + 0.1f, delegate { arrowSRLeftPlayer.sprite = whiteArrowSprite; }),
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
2023-06-10 19:17:06 +00:00
|
|
|
public void SpawnPlayerBallResult(double beat, bool isBig, BezierCurve3D firstCurve, BezierCurve3D secondCurve, float firstBeatsToTravel, float secondBeatsToTravel)
|
2023-01-19 17:18:55 +00:00
|
|
|
{
|
|
|
|
var objectToSpawn = isBig ? playerEnterBigBall : playerEnterSmallBall;
|
|
|
|
var spawnedBall = GameObject.Instantiate(objectToSpawn, ballHolder);
|
|
|
|
|
|
|
|
var ballComponent = spawnedBall.GetComponent<PlayerEnterDoughBall>();
|
|
|
|
ballComponent.startBeat = beat;
|
|
|
|
ballComponent.firstCurve = firstCurve;
|
|
|
|
ballComponent.secondCurve = secondCurve;
|
|
|
|
ballComponent.firstBeatsToTravel = firstBeatsToTravel;
|
|
|
|
ballComponent.secondBeatsToTravel = secondBeatsToTravel;
|
|
|
|
|
|
|
|
spawnedBall.SetActive(true);
|
|
|
|
}
|
|
|
|
|
2023-06-10 19:17:06 +00:00
|
|
|
public static void PreSetIntervalStart(double beat, float interval)
|
2023-01-19 17:18:55 +00:00
|
|
|
{
|
|
|
|
beat -= 1f;
|
|
|
|
if (GameManager.instance.currentGame == "workingDough")
|
|
|
|
{
|
2023-01-22 19:22:39 +00:00
|
|
|
// instance.ballTriggerSetInterval = false;
|
|
|
|
// beatInterval = interval;
|
2023-01-19 17:18:55 +00:00
|
|
|
BeatAction.New(instance.gameObject, new List<BeatAction.Action>()
|
|
|
|
{
|
|
|
|
new BeatAction.Action(beat, delegate
|
|
|
|
{
|
2023-02-17 18:45:18 +00:00
|
|
|
if (!instance.ballTransporterLeftNPC.GetComponent<Animator>().IsPlayingAnimationName("BallTransporterLeftOpened"))
|
2023-01-19 17:18:55 +00:00
|
|
|
{
|
|
|
|
instance.ballTransporterLeftNPC.GetComponent<Animator>().Play("BallTransporterLeftOpen", 0, 0);
|
|
|
|
instance.ballTransporterRightNPC.GetComponent<Animator>().Play("BallTransporterRightOpen", 0, 0);
|
|
|
|
if (instance.gandwHasEntered) instance.gandwAnim.Play("GANDWLeverUp", 0, 0);
|
|
|
|
}
|
|
|
|
}),
|
2023-01-22 19:22:39 +00:00
|
|
|
// new BeatAction.Action(beat + 1, delegate { if (instance != null) instance.SetIntervalStart(beat + 1, interval); }),
|
2023-01-19 17:18:55 +00:00
|
|
|
});
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
queuedIntervals.Add(new QueuedInterval()
|
|
|
|
{
|
|
|
|
beat = beat + 1f,
|
|
|
|
interval = interval,
|
|
|
|
});
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2023-01-22 19:22:39 +00:00
|
|
|
void OnDestroy()
|
|
|
|
{
|
|
|
|
if (queuedIntervals.Count > 0) queuedIntervals.Clear();
|
|
|
|
if (queuedBalls.Count > 0) queuedBalls.Clear();
|
2023-06-03 23:30:17 +00:00
|
|
|
foreach (var evt in scheduledInputs)
|
|
|
|
{
|
|
|
|
evt.Disable();
|
|
|
|
}
|
2023-01-22 19:22:39 +00:00
|
|
|
}
|
|
|
|
|
2023-01-19 17:18:55 +00:00
|
|
|
void Update()
|
|
|
|
{
|
|
|
|
Conductor cond = Conductor.instance;
|
2023-01-22 19:22:39 +00:00
|
|
|
if (!cond.isPlaying || cond.isPaused)
|
|
|
|
{
|
|
|
|
if (queuedIntervals.Count > 0) queuedIntervals.Clear();
|
|
|
|
if (queuedBalls.Count > 0) queuedBalls.Clear();
|
|
|
|
}
|
|
|
|
|
2023-01-19 17:18:55 +00:00
|
|
|
if (spaceshipRising) spaceshipAnimator.DoScaledAnimation("RiseSpaceship", risingStartBeat, risingLength);
|
|
|
|
if (liftingDoughDudes) doughDudesHolderAnim.DoScaledAnimation(liftingAnimName, liftingStartBeat, liftingLength);
|
|
|
|
if (gandwMoving) gandwAnim.DoScaledAnimation(gandwMovingAnimName, gandMovingStartBeat, gandMovingLength);
|
|
|
|
if (queuedIntervals.Count > 0)
|
|
|
|
{
|
|
|
|
foreach (var interval in queuedIntervals)
|
|
|
|
{
|
|
|
|
ballTriggerSetInterval = false;
|
|
|
|
beatInterval = interval.interval;
|
|
|
|
ballTransporterLeftNPC.GetComponent<Animator>().Play("BallTransporterLeftOpened", 0, 0);
|
|
|
|
ballTransporterRightNPC.GetComponent<Animator>().Play("BallTransporterRightOpened", 0, 0);
|
|
|
|
if (gandwHasEntered) gandwAnim.Play("GANDWLeverUp", 0, 0);
|
|
|
|
BeatAction.New(instance.gameObject, new List<BeatAction.Action>()
|
|
|
|
{
|
|
|
|
new BeatAction.Action(interval.beat, delegate { SetIntervalStart(interval.beat, interval.interval); }),
|
|
|
|
});
|
|
|
|
|
|
|
|
}
|
|
|
|
queuedIntervals.Clear();
|
|
|
|
}
|
|
|
|
if (queuedBalls.Count > 0)
|
|
|
|
{
|
|
|
|
foreach (var ball in queuedBalls)
|
|
|
|
{
|
2023-06-10 19:17:06 +00:00
|
|
|
double offSet = ball.beat - cond.songPositionInBeatsAsDouble;
|
|
|
|
double spawnOffset = offSet > 1f ? offSet - 1 : 0;
|
2023-01-19 17:18:55 +00:00
|
|
|
if (ball.isBig) NPCBallTransporters.GetComponent<Animator>().Play("BigMode", 0, 0);
|
|
|
|
BeatAction.New(instance.gameObject, new List<BeatAction.Action>()
|
|
|
|
{
|
|
|
|
new BeatAction.Action(ball.beat - offSet + spawnOffset, delegate {
|
|
|
|
if (!intervalStarted && ballTriggerSetInterval)
|
|
|
|
{
|
|
|
|
ballTransporterLeftNPC.GetComponent<Animator>().Play("BallTransporterLeftOpened", 0, 0);
|
|
|
|
ballTransporterRightNPC.GetComponent<Animator>().Play("BallTransporterRightOpened", 0, 0);
|
|
|
|
if (gandwHasEntered) gandwAnim.Play("GANDWLeverUp", 0, 0);
|
|
|
|
SetIntervalStart(ball.beat, beatInterval);
|
|
|
|
}
|
|
|
|
}),
|
|
|
|
new BeatAction.Action(ball.beat - offSet + spawnOffset, delegate { InstantExitBall(ball.beat, ball.isBig, offSet); }),
|
|
|
|
new BeatAction.Action(ball.beat + beatInterval - 1, delegate { SpawnPlayerBall(ball.beat + beatInterval - 1, ball.isBig); }),
|
|
|
|
});
|
|
|
|
|
|
|
|
}
|
|
|
|
queuedBalls.Clear();
|
|
|
|
}
|
|
|
|
if (PlayerInput.Pressed() && !IsExpectingInputNow(InputType.STANDARD_DOWN))
|
|
|
|
{
|
|
|
|
doughDudesPlayer.GetComponent<Animator>().Play("SmallDoughJump", 0, 0);
|
2023-06-10 19:17:06 +00:00
|
|
|
SoundByte.PlayOneShotGame("workingDough/PlayerSmallJump");
|
2023-01-19 17:18:55 +00:00
|
|
|
}
|
|
|
|
else if (PlayerInput.AltPressed() && !IsExpectingInputNow(InputType.STANDARD_ALT_DOWN))
|
|
|
|
{
|
|
|
|
doughDudesPlayer.GetComponent<Animator>().Play("BigDoughJump", 0, 0);
|
2023-06-10 19:17:06 +00:00
|
|
|
SoundByte.PlayOneShotGame("workingDough/PlayerBigJump");
|
2023-01-19 17:18:55 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void WrongInputBig(PlayerActionEvent caller, float state)
|
|
|
|
{
|
2023-06-10 19:17:06 +00:00
|
|
|
double beat = caller.startBeat + caller.timer;
|
2023-01-19 17:18:55 +00:00
|
|
|
shouldMiss = false;
|
|
|
|
if (currentBalls.Count > 0)
|
|
|
|
{
|
|
|
|
GameObject currentBall = currentBalls[0];
|
|
|
|
currentBalls.Remove(currentBall);
|
|
|
|
GameObject.Destroy(currentBall);
|
|
|
|
}
|
|
|
|
doughDudesPlayer.GetComponent<Animator>().Play("SmallDoughJump", 0, 0);
|
2023-06-10 19:17:06 +00:00
|
|
|
SoundByte.PlayOneShotGame("workingDough/BigBallTooWeak");
|
2023-01-19 17:18:55 +00:00
|
|
|
SpawnPlayerBallResult(beat, true, playerWrongInputTooWeakFirstCurve, playerWrongInputTooWeakSecondCurve, 0.5f, 1f);
|
|
|
|
playerImpact.SetActive(true);
|
|
|
|
BeatAction.New(instance.gameObject, new List<BeatAction.Action>()
|
|
|
|
{
|
|
|
|
new BeatAction.Action(beat + 0.1f, delegate { playerImpact.SetActive(false); }),
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
|
|
|
void WrongInputSmall(PlayerActionEvent caller, float state)
|
|
|
|
{
|
2023-06-10 19:17:06 +00:00
|
|
|
double beat = caller.startBeat + caller.timer;
|
2023-01-19 17:18:55 +00:00
|
|
|
shouldMiss = false;
|
|
|
|
if (currentBalls.Count > 0)
|
|
|
|
{
|
|
|
|
GameObject currentBall = currentBalls[0];
|
|
|
|
currentBalls.Remove(currentBall);
|
|
|
|
GameObject.Destroy(currentBall);
|
|
|
|
}
|
|
|
|
GameObject.Instantiate(breakParticleEffect, breakParticleHolder);
|
|
|
|
doughDudesPlayer.GetComponent<Animator>().Play("BigDoughJump", 0, 0);
|
2023-06-10 19:17:06 +00:00
|
|
|
SoundByte.PlayOneShotGame("workingDough/BreakBall");
|
2023-01-19 17:18:55 +00:00
|
|
|
playerImpact.SetActive(true);
|
|
|
|
BeatAction.New(instance.gameObject, new List<BeatAction.Action>()
|
|
|
|
{
|
|
|
|
new BeatAction.Action(beat + 0.1f, delegate { playerImpact.SetActive(false); }),
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
|
|
|
void MissBig(PlayerActionEvent caller)
|
|
|
|
{
|
|
|
|
if (!shouldMiss)
|
|
|
|
{
|
|
|
|
shouldMiss = true;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
if (currentBalls.Count > 0)
|
|
|
|
{
|
|
|
|
GameObject currentBall = currentBalls[0];
|
|
|
|
currentBalls.Remove(currentBall);
|
|
|
|
GameObject.Destroy(currentBall);
|
|
|
|
}
|
|
|
|
|
2023-06-10 19:17:06 +00:00
|
|
|
double beat = caller.startBeat + caller.timer;
|
2023-01-19 17:18:55 +00:00
|
|
|
SpawnPlayerBallResult(beat, true, playerMissCurveFirst, playerMissCurveSecond, 0.25f, 0.75f);
|
|
|
|
BeatAction.New(instance.gameObject, new List<BeatAction.Action>()
|
|
|
|
{
|
|
|
|
new BeatAction.Action(beat + 0.25f, delegate { missImpact.SetActive(true); }),
|
2023-06-10 19:17:06 +00:00
|
|
|
new BeatAction.Action(beat + 0.25f, delegate { SoundByte.PlayOneShotGame("workingDough/BallMiss"); }),
|
2023-01-19 17:18:55 +00:00
|
|
|
new BeatAction.Action(beat + 0.35f, delegate { missImpact.SetActive(false); }),
|
|
|
|
});
|
|
|
|
}
|
|
|
|
void MissSmall(PlayerActionEvent caller)
|
|
|
|
{
|
|
|
|
if (!shouldMiss)
|
|
|
|
{
|
|
|
|
shouldMiss = true;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (currentBalls.Count > 0)
|
|
|
|
{
|
|
|
|
GameObject currentBall = currentBalls[0];
|
|
|
|
currentBalls.Remove(currentBall);
|
|
|
|
GameObject.Destroy(currentBall);
|
|
|
|
}
|
2023-06-10 19:17:06 +00:00
|
|
|
double beat = caller.startBeat + caller.timer;
|
2023-01-19 17:18:55 +00:00
|
|
|
SpawnPlayerBallResult(beat, false, playerMissCurveFirst, playerMissCurveSecond, 0.25f, 0.75f);
|
|
|
|
BeatAction.New(instance.gameObject, new List<BeatAction.Action>()
|
|
|
|
{
|
|
|
|
new BeatAction.Action(beat + 0.25f, delegate { missImpact.SetActive(true); }),
|
2023-06-10 19:17:06 +00:00
|
|
|
new BeatAction.Action(beat + 0.25f, delegate { SoundByte.PlayOneShotGame("workingDough/BallMiss"); }),
|
2023-01-19 17:18:55 +00:00
|
|
|
new BeatAction.Action(beat + 0.35f, delegate { missImpact.SetActive(false); }),
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
|
|
|
void JustSmall(PlayerActionEvent caller, float state)
|
|
|
|
{
|
2023-02-15 21:40:20 +00:00
|
|
|
if (GameManager.instance.currentGame != "workingDough") return;
|
2023-06-10 19:17:06 +00:00
|
|
|
double beat = caller.startBeat + caller.timer;
|
2023-01-19 17:18:55 +00:00
|
|
|
if (currentBalls.Count > 0)
|
|
|
|
{
|
|
|
|
GameObject currentBall = currentBalls[0];
|
|
|
|
currentBalls.Remove(currentBall);
|
|
|
|
GameObject.Destroy(currentBall);
|
|
|
|
}
|
|
|
|
if (state >= 1f || state <= -1f)
|
|
|
|
{
|
2023-06-10 19:17:06 +00:00
|
|
|
SoundByte.PlayOneShotGame("workingDough/SmallBarely");
|
2023-01-19 17:18:55 +00:00
|
|
|
doughDudesPlayer.GetComponent<Animator>().Play("SmallDoughJump", 0, 0);
|
|
|
|
|
|
|
|
playerImpact.SetActive(true);
|
|
|
|
SpawnPlayerBallResult(beat, false, playerBarelyCurveFirst, playerBarelyCurveSecond, 0.75f, 1f);
|
|
|
|
BeatAction.New(instance.gameObject, new List<BeatAction.Action>()
|
|
|
|
{
|
|
|
|
new BeatAction.Action(beat + 0.1f, delegate { playerImpact.SetActive(false); }),
|
|
|
|
});
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
Success(false, beat);
|
|
|
|
}
|
|
|
|
|
|
|
|
void JustBig(PlayerActionEvent caller, float state)
|
|
|
|
{
|
2023-02-15 21:40:20 +00:00
|
|
|
if (GameManager.instance.currentGame != "workingDough") return;
|
2023-06-10 19:17:06 +00:00
|
|
|
double beat = caller.startBeat + caller.timer;
|
2023-01-19 17:18:55 +00:00
|
|
|
if (currentBalls.Count > 0)
|
|
|
|
{
|
|
|
|
GameObject currentBall = currentBalls[0];
|
|
|
|
currentBalls.Remove(currentBall);
|
|
|
|
GameObject.Destroy(currentBall);
|
|
|
|
}
|
|
|
|
if (state >= 1f || state <= -1f)
|
|
|
|
{
|
2023-06-10 19:17:06 +00:00
|
|
|
SoundByte.PlayOneShotGame("workingDough/BigBarely");
|
2023-01-19 17:18:55 +00:00
|
|
|
doughDudesPlayer.GetComponent<Animator>().Play("BigDoughJump", 0, 0);
|
|
|
|
|
|
|
|
playerImpact.SetActive(true);
|
|
|
|
SpawnPlayerBallResult(beat, true, playerBarelyCurveFirst, playerBarelyCurveSecond, 0.75f, 1f);
|
|
|
|
BeatAction.New(instance.gameObject, new List<BeatAction.Action>()
|
|
|
|
{
|
|
|
|
new BeatAction.Action(beat + 0.1f, delegate { playerImpact.SetActive(false); }),
|
|
|
|
});
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
Success(true, beat);
|
|
|
|
}
|
|
|
|
|
2023-06-10 19:17:06 +00:00
|
|
|
void Success(bool isBig, double beat)
|
2023-01-19 17:18:55 +00:00
|
|
|
{
|
|
|
|
if (isBig)
|
|
|
|
{
|
2023-06-10 19:17:06 +00:00
|
|
|
SoundByte.PlayOneShotGame("workingDough/rightBig");
|
2023-01-19 17:18:55 +00:00
|
|
|
doughDudesPlayer.GetComponent<Animator>().Play("BigDoughJump", 0, 0);
|
|
|
|
backgroundAnimator.Play("BackgroundFlash", 0, 0);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2023-06-10 19:17:06 +00:00
|
|
|
SoundByte.PlayOneShotGame("workingDough/rightSmall");
|
2023-01-19 17:18:55 +00:00
|
|
|
doughDudesPlayer.GetComponent<Animator>().Play("SmallDoughJump", 0, 0);
|
|
|
|
}
|
|
|
|
playerImpact.SetActive(true);
|
|
|
|
SpawnPlayerBallResult(beat, isBig, playerExitUpCurve, playerExitDownCurve, 0.5f, 0.5f);
|
|
|
|
BeatAction.New(instance.gameObject, new List<BeatAction.Action>()
|
|
|
|
{
|
|
|
|
new BeatAction.Action(beat + 0.1f, delegate { playerImpact.SetActive(false); }),
|
|
|
|
new BeatAction.Action(beat + 0.9f, delegate { arrowSRRightPlayer.sprite = redArrowSprite; }),
|
|
|
|
new BeatAction.Action(beat + 1f, delegate { arrowSRRightPlayer.sprite = whiteArrowSprite; }),
|
|
|
|
new BeatAction.Action(beat + 2f, delegate { SpawnBGBall(beat + 2f, isBig); }),
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
2023-06-10 19:17:06 +00:00
|
|
|
void SpawnBGBall(double beat, bool isBig)
|
2023-01-19 17:18:55 +00:00
|
|
|
{
|
|
|
|
var objectToSpawn = isBig ? bigBGBall : smallBGBall;
|
|
|
|
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);
|
|
|
|
BeatAction.New(instance.gameObject, new List<BeatAction.Action>()
|
|
|
|
{
|
|
|
|
new BeatAction.Action(beat + 9f, delegate { if (!spaceshipRisen) spaceshipAnimator.Play("AbsorbBall", 0, 0); }),
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
|
|
|
public void InstantElevation(bool isUp)
|
|
|
|
{
|
|
|
|
doughDudesHolderAnim.Play(isUp ? "InAir" : "OnGround", 0, 0);
|
|
|
|
}
|
|
|
|
|
2023-06-10 19:17:06 +00:00
|
|
|
public void Elevate(double beat, float length, bool isUp)
|
2023-01-19 17:18:55 +00:00
|
|
|
{
|
|
|
|
liftingAnimName = isUp ? "LiftUp" : "LiftDown";
|
|
|
|
liftingStartBeat = beat;
|
|
|
|
liftingLength = length;
|
|
|
|
liftingDoughDudes = true;
|
|
|
|
doughDudesHolderAnim.DoScaledAnimation(liftingAnimName, liftingStartBeat, liftingLength);
|
|
|
|
BeatAction.New(instance.gameObject, new List<BeatAction.Action>()
|
|
|
|
{
|
|
|
|
new BeatAction.Action(beat + length - 0.1f, delegate { liftingDoughDudes = false; }),
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
2023-06-10 19:17:06 +00:00
|
|
|
public void LaunchShip(double beat, float length)
|
2023-01-19 17:18:55 +00:00
|
|
|
{
|
|
|
|
spaceshipRisen = true;
|
|
|
|
if (!spaceshipLights.activeSelf)
|
|
|
|
{
|
|
|
|
spaceshipLights.SetActive(true);
|
|
|
|
spaceshipLights.GetComponent<Animator>().Play("SpaceshipLights", 0, 0);
|
|
|
|
}
|
|
|
|
spaceshipAnimator.Play("SpaceshipShake", 0, 0);
|
|
|
|
BeatAction.New(instance.gameObject, new List<BeatAction.Action>()
|
|
|
|
{
|
|
|
|
new BeatAction.Action(beat + length, delegate { spaceshipAnimator.Play("SpaceshipLaunch", 0, 0); }),
|
2023-06-10 19:17:06 +00:00
|
|
|
new BeatAction.Action(beat + length, delegate { SoundByte.PlayOneShotGame("workingDough/LaunchRobot"); }),
|
|
|
|
new BeatAction.Action(beat + length, delegate { SoundByte.PlayOneShotGame("workingDough/Rocket"); }),
|
2023-01-19 17:18:55 +00:00
|
|
|
});
|
|
|
|
}
|
|
|
|
|
2023-06-10 19:17:06 +00:00
|
|
|
public void RiseUpShip(double beat, float length)
|
2023-01-19 17:18:55 +00:00
|
|
|
{
|
|
|
|
spaceshipRisen = true;
|
|
|
|
spaceshipRising = true;
|
|
|
|
risingLength = length;
|
|
|
|
risingStartBeat = beat;
|
|
|
|
if (!spaceshipLights.activeSelf)
|
|
|
|
{
|
|
|
|
spaceshipLights.SetActive(true);
|
|
|
|
spaceshipLights.GetComponent<Animator>().Play("SpaceshipLights", 0, 0);
|
|
|
|
}
|
|
|
|
spaceshipAnimator.DoScaledAnimation("RiseSpaceship", risingStartBeat, risingLength);
|
|
|
|
BeatAction.New(instance.gameObject, new List<BeatAction.Action>()
|
|
|
|
{
|
|
|
|
new BeatAction.Action(beat + length - 0.1f, delegate { spaceshipRising = false; }),
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
2023-06-10 19:17:06 +00:00
|
|
|
public void GANDWEnterOrExit(double beat, float length, bool shouldExit)
|
2023-01-19 17:18:55 +00:00
|
|
|
{
|
|
|
|
gandwMoving = true;
|
|
|
|
gandwHasEntered = false;
|
|
|
|
gandMovingLength = length;
|
|
|
|
gandMovingStartBeat = beat;
|
|
|
|
gandwMovingAnimName = shouldExit ? "GANDWLeave" : "GANDWEnter";
|
|
|
|
gandwAnim.DoScaledAnimation(gandwMovingAnimName, gandMovingStartBeat, gandMovingLength);
|
|
|
|
BeatAction.New(instance.gameObject, new List<BeatAction.Action>()
|
|
|
|
{
|
|
|
|
new BeatAction.Action(beat + length - 0.1f, delegate { gandwMoving = false; }),
|
|
|
|
new BeatAction.Action(beat + length, delegate { gandwHasEntered = shouldExit ? false : true; }),
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
|
|
|
public void InstantGANDWEnterOrExit(bool shouldExit)
|
|
|
|
{
|
|
|
|
gandwAnim.Play(shouldExit ? "GANDWLeft" : "MrGameAndWatchLeverDown", 0, 0);
|
|
|
|
gandwHasEntered = shouldExit ? false : true;
|
|
|
|
}
|
|
|
|
|
|
|
|
void Nothing (PlayerActionEvent caller) {}
|
|
|
|
}
|
|
|
|
}
|