2022-01-24 02:15:23 +00:00
|
|
|
using System.Collections;
|
|
|
|
using System.Collections.Generic;
|
|
|
|
using UnityEngine;
|
|
|
|
|
2022-03-14 14:21:05 +00:00
|
|
|
using HeavenStudio.Util;
|
2022-01-24 02:15:23 +00:00
|
|
|
|
2022-03-14 14:21:05 +00:00
|
|
|
namespace HeavenStudio.Games.Scripts_SpaceSoccer
|
2022-01-24 02:15:23 +00:00
|
|
|
{
|
2023-05-07 20:33:15 +00:00
|
|
|
public class Kicker : MonoBehaviour
|
2022-01-24 02:15:23 +00:00
|
|
|
{
|
2023-01-16 03:05:25 +00:00
|
|
|
SpaceSoccer game;
|
|
|
|
|
2022-01-24 02:15:23 +00:00
|
|
|
[Header("Properties")]
|
2022-08-19 21:18:18 +00:00
|
|
|
public bool canKick = true; //why was this false by default???
|
2022-01-24 02:15:23 +00:00
|
|
|
public bool canHighKick;
|
2022-01-25 01:02:45 +00:00
|
|
|
private bool kickPrepare = false;
|
|
|
|
public bool kickLeft;
|
2023-04-26 12:43:35 +00:00
|
|
|
bool kickLeftWhiff;
|
2022-02-26 07:27:51 +00:00
|
|
|
public float dispenserBeat; //unused
|
2022-01-25 01:02:45 +00:00
|
|
|
public int kickTimes = 0;
|
2022-02-02 08:36:20 +00:00
|
|
|
public bool player;
|
2023-04-26 12:43:35 +00:00
|
|
|
private string animName = "Enter";
|
|
|
|
private float animLength;
|
|
|
|
private float animStartBeat;
|
|
|
|
private EasingFunction.Ease ease;
|
|
|
|
bool stopBall;
|
2022-01-24 02:15:23 +00:00
|
|
|
|
|
|
|
[Header("Components")]
|
|
|
|
private Animator anim;
|
2022-01-25 01:02:45 +00:00
|
|
|
public Ball ball;
|
2023-04-26 12:43:35 +00:00
|
|
|
[SerializeField] private Animator enterExitAnim;
|
2022-01-24 02:15:23 +00:00
|
|
|
|
2023-01-16 03:05:25 +00:00
|
|
|
PlayerActionEvent nextHit;
|
|
|
|
PlayerActionEvent nextAutoKick;
|
|
|
|
|
2022-03-26 02:08:46 +00:00
|
|
|
private void Awake()
|
2022-01-24 02:15:23 +00:00
|
|
|
{
|
2023-01-16 03:05:25 +00:00
|
|
|
game = SpaceSoccer.instance;
|
2022-01-24 02:15:23 +00:00
|
|
|
anim = GetComponent<Animator>();
|
|
|
|
}
|
|
|
|
|
2023-04-26 12:43:35 +00:00
|
|
|
public void SetAnimParams(float beat, float length, string anim, int easeToPut)
|
|
|
|
{
|
|
|
|
animStartBeat = beat;
|
|
|
|
animLength = length;
|
|
|
|
animName = anim;
|
|
|
|
ease = (EasingFunction.Ease)easeToPut;
|
|
|
|
EasingFunction.Function func = EasingFunction.GetEasingFunction(ease);
|
|
|
|
float newAnimPos = func(0, 1, 0);
|
|
|
|
enterExitAnim.DoNormalizedAnimation(animName, newAnimPos);
|
|
|
|
}
|
|
|
|
|
2023-01-16 03:05:25 +00:00
|
|
|
public void DispenseBall(float beat)
|
2022-01-24 02:15:23 +00:00
|
|
|
{
|
2023-01-16 03:05:25 +00:00
|
|
|
if (player)
|
2022-01-25 01:02:45 +00:00
|
|
|
{
|
2023-01-16 03:05:25 +00:00
|
|
|
nextHit = game.ScheduleInput(beat, ball.GetAnimLength(Ball.State.Dispensing), InputType.STANDARD_DOWN, KickJust, Miss, Out);
|
2022-01-25 01:02:45 +00:00
|
|
|
}
|
2023-01-31 16:15:51 +00:00
|
|
|
else
|
|
|
|
{
|
2023-04-26 12:43:35 +00:00
|
|
|
float beatToKick = beat + ball.GetAnimLength(Ball.State.Dispensing);
|
|
|
|
if (beatToKick < Conductor.instance.songPositionInBeats) beatToKick = ball.nextAnimBeat;
|
|
|
|
if (ball.state == Ball.State.HighKicked)
|
|
|
|
{
|
|
|
|
BeatAction.New(this.gameObject, new List<BeatAction.Action>()
|
|
|
|
{
|
|
|
|
new BeatAction.Action(beatToKick - 0.5f, delegate { Kick(true, true); }),
|
|
|
|
new BeatAction.Action(beatToKick, delegate { Toe(true); }),
|
|
|
|
new BeatAction.Action(beatToKick + ball.GetAnimLength(Ball.State.Toe), delegate { KickCheck(true, false, beatToKick + ball.GetAnimLength(Ball.State.Toe)); }),
|
|
|
|
});
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
BeatAction.New(this.gameObject, new List<BeatAction.Action>()
|
|
|
|
{
|
|
|
|
new BeatAction.Action(beatToKick, delegate { KickCheck(true, false, beatToKick); }),
|
|
|
|
});
|
|
|
|
}
|
2023-01-31 16:15:51 +00:00
|
|
|
}
|
2022-01-24 02:15:23 +00:00
|
|
|
}
|
|
|
|
|
2022-01-25 01:02:45 +00:00
|
|
|
public void Kick(bool hit, bool highKick = false)
|
2022-01-24 02:15:23 +00:00
|
|
|
{
|
2023-04-26 12:43:35 +00:00
|
|
|
if (stopBall) return;
|
2022-01-25 01:02:45 +00:00
|
|
|
|
2022-02-02 08:36:20 +00:00
|
|
|
if (player)
|
2023-01-31 16:15:51 +00:00
|
|
|
{
|
2022-02-02 08:36:20 +00:00
|
|
|
Jukebox.PlayOneShotGame("spaceSoccer/kick");
|
2023-01-31 16:15:51 +00:00
|
|
|
}
|
2022-02-02 01:11:42 +00:00
|
|
|
|
2023-04-26 12:43:35 +00:00
|
|
|
if (hit)
|
2022-01-25 01:02:45 +00:00
|
|
|
{
|
2023-04-26 12:43:35 +00:00
|
|
|
if (highKick)
|
2022-01-25 03:49:40 +00:00
|
|
|
{
|
2023-04-26 12:43:35 +00:00
|
|
|
if (kickLeft)
|
|
|
|
{
|
|
|
|
anim.DoScaledAnimationAsync("HighKickLeft_0", 0.5f);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
anim.DoScaledAnimationAsync("HighKickRight_0", 0.5f);
|
|
|
|
}
|
2022-01-25 03:49:40 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2023-04-26 12:43:35 +00:00
|
|
|
if (kickLeft)
|
|
|
|
{
|
|
|
|
anim.DoScaledAnimationAsync("KickLeft", 0.5f);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
anim.DoScaledAnimationAsync("KickRight", 0.5f);
|
|
|
|
}
|
2022-01-25 03:49:40 +00:00
|
|
|
}
|
2022-01-25 01:02:45 +00:00
|
|
|
}
|
2022-02-26 07:27:51 +00:00
|
|
|
else
|
2022-01-24 02:15:23 +00:00
|
|
|
{
|
2023-04-26 12:43:35 +00:00
|
|
|
if (highKick)
|
2022-01-25 03:49:40 +00:00
|
|
|
{
|
2023-04-26 12:43:35 +00:00
|
|
|
if (kickLeftWhiff)
|
|
|
|
{
|
|
|
|
anim.DoScaledAnimationAsync("HighKickLeft_0", 0.5f);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
anim.DoScaledAnimationAsync("HighKickRight_0", 0.5f);
|
|
|
|
}
|
2022-01-25 03:49:40 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2023-04-26 12:43:35 +00:00
|
|
|
if (kickLeftWhiff)
|
|
|
|
{
|
|
|
|
anim.DoScaledAnimationAsync("KickLeft", 0.5f);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
anim.DoScaledAnimationAsync("KickRight", 0.5f);
|
|
|
|
}
|
2022-01-25 03:49:40 +00:00
|
|
|
}
|
2023-04-26 12:43:35 +00:00
|
|
|
kickLeftWhiff = !kickLeftWhiff;
|
2022-01-24 02:15:23 +00:00
|
|
|
}
|
2022-02-02 01:11:42 +00:00
|
|
|
|
2023-04-26 12:43:35 +00:00
|
|
|
|
2022-02-02 01:11:42 +00:00
|
|
|
if (ball == null) return;
|
|
|
|
|
2022-01-25 01:02:45 +00:00
|
|
|
if (highKick == false)
|
|
|
|
{
|
2023-01-16 03:05:25 +00:00
|
|
|
kickTimes++;
|
2022-02-02 01:11:42 +00:00
|
|
|
if (ball != null && hit)
|
2022-02-02 08:36:20 +00:00
|
|
|
ball.Kick(player);
|
2022-01-25 01:02:45 +00:00
|
|
|
}
|
2022-01-24 02:15:23 +00:00
|
|
|
else
|
|
|
|
{
|
2022-01-25 01:02:45 +00:00
|
|
|
kickPrepare = true;
|
2022-01-24 02:15:23 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2022-01-25 01:02:45 +00:00
|
|
|
public void HighKick(bool hit)
|
2022-01-24 02:15:23 +00:00
|
|
|
{
|
2023-04-26 12:43:35 +00:00
|
|
|
if (stopBall) return;
|
2022-01-25 03:49:40 +00:00
|
|
|
kickTimes++;
|
2023-04-26 12:43:35 +00:00
|
|
|
if (hit)
|
2022-01-25 01:02:45 +00:00
|
|
|
{
|
2023-04-26 12:43:35 +00:00
|
|
|
if (kickLeft)
|
|
|
|
{
|
|
|
|
anim.DoScaledAnimationAsync("HighKickLeft_0", 0.5f);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
anim.DoScaledAnimationAsync("HighKickRight_0", 0.5f);
|
|
|
|
}
|
2022-01-25 01:02:45 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2023-04-26 12:43:35 +00:00
|
|
|
if (kickLeftWhiff)
|
|
|
|
{
|
|
|
|
anim.DoScaledAnimationAsync("HighKickLeft_0", 0.5f);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
anim.DoScaledAnimationAsync("HighKickRight_0", 0.5f);
|
|
|
|
}
|
|
|
|
kickLeftWhiff = !kickLeftWhiff;
|
2022-01-25 01:02:45 +00:00
|
|
|
}
|
|
|
|
|
2023-04-26 12:43:35 +00:00
|
|
|
if (player) Jukebox.PlayOneShotGame("spaceSoccer/highkicktoe1");
|
2022-02-02 08:36:20 +00:00
|
|
|
if (hit && ball)
|
2022-01-25 03:49:40 +00:00
|
|
|
{
|
2022-02-02 01:11:42 +00:00
|
|
|
ball.HighKick();
|
2022-02-02 08:36:20 +00:00
|
|
|
|
2023-04-26 12:43:35 +00:00
|
|
|
if (player) Jukebox.PlayOneShotGame("spaceSoccer/highkicktoe1_hit");
|
2022-01-25 03:49:40 +00:00
|
|
|
}
|
2023-04-26 12:43:35 +00:00
|
|
|
|
2022-01-25 01:02:45 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
public void Toe(bool hit)
|
|
|
|
{
|
2023-04-26 12:43:35 +00:00
|
|
|
if (stopBall) return;
|
2022-02-02 01:11:42 +00:00
|
|
|
if (kickLeft)
|
2022-01-25 01:02:45 +00:00
|
|
|
{
|
2023-04-26 12:43:35 +00:00
|
|
|
anim.DoScaledAnimationAsync("ToeLeft", 0.5f);
|
2022-01-25 01:02:45 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2023-04-26 12:43:35 +00:00
|
|
|
anim.DoScaledAnimationAsync("ToeRight", 0.5f);
|
2022-01-25 01:02:45 +00:00
|
|
|
}
|
2022-01-25 03:49:40 +00:00
|
|
|
|
2022-02-02 08:36:20 +00:00
|
|
|
if (player)
|
2022-01-25 03:49:40 +00:00
|
|
|
{
|
2023-04-26 12:43:35 +00:00
|
|
|
Jukebox.PlayOneShotGame("spaceSoccer/highkicktoe3");
|
2022-02-02 08:36:20 +00:00
|
|
|
if (hit && ball)
|
|
|
|
{
|
|
|
|
Jukebox.PlayOneShotGame("spaceSoccer/highkicktoe3_hit");
|
|
|
|
}
|
2022-01-25 03:49:40 +00:00
|
|
|
}
|
|
|
|
|
2022-02-02 08:36:20 +00:00
|
|
|
if (hit && ball)
|
|
|
|
ball.Toe();
|
|
|
|
|
2023-01-16 03:05:25 +00:00
|
|
|
kickTimes++;
|
2022-01-25 01:02:45 +00:00
|
|
|
kickPrepare = false;
|
2022-01-24 02:15:23 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
private void Update()
|
|
|
|
{
|
2023-04-26 12:43:35 +00:00
|
|
|
float normalizedBeat = Conductor.instance.GetPositionFromBeat(animStartBeat, animLength);
|
|
|
|
if (normalizedBeat >= 0 && normalizedBeat <= 1)
|
|
|
|
{
|
|
|
|
EasingFunction.Function func = EasingFunction.GetEasingFunction(ease);
|
|
|
|
float newAnimPos = func(0, 1, normalizedBeat);
|
|
|
|
enterExitAnim.DoNormalizedAnimation(animName, newAnimPos);
|
|
|
|
}
|
2022-01-25 01:02:45 +00:00
|
|
|
if (kickTimes % 2 == 0)
|
2022-01-24 02:15:23 +00:00
|
|
|
{
|
2022-01-25 01:02:45 +00:00
|
|
|
kickLeft = false;
|
2022-01-24 02:15:23 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2022-01-25 01:02:45 +00:00
|
|
|
kickLeft = true;
|
|
|
|
}
|
|
|
|
|
2022-08-21 23:46:45 +00:00
|
|
|
var highKicks = GameManager.instance.Beatmap.entities.FindAll(c => c.datamodel == "spaceSoccer/high kick-toe!");
|
2022-01-25 01:02:45 +00:00
|
|
|
for (int i = 0; i < highKicks.Count; i++)
|
|
|
|
{
|
|
|
|
if ((highKicks[i].beat - 0.15f) <= Conductor.instance.songPositionInBeats && highKicks[i].beat + 1f > Conductor.instance.songPositionInBeats)
|
|
|
|
{
|
|
|
|
canHighKick = true;
|
|
|
|
canKick = false;
|
2022-02-06 08:28:14 +00:00
|
|
|
|
|
|
|
if (ball)
|
2022-02-27 22:12:17 +00:00
|
|
|
{
|
2022-02-24 14:12:19 +00:00
|
|
|
ball.highKickSwing = highKicks[i].swing;
|
2022-02-27 22:12:17 +00:00
|
|
|
if (ball.highKickSwing == 0f)
|
|
|
|
ball.highKickSwing = 0.5f;
|
|
|
|
}
|
2022-01-25 01:02:45 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2022-08-19 21:18:18 +00:00
|
|
|
canKick = true;
|
2022-01-25 01:02:45 +00:00
|
|
|
canHighKick = false;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2023-01-16 03:05:25 +00:00
|
|
|
if (player)
|
2022-01-25 01:02:45 +00:00
|
|
|
{
|
2023-04-26 12:43:35 +00:00
|
|
|
if (stopBall) return;
|
2023-01-16 03:05:25 +00:00
|
|
|
if (PlayerInput.Pressed() && !game.IsExpectingInputNow(InputType.STANDARD_DOWN))
|
2022-01-25 01:02:45 +00:00
|
|
|
{
|
2023-01-16 03:05:25 +00:00
|
|
|
if (ball == null)
|
|
|
|
KickCheck(false, true);
|
|
|
|
else
|
|
|
|
Kick(false, ball.canKick);
|
|
|
|
|
2022-01-25 01:02:45 +00:00
|
|
|
}
|
2023-01-16 03:05:25 +00:00
|
|
|
if (PlayerInput.PressedUp() && ball != null)
|
2022-02-02 01:11:42 +00:00
|
|
|
{
|
2023-01-16 03:05:25 +00:00
|
|
|
if (ball.waitKickRelease)
|
2022-02-02 08:36:20 +00:00
|
|
|
{
|
2023-01-16 03:05:25 +00:00
|
|
|
ball.waitKickRelease = false;
|
|
|
|
}
|
|
|
|
else if (ball.canKick && !game.IsExpectingInputNow(InputType.STANDARD_UP))
|
|
|
|
{
|
|
|
|
ball.canKick = false;
|
|
|
|
Kick(false);
|
2022-02-02 08:36:20 +00:00
|
|
|
}
|
2022-02-02 01:11:42 +00:00
|
|
|
}
|
2022-01-25 01:02:45 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2023-01-31 16:15:51 +00:00
|
|
|
private void KickCheck(bool hit, bool overrideState = false, float beat = 0f)
|
2022-01-25 01:02:45 +00:00
|
|
|
{
|
2023-04-26 12:43:35 +00:00
|
|
|
if (stopBall) return;
|
2022-01-25 01:02:45 +00:00
|
|
|
if (canHighKick)
|
|
|
|
{
|
2022-02-02 01:11:42 +00:00
|
|
|
HighKick(hit);
|
2023-01-31 16:15:51 +00:00
|
|
|
if (!player)
|
|
|
|
{
|
|
|
|
BeatAction.New(this.gameObject, new List<BeatAction.Action>()
|
|
|
|
{
|
|
|
|
new BeatAction.Action(beat + ball.GetAnimLength(Ball.State.Kicked), delegate { Kick(true, true); }),
|
|
|
|
new BeatAction.Action(beat + ball.GetAnimLength(Ball.State.Toe), delegate { Toe(true); }),
|
|
|
|
new BeatAction.Action(beat + ball.GetAnimLength(Ball.State.Toe) + 1.5f, delegate { KickCheck(true, false, beat + ball.GetAnimLength(Ball.State.Toe) + 1.5f); }),
|
|
|
|
});
|
|
|
|
}
|
2022-01-25 01:02:45 +00:00
|
|
|
}
|
|
|
|
else if (canKick)
|
|
|
|
{
|
2022-02-02 01:11:42 +00:00
|
|
|
Kick(hit);
|
2023-01-31 16:15:51 +00:00
|
|
|
if (!player)
|
|
|
|
{
|
|
|
|
BeatAction.New(this.gameObject, new List<BeatAction.Action>()
|
|
|
|
{
|
|
|
|
new BeatAction.Action(beat + ball.GetAnimLength(Ball.State.Kicked), delegate { KickCheck(true, false, beat + ball.GetAnimLength(Ball.State.Kicked)); }),
|
|
|
|
});
|
|
|
|
}
|
2022-02-02 01:11:42 +00:00
|
|
|
}
|
|
|
|
else if (!canKick && !canHighKick && overrideState)
|
|
|
|
{
|
|
|
|
Kick(hit);
|
2023-01-31 16:15:51 +00:00
|
|
|
if (!player)
|
|
|
|
{
|
|
|
|
BeatAction.New(this.gameObject, new List<BeatAction.Action>()
|
|
|
|
{
|
|
|
|
new BeatAction.Action(beat + ball.GetAnimLength(Ball.State.Kicked), delegate { KickCheck(true, false, beat + ball.GetAnimLength(Ball.State.Kicked)); }),
|
|
|
|
});
|
|
|
|
}
|
2022-01-25 01:02:45 +00:00
|
|
|
}
|
2023-01-31 16:15:51 +00:00
|
|
|
|
|
|
|
|
2022-01-25 01:02:45 +00:00
|
|
|
}
|
|
|
|
|
2023-04-26 12:43:35 +00:00
|
|
|
public void StopBall(bool stop)
|
|
|
|
{
|
|
|
|
stopBall = stop;
|
|
|
|
if (ball != null && stop) Destroy(ball.gameObject);
|
|
|
|
}
|
|
|
|
|
2023-01-16 03:05:25 +00:00
|
|
|
void MissBall(float targetBeat)
|
|
|
|
{
|
2023-04-26 12:43:35 +00:00
|
|
|
if (stopBall) return;
|
|
|
|
|
2023-01-16 03:05:25 +00:00
|
|
|
var cond = Conductor.instance;
|
|
|
|
ball = null;
|
|
|
|
// queue the miss sound
|
2023-04-26 12:43:35 +00:00
|
|
|
MultiSound.Play(new MultiSound.Sound[] { new MultiSound.Sound("spaceSoccer/missNeutral", targetBeat + (float)cond.SecsToBeats(Minigame.EndTime()-1,
|
|
|
|
cond.GetBpmAtBeat(targetBeat)), Jukebox.GetPitchFromCents(UnityEngine.Random.Range(-75, 75), false)) });
|
2023-01-16 03:05:25 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
private void KickJust(PlayerActionEvent caller, float state)
|
2022-01-25 01:02:45 +00:00
|
|
|
{
|
2023-04-26 12:43:35 +00:00
|
|
|
if (stopBall) return;
|
2023-01-16 03:05:25 +00:00
|
|
|
if (ball == null || state >= 1f || state <= -1f) { //todo: proper near miss feedback
|
|
|
|
KickCheck(false, true);
|
|
|
|
MissBall(caller.startBeat + caller.timer);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
KickCheck(true);
|
|
|
|
if (canHighKick)
|
2022-01-25 01:02:45 +00:00
|
|
|
{
|
2023-01-16 03:05:25 +00:00
|
|
|
// queue high kick inputs
|
|
|
|
nextHit = game.ScheduleInput(caller.startBeat + caller.timer, ball.GetAnimLength(Ball.State.Toe), InputType.STANDARD_UP, ToeJust, Miss, Out);
|
|
|
|
nextAutoKick = game.ScheduleAutoplayInput(caller.startBeat + caller.timer, ball.GetAnimLength(Ball.State.Kicked), InputType.STANDARD_DOWN, ToePrepareJust, Out, Out);
|
|
|
|
ball.canKick = true;
|
|
|
|
ball.waitKickRelease = true;
|
2022-01-24 02:15:23 +00:00
|
|
|
}
|
2023-01-16 03:05:25 +00:00
|
|
|
else
|
|
|
|
{
|
|
|
|
// queue normal kick input
|
|
|
|
nextHit = game.ScheduleInput(caller.startBeat + caller.timer, ball.GetAnimLength(Ball.State.Kicked), InputType.STANDARD_DOWN, KickJust, Miss, Out);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
private void Miss(PlayerActionEvent caller)
|
|
|
|
{
|
2023-04-26 12:43:35 +00:00
|
|
|
if (stopBall) return;
|
2023-01-16 03:05:25 +00:00
|
|
|
if (ball != null)
|
|
|
|
MissBall(caller.startBeat + caller.timer);
|
|
|
|
|
|
|
|
// if this were any other keep the beat game you'd cue the next input here
|
|
|
|
}
|
|
|
|
|
|
|
|
private void ToeJust(PlayerActionEvent caller, float state)
|
|
|
|
{
|
2023-04-26 12:43:35 +00:00
|
|
|
if (stopBall) return;
|
|
|
|
|
2023-01-16 03:05:25 +00:00
|
|
|
if (ball == null || (!ball.canKick) || state >= 1f || state <= -1f) { //todo: proper near miss feedback
|
|
|
|
Toe(false);
|
|
|
|
MissBall(caller.startBeat + caller.timer);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
Toe(true);
|
|
|
|
nextHit = game.ScheduleInput(caller.startBeat, 3f, InputType.STANDARD_DOWN, KickJust, Miss, Out);
|
|
|
|
ball.canKick = false;
|
|
|
|
}
|
|
|
|
|
|
|
|
private void ToePrepareJust(PlayerActionEvent caller, float state)
|
|
|
|
{
|
2023-04-26 12:43:35 +00:00
|
|
|
if (stopBall) return;
|
|
|
|
|
2023-01-16 03:05:25 +00:00
|
|
|
//autoplay only
|
|
|
|
Kick(true, true);
|
|
|
|
}
|
|
|
|
|
|
|
|
private void Out(PlayerActionEvent caller) {}
|
|
|
|
|
|
|
|
void OnDestroy()
|
|
|
|
{
|
|
|
|
if (nextHit != null)
|
|
|
|
nextHit.Disable();
|
|
|
|
if (nextAutoKick != null)
|
|
|
|
nextAutoKick.Disable();
|
2023-04-26 12:43:35 +00:00
|
|
|
if (ball != null) Destroy(ball.gameObject);
|
2022-01-24 02:15:23 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|