the stuff
This commit is contained in:
ThePurpleAnon
2024-03-29 18:22:44 -05:00
committed by GitHub
parent d06913092f
commit eb9cd7f9fa
2 changed files with 76 additions and 58 deletions

View File

@ -52,6 +52,7 @@ namespace HeavenStudio.Games.Scripts_ChargingChicken
[NonSerialized]public bool grassFell = false;
float previousPosition;
float previousTime;
[SerializeField] GameObject PlatformBase;
@ -112,18 +113,23 @@ namespace HeavenStudio.Games.Scripts_ChargingChicken
public void Awake()
{
StartCoroutine(CalcVelocity());
previousPosition = IslandPos.localPosition.x;
previousTime = Time.time;
}
IEnumerator CalcVelocity()
public float GetDist()
{
while (true)
{
yield return new WaitForEndOfFrame();
if (IslandPos.localPosition.x <= previousPosition) speed1 = -(IslandPos.localPosition.x - previousPosition) / Time.deltaTime;
previousPosition = IslandPos.localPosition.x;
}
float sendDist = 0;
if (previousPosition != 0) sendDist = -(IslandPos.localPosition.x - previousPosition);
previousPosition = IslandPos.localPosition.x;
return sendDist;
}
public float GetDT()
{
float sendDT = Time.time - previousTime;
previousTime = Time.time;
return sendDT;
}
#endregion
@ -239,9 +245,9 @@ namespace HeavenStudio.Games.Scripts_ChargingChicken
public void SpawnStones(double beat, double length, bool tooLate)
{
stonePlatformJourney = new StonePlatform[(int)(length * 4)];
stonePlatformJourney = new StonePlatform[(int)(length * ChargingChicken.platformsPerBeat)];
for ( int i = 0; i < length * 4; i++ )
for ( int i = 0; i < length * ChargingChicken.platformsPerBeat; i++ )
{
stonePlatformJourney[i].thisPlatform = Instantiate(PlatformBase, transform);
stonePlatformJourney[i].stoneNumber = i;