2022-02-28 08:33:11 +00:00
|
|
|
using DG.Tweening;
|
2022-03-08 04:46:49 +00:00
|
|
|
using NaughtyBezierCurves;
|
2022-03-14 14:21:05 +00:00
|
|
|
using HeavenStudio.Util;
|
2022-03-08 04:46:49 +00:00
|
|
|
using System;
|
|
|
|
using System.Collections.Generic;
|
|
|
|
using UnityEngine;
|
2023-06-10 19:13:29 +00:00
|
|
|
using Jukebox;
|
2022-02-27 23:26:03 +00:00
|
|
|
|
2022-04-12 16:14:46 +00:00
|
|
|
namespace HeavenStudio.Games.Loaders
|
|
|
|
{
|
|
|
|
using static Minigames;
|
|
|
|
public static class NtrCropLoader
|
|
|
|
{
|
|
|
|
public static Minigame AddGame(EventCaller eventCaller) {
|
2023-04-02 02:28:23 +00:00
|
|
|
return new Minigame("cropStomp", "Crop Stomp", "c0f0b8", false, false, new List<GameAction>()
|
2022-04-12 16:14:46 +00:00
|
|
|
{
|
2022-08-21 03:13:52 +00:00
|
|
|
new GameAction("start marching", "Start Marching")
|
|
|
|
{
|
|
|
|
function = delegate { CropStomp.instance.StartMarching(eventCaller.currentEntity.beat); },
|
|
|
|
defaultLength = 2f,
|
|
|
|
inactiveFunction = delegate { CropStomp.MarchInactive(eventCaller.currentEntity.beat); }
|
|
|
|
},
|
|
|
|
new GameAction("veggies", "Veggies")
|
|
|
|
{
|
|
|
|
defaultLength = 4f,
|
|
|
|
resizable = true
|
|
|
|
},
|
|
|
|
new GameAction("mole", "Mole")
|
|
|
|
{
|
2023-04-23 20:17:21 +00:00
|
|
|
defaultLength = 2f,
|
|
|
|
parameters = new List<Param>()
|
|
|
|
{
|
|
|
|
new Param("mute", false, "Mute", "Should the mole laugh sound be muted?")
|
|
|
|
}
|
2022-08-21 03:13:52 +00:00
|
|
|
},
|
2023-06-06 18:59:56 +00:00
|
|
|
new GameAction("plantCollect", "Veggie Collection Values")
|
|
|
|
{
|
|
|
|
function = delegate { var e = eventCaller.currentEntity; CropStomp.instance.SetCollectThresholds(e["threshold"], e["limit"]); },
|
|
|
|
defaultLength = 0.5f,
|
|
|
|
parameters = new List<Param>()
|
|
|
|
{
|
|
|
|
new Param("threshold", new EntityTypes.Integer(1, 80, 8), "Threshold", "For each time the threshold is met a new plant will appear in the veggie bag."),
|
|
|
|
new Param("limit", new EntityTypes.Integer(1, 1000, 80), "Limit", "What is the limit for plants collected?")
|
|
|
|
}
|
|
|
|
}
|
2023-05-28 17:34:44 +00:00
|
|
|
},
|
|
|
|
new List<string>() {"ntr", "keep"},
|
|
|
|
"ntrstomp", "en",
|
|
|
|
new List<string>() {}
|
|
|
|
);
|
2022-04-12 16:14:46 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2022-03-14 14:21:05 +00:00
|
|
|
namespace HeavenStudio.Games
|
2022-02-27 23:26:03 +00:00
|
|
|
{
|
2022-03-12 04:10:13 +00:00
|
|
|
using Scripts_CropStomp;
|
|
|
|
|
2022-02-27 23:26:03 +00:00
|
|
|
public class CropStomp : Minigame
|
|
|
|
{
|
2022-02-28 05:11:18 +00:00
|
|
|
const float stepDistance = 2.115f;
|
2022-03-03 10:43:01 +00:00
|
|
|
public static float[] moleSoundOffsets = new float[]{ 0.134f, 0.05f, 0.061f };
|
2022-02-28 05:11:18 +00:00
|
|
|
|
2022-03-22 18:29:15 +00:00
|
|
|
float scrollRate => stepDistance / (Conductor.instance.pitchedSecPerBeat * 2f);
|
2022-02-28 05:11:18 +00:00
|
|
|
float grassWidth;
|
2022-03-03 11:18:16 +00:00
|
|
|
float dotsWidth = 19.2f;
|
2022-02-28 05:11:18 +00:00
|
|
|
|
2023-06-10 19:13:29 +00:00
|
|
|
private double newBeat = -1f; // So that marching can happen on beat 0.
|
|
|
|
private double marchStartBeat = -1f;
|
|
|
|
private double marchOffset;
|
2022-02-28 05:11:18 +00:00
|
|
|
private int currentMarchBeat;
|
|
|
|
private int stepCount;
|
2022-02-28 08:33:11 +00:00
|
|
|
private bool isStepping;
|
2022-03-13 10:25:41 +00:00
|
|
|
|
2023-06-10 19:13:29 +00:00
|
|
|
private static double inactiveStart = -1f;
|
2022-02-28 05:11:18 +00:00
|
|
|
|
2022-03-03 10:43:01 +00:00
|
|
|
public bool isMarching => marchStartBeat != -1f;
|
2022-02-28 05:11:18 +00:00
|
|
|
|
2022-03-01 06:38:38 +00:00
|
|
|
[NonSerialized] public bool isFlicking;
|
|
|
|
|
|
|
|
public GameObject baseVeggie;
|
2022-03-03 02:50:08 +00:00
|
|
|
public GameObject baseMole;
|
2022-02-28 05:11:18 +00:00
|
|
|
public Animator legsAnim;
|
2022-03-01 06:38:38 +00:00
|
|
|
public Animator bodyAnim;
|
2022-02-28 05:11:18 +00:00
|
|
|
public Transform farmerTrans;
|
|
|
|
public SpriteRenderer grass;
|
|
|
|
public Transform grassTrans;
|
2022-03-03 11:18:16 +00:00
|
|
|
public Transform dotsTrans;
|
2022-02-28 05:11:18 +00:00
|
|
|
public Transform scrollingHolder;
|
2022-03-01 06:38:38 +00:00
|
|
|
public Transform veggieHolder;
|
2022-02-28 08:33:11 +00:00
|
|
|
public Farmer farmer;
|
2022-03-01 20:57:37 +00:00
|
|
|
public BezierCurve3D pickCurve;
|
2022-03-03 02:50:08 +00:00
|
|
|
public BezierCurve3D moleCurve;
|
2022-02-28 08:33:11 +00:00
|
|
|
|
|
|
|
private Tween shakeTween;
|
2022-02-28 05:11:18 +00:00
|
|
|
|
2023-06-06 18:59:56 +00:00
|
|
|
public ParticleSystem hitParticle;
|
|
|
|
|
2022-02-28 05:11:18 +00:00
|
|
|
public static CropStomp instance;
|
|
|
|
|
|
|
|
private void Awake()
|
|
|
|
{
|
2022-03-26 02:08:46 +00:00
|
|
|
instance = this;// Finding grass sprite width for grass scrolling.
|
2022-03-27 00:42:50 +00:00
|
|
|
farmer.Init();
|
2022-02-28 05:11:18 +00:00
|
|
|
var grassSprite = grass.sprite;
|
|
|
|
var borderLeft = grassSprite.rect.xMin + grassSprite.border.x;
|
|
|
|
var borderRight = grassSprite.rect.xMax - grassSprite.border.z;
|
|
|
|
var borderWidthPixels = borderRight - borderLeft;
|
|
|
|
grassWidth = borderWidthPixels / grassSprite.pixelsPerUnit;
|
2022-03-01 06:38:38 +00:00
|
|
|
|
2022-03-16 09:53:30 +00:00
|
|
|
legsAnim.Play("LiftFront", 0, 1); // Start with leg up.
|
|
|
|
|
2022-03-01 06:38:38 +00:00
|
|
|
// Initialize vegetables.
|
|
|
|
var cond = Conductor.instance;
|
2023-06-10 19:13:29 +00:00
|
|
|
var entities = GameManager.instance.Beatmap.Entities;
|
2022-03-01 06:38:38 +00:00
|
|
|
|
2023-06-10 19:13:29 +00:00
|
|
|
double startBeat = cond.songPositionInBeatsAsDouble;
|
|
|
|
double endBeat = double.MaxValue;
|
2022-03-01 06:38:38 +00:00
|
|
|
|
2022-03-13 10:25:41 +00:00
|
|
|
if (inactiveStart == -1f)
|
2022-03-01 06:38:38 +00:00
|
|
|
{
|
2022-03-13 10:25:41 +00:00
|
|
|
// Find the beat of the closest "start marching" event.
|
|
|
|
var marchStarts = entities.FindAll(m => m.datamodel == "cropStomp/start marching");
|
|
|
|
for (int i = 0; i < marchStarts.Count; i++)
|
2022-03-01 06:38:38 +00:00
|
|
|
{
|
2022-03-13 10:25:41 +00:00
|
|
|
var sampleBeat = marchStarts[i].beat;
|
2023-06-10 19:13:29 +00:00
|
|
|
if (cond.songPositionInBeatsAsDouble <= sampleBeat + 0.25f) // 0.25-beat buffer in case the start marching event is directly next to the game switch event.
|
2022-03-13 10:25:41 +00:00
|
|
|
{
|
|
|
|
startBeat = sampleBeat;
|
|
|
|
break;
|
|
|
|
}
|
2022-03-01 06:38:38 +00:00
|
|
|
}
|
|
|
|
}
|
2022-03-13 10:25:41 +00:00
|
|
|
else
|
|
|
|
{
|
|
|
|
// Find the beat of the next step, assuming marching started at inactiveStart.
|
|
|
|
int stepsPassed = 0;
|
|
|
|
|
2023-06-10 19:13:29 +00:00
|
|
|
while (inactiveStart + (stepsPassed * 2f) < cond.songPositionInBeatsAsDouble)
|
2022-03-13 10:25:41 +00:00
|
|
|
{
|
|
|
|
stepsPassed++;
|
|
|
|
|
|
|
|
if (stepsPassed > 1000)
|
|
|
|
{
|
|
|
|
Debug.Log("Loop broke!");
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
startBeat = inactiveStart + (stepsPassed * 2f);
|
|
|
|
|
|
|
|
// Cue the marching proper to begin when applicable.
|
|
|
|
BeatAction.New(gameObject, new List<BeatAction.Action>()
|
|
|
|
{
|
2023-01-15 04:33:37 +00:00
|
|
|
new BeatAction.Action(startBeat - 0.25f, delegate { StartMarching(startBeat); })
|
2022-03-13 10:25:41 +00:00
|
|
|
});
|
|
|
|
|
|
|
|
inactiveStart = -1f;
|
|
|
|
}
|
2022-03-01 06:38:38 +00:00
|
|
|
|
2023-01-16 03:05:25 +00:00
|
|
|
// find out when the next game switch (or remix end) happens
|
|
|
|
var allEnds = EventCaller.GetAllInGameManagerList("gameManager", new string[] { "switchGame", "end" });
|
2023-06-11 16:12:25 +00:00
|
|
|
if (allEnds.Count == 0)
|
|
|
|
{
|
|
|
|
endBeat = double.MaxValue;
|
|
|
|
}
|
|
|
|
else
|
2023-01-16 03:05:25 +00:00
|
|
|
{
|
2023-06-11 16:12:25 +00:00
|
|
|
allEnds.Sort((x, y) => x.beat.CompareTo(y.beat));
|
|
|
|
|
|
|
|
//get the beat of the closest end event
|
|
|
|
foreach (var end in allEnds)
|
2023-01-16 03:05:25 +00:00
|
|
|
{
|
2023-06-11 16:12:25 +00:00
|
|
|
if (end.datamodel.Split(2) == "cropStomp") continue;
|
|
|
|
if (end.beat > startBeat)
|
|
|
|
{
|
|
|
|
endBeat = end.beat;
|
|
|
|
break;
|
|
|
|
}
|
2023-01-16 03:05:25 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2022-03-03 02:50:08 +00:00
|
|
|
// Veggie and mole events.
|
2022-03-01 06:38:38 +00:00
|
|
|
var vegEvents = entities.FindAll(v => v.datamodel == "cropStomp/veggies");
|
2022-03-03 02:50:08 +00:00
|
|
|
var moleEvents = entities.FindAll(m => m.datamodel == "cropStomp/mole");
|
2022-03-01 06:38:38 +00:00
|
|
|
|
2022-03-03 02:50:08 +00:00
|
|
|
// Spawn veggies.
|
2022-03-01 06:38:38 +00:00
|
|
|
for (int i = 0; i < vegEvents.Count; i++)
|
|
|
|
{
|
|
|
|
var vegBeat = vegEvents[i].beat;
|
|
|
|
var vegLength = vegEvents[i].length;
|
|
|
|
|
|
|
|
// Only consider veggie events that aren't past the start point.
|
2022-03-13 10:25:41 +00:00
|
|
|
if (startBeat <= vegBeat + vegLength)
|
2022-03-01 06:38:38 +00:00
|
|
|
{
|
|
|
|
int veggiesInEvent = Mathf.CeilToInt(vegLength + 1) / 2;
|
|
|
|
|
|
|
|
for (int b = 0; b < veggiesInEvent; b++)
|
|
|
|
{
|
|
|
|
var targetVeggieBeat = vegBeat + 2f * b;
|
2023-01-16 03:05:25 +00:00
|
|
|
if (startBeat <= targetVeggieBeat && targetVeggieBeat < endBeat)
|
2022-03-01 06:38:38 +00:00
|
|
|
{
|
2022-03-03 02:50:08 +00:00
|
|
|
SpawnVeggie(targetVeggieBeat, startBeat, false);
|
2022-03-01 06:38:38 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2022-03-03 02:50:08 +00:00
|
|
|
|
|
|
|
// Spawn moles.
|
|
|
|
for (int i = 0; i < moleEvents.Count; i++)
|
|
|
|
{
|
|
|
|
var moleBeat = moleEvents[i].beat;
|
|
|
|
|
2023-01-16 03:05:25 +00:00
|
|
|
if (startBeat <= moleBeat && moleBeat < endBeat)
|
2022-03-03 02:50:08 +00:00
|
|
|
{
|
|
|
|
SpawnVeggie(moleBeat, startBeat, true);
|
|
|
|
}
|
|
|
|
}
|
2022-02-28 05:11:18 +00:00
|
|
|
}
|
|
|
|
|
2023-06-10 19:13:29 +00:00
|
|
|
List<RiqEntity> cuedMoleSounds = new List<RiqEntity>();
|
2022-02-28 05:11:18 +00:00
|
|
|
private void Update()
|
2022-02-27 23:26:03 +00:00
|
|
|
{
|
2022-03-03 10:43:01 +00:00
|
|
|
var cond = Conductor.instance;
|
|
|
|
|
|
|
|
if (!cond.isPlaying)
|
2022-02-28 05:11:18 +00:00
|
|
|
return;
|
|
|
|
|
2022-03-03 10:43:01 +00:00
|
|
|
// Mole sounds.
|
2023-06-10 19:13:29 +00:00
|
|
|
var moleEvents = GameManager.instance.Beatmap.Entities.FindAll(m => m.datamodel == "cropStomp/mole");
|
2022-03-03 10:43:01 +00:00
|
|
|
for (int i = 0; i < moleEvents.Count; i++)
|
|
|
|
{
|
|
|
|
var moleEvent = moleEvents[i];
|
2023-04-23 20:17:21 +00:00
|
|
|
if (moleEvent["mute"]) continue;
|
2023-06-10 19:13:29 +00:00
|
|
|
var timeToEvent = moleEvent.beat - cond.songPositionInBeatsAsDouble;
|
2022-03-13 10:25:41 +00:00
|
|
|
if (timeToEvent <= 4f && timeToEvent > 2f && !cuedMoleSounds.Contains(moleEvent))
|
2022-03-03 10:43:01 +00:00
|
|
|
{
|
|
|
|
cuedMoleSounds.Add(moleEvent);
|
|
|
|
MultiSound.Play(new MultiSound.Sound[] { new MultiSound.Sound("cropStomp/moleNyeh", (moleEvent.beat - 2f) - moleSoundOffsets[0] * Conductor.instance.songBpm / 60f),
|
|
|
|
new MultiSound.Sound("cropStomp/moleHeh1", (moleEvent.beat - 1.5f) - moleSoundOffsets[1] * Conductor.instance.songBpm / 60f),
|
|
|
|
new MultiSound.Sound("cropStomp/moleHeh2", (moleEvent.beat - 1f) - moleSoundOffsets[2] * Conductor.instance.songBpm / 60f) });
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!isMarching)
|
|
|
|
return;
|
2022-03-11 10:52:11 +00:00
|
|
|
// Debug.Log(newBeat);
|
2022-02-28 05:11:18 +00:00
|
|
|
|
|
|
|
if (cond.ReportBeat(ref newBeat, marchOffset, true))
|
|
|
|
{
|
|
|
|
currentMarchBeat += 1;
|
|
|
|
|
2022-03-08 04:46:49 +00:00
|
|
|
PlayAnims();
|
|
|
|
if (currentMarchBeat % 2 != 0) //step sound
|
2022-02-28 05:11:18 +00:00
|
|
|
{
|
2023-01-15 04:33:37 +00:00
|
|
|
MultiSound.Play(new MultiSound.Sound[] {new MultiSound.Sound("cropStomp/hmm", newBeat + marchOffset)});
|
2022-02-28 05:11:18 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// Object scroll.
|
|
|
|
var scrollPos = scrollingHolder.localPosition;
|
|
|
|
var newScrollX = scrollPos.x + (scrollRate * Time.deltaTime);
|
|
|
|
scrollingHolder.localPosition = new Vector3(newScrollX, scrollPos.y, scrollPos.z);
|
|
|
|
|
|
|
|
// Grass scroll.
|
|
|
|
var grassPos = grassTrans.localPosition;
|
|
|
|
|
|
|
|
var newGrassX = grassPos.x + (scrollRate * Time.deltaTime);
|
|
|
|
newGrassX = (newGrassX % (grassWidth * 4.5f));
|
|
|
|
|
|
|
|
grassTrans.localPosition = new Vector3(newGrassX, grassPos.y, grassPos.z);
|
2022-03-03 11:18:16 +00:00
|
|
|
|
|
|
|
// Dots scroll
|
|
|
|
var dotsPos = dotsTrans.localPosition;
|
|
|
|
|
|
|
|
var newDotsX = dotsPos.x + (scrollRate * Time.deltaTime);
|
|
|
|
newDotsX = (newDotsX % dotsWidth);
|
|
|
|
|
|
|
|
dotsTrans.localPosition = new Vector3(newDotsX, dotsPos.y, dotsPos.z);
|
2022-02-27 23:26:03 +00:00
|
|
|
}
|
|
|
|
|
2022-03-01 06:38:38 +00:00
|
|
|
private void LateUpdate()
|
|
|
|
{
|
|
|
|
if (!isMarching)
|
|
|
|
return;
|
|
|
|
|
|
|
|
if (PlayerInput.PressedUp())
|
|
|
|
{
|
|
|
|
// Don't play raise animation if successfully flicked.
|
|
|
|
if (!isFlicking)
|
|
|
|
bodyAnim.Play("Raise");
|
|
|
|
}
|
|
|
|
|
|
|
|
isFlicking = false;
|
|
|
|
}
|
|
|
|
|
2023-06-06 18:59:56 +00:00
|
|
|
public void SetCollectThresholds(int thresholdEvolve, int limit)
|
|
|
|
{
|
|
|
|
farmer.plantThreshold = thresholdEvolve;
|
|
|
|
farmer.plantLimit = limit;
|
|
|
|
farmer.UpdatePlants();
|
|
|
|
}
|
|
|
|
|
|
|
|
public void CollectPlant()
|
|
|
|
{
|
|
|
|
farmer.CollectPlant();
|
|
|
|
}
|
|
|
|
|
2022-03-08 04:46:49 +00:00
|
|
|
private void PlayAnims()
|
|
|
|
{
|
|
|
|
// Step.
|
|
|
|
if (currentMarchBeat % 2 != 0)
|
|
|
|
{
|
|
|
|
// Don't step if already stomped.
|
|
|
|
if (!isStepping)
|
|
|
|
{
|
|
|
|
stepCount += 1;
|
|
|
|
var stepAnim = (stepCount % 2 != 0 ? "StepFront" : "StepBack");
|
|
|
|
|
|
|
|
legsAnim.Play(stepAnim, 0, 0);
|
|
|
|
|
|
|
|
isStepping = true;
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
// Lift.
|
|
|
|
else
|
|
|
|
{
|
|
|
|
var liftAnim = (stepCount % 2 != 0 ? "LiftBack" : "LiftFront");
|
|
|
|
legsAnim.Play(liftAnim, 0, 0);
|
|
|
|
|
|
|
|
var farmerPos = farmerTrans.localPosition;
|
|
|
|
farmerTrans.localPosition = new Vector3(farmerPos.x - stepDistance, farmerPos.y, farmerPos.z);
|
|
|
|
|
|
|
|
isStepping = false;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2023-06-10 19:13:29 +00:00
|
|
|
public void StartMarching(double beat)
|
2022-02-27 23:26:03 +00:00
|
|
|
{
|
2022-02-28 05:11:18 +00:00
|
|
|
marchStartBeat = beat;
|
2022-06-09 03:35:15 +00:00
|
|
|
marchOffset = marchStartBeat % 1;
|
2022-02-28 05:11:18 +00:00
|
|
|
currentMarchBeat = 0;
|
|
|
|
stepCount = 0;
|
2022-02-28 08:33:11 +00:00
|
|
|
|
|
|
|
farmer.nextStompBeat = beat;
|
|
|
|
}
|
|
|
|
|
|
|
|
public void Stomp()
|
|
|
|
{
|
|
|
|
// Don't increment step counter if autostep stepped already.
|
|
|
|
if (!isStepping)
|
|
|
|
stepCount += 1;
|
|
|
|
|
|
|
|
var stompAnim = (stepCount % 2 != 0 ? "StompFront" : "StompBack");
|
|
|
|
|
|
|
|
legsAnim.Play(stompAnim, 0, 0);
|
|
|
|
|
2023-06-10 19:13:29 +00:00
|
|
|
SoundByte.PlayOneShotGame("cropStomp/stomp");
|
2022-02-28 08:33:11 +00:00
|
|
|
|
|
|
|
if (shakeTween != null)
|
|
|
|
shakeTween.Kill(true);
|
2022-06-04 03:15:56 +00:00
|
|
|
|
|
|
|
DOTween.Punch(() => GameCamera.additionalPosition, x => GameCamera.additionalPosition = x, new Vector3(0, 0.75f, 0),
|
|
|
|
Conductor.instance.pitchedSecPerBeat*0.5f, 18, 1f);
|
2022-02-28 08:33:11 +00:00
|
|
|
|
|
|
|
isStepping = true;
|
2022-02-27 23:26:03 +00:00
|
|
|
}
|
2022-03-01 06:38:38 +00:00
|
|
|
|
2023-06-10 19:13:29 +00:00
|
|
|
private void SpawnVeggie(double beat, double startBeat, bool isMole)
|
2022-03-01 06:38:38 +00:00
|
|
|
{
|
2022-03-03 02:50:08 +00:00
|
|
|
var newVeggie = GameObject.Instantiate(isMole ? baseMole : baseVeggie, veggieHolder).GetComponent<Veggie>();
|
2022-03-01 06:38:38 +00:00
|
|
|
|
|
|
|
newVeggie.targetBeat = beat;
|
|
|
|
|
|
|
|
var veggieX = (beat - startBeat) * -stepDistance / 2f;
|
2023-06-10 19:13:29 +00:00
|
|
|
newVeggie.transform.localPosition = new Vector3((float)veggieX, 0f, 0f);
|
2022-03-26 02:08:46 +00:00
|
|
|
newVeggie.Init();
|
2022-03-01 06:38:38 +00:00
|
|
|
newVeggie.gameObject.SetActive(true);
|
|
|
|
}
|
2022-03-08 04:46:49 +00:00
|
|
|
|
2023-06-10 19:13:29 +00:00
|
|
|
public static void MarchInactive(double beat)
|
2022-03-08 04:46:49 +00:00
|
|
|
{
|
|
|
|
if (GameManager.instance.currentGame == "cropStomp") //this function is only meant for making march sounds while the game is inactive
|
|
|
|
{
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
inactiveStart = beat;
|
2023-06-10 19:13:29 +00:00
|
|
|
RiqEntity gameSwitch = GameManager.instance.Beatmap.Entities.Find(c => c.beat >= beat && c.datamodel == "gameManager/switchGame/cropStomp");
|
2022-03-08 04:46:49 +00:00
|
|
|
if (gameSwitch == null)
|
|
|
|
return;
|
2023-06-10 19:13:29 +00:00
|
|
|
int length = (int)Math.Ceiling((gameSwitch.beat - beat)/2);
|
2022-03-08 04:46:49 +00:00
|
|
|
MultiSound.Sound[] sounds = new MultiSound.Sound[length];
|
|
|
|
for(int i = 0; i < length; i++)
|
|
|
|
{
|
|
|
|
sounds[i] = new MultiSound.Sound("cropStomp/hmm", beat + i*2);
|
|
|
|
}
|
|
|
|
MultiSound.Play(sounds, forcePlay:true);
|
|
|
|
}
|
2022-02-27 23:26:03 +00:00
|
|
|
}
|
|
|
|
}
|