mirror of
https://github.com/RHeavenStudioPlus/HeavenStudioPlus.git
synced 2024-11-30 05:23:06 +00:00
a653194e07
I just moved everything that was in start to awake. There are a few other changes I made, like using init functions rather than awake in scripts that depended on something that was initialized in another script's awake (to make sure things always happen in the right order), as well as some other stuff in some specific minigames
58 lines
1.4 KiB
C#
58 lines
1.4 KiB
C#
using System.Collections;
|
|
using System.Collections.Generic;
|
|
using UnityEngine;
|
|
|
|
using HeavenStudio.Util;
|
|
|
|
namespace HeavenStudio.Games.Scripts_CropStomp
|
|
{
|
|
public class Farmer : PlayerActionObject
|
|
{
|
|
public float nextStompBeat;
|
|
|
|
private CropStomp game;
|
|
|
|
public void Init()
|
|
{
|
|
game = CropStomp.instance;
|
|
}
|
|
|
|
private void Update()
|
|
{
|
|
if (!game.isMarching)
|
|
return;
|
|
|
|
float normalizedBeat = Conductor.instance.GetPositionFromMargin(nextStompBeat, 1f);
|
|
|
|
StateCheck(normalizedBeat);
|
|
|
|
if (normalizedBeat > Minigame.LateTime())
|
|
{
|
|
nextStompBeat += 2f;
|
|
ResetState();
|
|
return;
|
|
}
|
|
|
|
if (PlayerInput.Pressed())
|
|
{
|
|
if (state.perfect)
|
|
{
|
|
game.Stomp();
|
|
game.bodyAnim.Play("Stomp", 0, 0);
|
|
nextStompBeat += 2f;
|
|
ResetState();
|
|
}
|
|
else if (state.notPerfect())
|
|
{
|
|
game.bodyAnim.Play("Crouch", 0, 0);
|
|
nextStompBeat += 2f;
|
|
ResetState();
|
|
}
|
|
else
|
|
{
|
|
game.bodyAnim.Play("Crouch", 0, 0);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|