update blue bear to use PlayerActionEvent
This commit is contained in:
parent
0115333d8b
commit
b6b0232a4a
|
@ -68,11 +68,11 @@ namespace HeavenStudio.Games
|
|||
{
|
||||
headAndBodyAnim.SetBool("ShouldOpenMouth", foodHolder.childCount != 0);
|
||||
|
||||
if (PlayerInput.GetAnyDirectionDown())
|
||||
if (PlayerInput.GetAnyDirectionDown() && !IsExpectingInputNow(InputType.DIRECTION_DOWN))
|
||||
{
|
||||
headAndBodyAnim.Play("BiteL", 0, 0);
|
||||
}
|
||||
else if (PlayerInput.Pressed())
|
||||
else if (PlayerInput.Pressed() && !IsExpectingInputNow(InputType.STANDARD_DOWN))
|
||||
{
|
||||
headAndBodyAnim.Play("BiteR", 0, 0);
|
||||
}
|
||||
|
|
|
@ -27,6 +27,7 @@ namespace HeavenStudio.Games.Scripts_BlueBear
|
|||
game = BlueBear.instance;
|
||||
|
||||
flyBeats = isCake ? 3f : 2f;
|
||||
game.ScheduleInput(startBeat, flyBeats, isCake ? InputType.DIRECTION_DOWN : InputType.STANDARD_DOWN, EatJust, EatOut, EatOut);
|
||||
}
|
||||
|
||||
private void Update()
|
||||
|
@ -47,46 +48,9 @@ namespace HeavenStudio.Games.Scripts_BlueBear
|
|||
|
||||
float rot = isCake ? rotSpeed : -rotSpeed;
|
||||
transform.rotation = Quaternion.Euler(0, 0, transform.rotation.eulerAngles.z + (rot * Time.deltaTime));
|
||||
|
||||
float normalizedBeat = cond.GetPositionFromMargin(startBeat + flyBeats, 1f);
|
||||
StateCheck(normalizedBeat);
|
||||
|
||||
if (PlayerInput.Pressed())
|
||||
{
|
||||
if (!isCake)
|
||||
{
|
||||
if (state.perfect)
|
||||
{
|
||||
flying = false;
|
||||
|
||||
Jukebox.PlayOneShotGame("blueBear/chompDonut");
|
||||
|
||||
SpawnCrumbs();
|
||||
|
||||
GameObject.Destroy(gameObject);
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (PlayerInput.GetAnyDirection())
|
||||
{
|
||||
if (isCake)
|
||||
{
|
||||
if (state.perfect)
|
||||
{
|
||||
flying = false;
|
||||
|
||||
Jukebox.PlayOneShotGame("blueBear/chompCake");
|
||||
|
||||
SpawnCrumbs();
|
||||
|
||||
GameObject.Destroy(gameObject);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public override void OnAce()
|
||||
void EatFood()
|
||||
{
|
||||
flying = false;
|
||||
|
||||
|
@ -106,6 +70,24 @@ namespace HeavenStudio.Games.Scripts_BlueBear
|
|||
GameObject.Destroy(gameObject);
|
||||
}
|
||||
|
||||
private void EatJust(PlayerActionEvent caller, float state)
|
||||
{
|
||||
if (state >= 1f || state <= -1f) { //todo: proper near miss feedback
|
||||
if (isCake)
|
||||
{
|
||||
game.headAndBodyAnim.Play("BiteL", 0, 0);
|
||||
}
|
||||
else
|
||||
{
|
||||
game.headAndBodyAnim.Play("BiteR", 0, 0);
|
||||
}
|
||||
return;
|
||||
}
|
||||
EatFood();
|
||||
}
|
||||
|
||||
private void EatOut(PlayerActionEvent caller) {}
|
||||
|
||||
void SpawnCrumbs()
|
||||
{
|
||||
var crumbsGO = GameObject.Instantiate(game.crumbsBase, game.crumbsHolder);
|
||||
|
|
Loading…
Reference in a new issue