HeavenStudio/Assets/Scripts/Games/CropStomp/Farmer.cs

59 lines
1.4 KiB
C#
Raw Normal View History

2022-02-28 08:33:11 +00:00
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
2022-03-14 14:21:05 +00:00
using HeavenStudio.Util;
2022-02-28 08:33:11 +00:00
2022-03-14 14:21:05 +00:00
namespace HeavenStudio.Games.Scripts_CropStomp
2022-02-28 08:33:11 +00:00
{
public class Farmer : PlayerActionObject
{
public float nextStompBeat;
private CropStomp game;
public void Init()
2022-02-28 08:33:11 +00:00
{
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();
2022-03-01 06:38:38 +00:00
game.bodyAnim.Play("Stomp", 0, 0);
2022-02-28 08:33:11 +00:00
nextStompBeat += 2f;
ResetState();
}
else if (state.notPerfect())
{
2022-03-01 06:38:38 +00:00
game.bodyAnim.Play("Crouch", 0, 0);
2022-02-28 08:33:11 +00:00
nextStompBeat += 2f;
ResetState();
}
2022-03-01 06:38:38 +00:00
else
{
game.bodyAnim.Play("Crouch", 0, 0);
}
2022-02-28 08:33:11 +00:00
}
}
}
}