2023-01-25 15:29:21 +00:00
|
|
|
using HeavenStudio.Util;
|
|
|
|
using System.Collections;
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
|
|
|
using System;
|
|
|
|
using UnityEngine;
|
|
|
|
|
|
|
|
namespace HeavenStudio.Games.Scripts_Kitties
|
|
|
|
{
|
|
|
|
public class CtrTeppanPlayer : MonoBehaviour
|
|
|
|
{
|
|
|
|
[Header("Objects")]
|
|
|
|
public GameObject Player;
|
|
|
|
public Animator anim;
|
|
|
|
public Animator fish;
|
|
|
|
private int spawnType;
|
|
|
|
|
2024-04-07 21:25:54 +00:00
|
|
|
//private bool hasClapped = false; Unused value - Marc
|
2023-01-25 15:29:21 +00:00
|
|
|
public bool canClap = false;
|
|
|
|
|
2023-10-29 19:44:47 +00:00
|
|
|
private bool hasSpun = false;
|
2024-04-07 21:25:54 +00:00
|
|
|
//private bool checkSpin = false; Unused value - Marc
|
2023-01-25 15:29:21 +00:00
|
|
|
|
2024-04-07 21:25:54 +00:00
|
|
|
//private bool hasFish = false; Unused value - Marc
|
|
|
|
//private bool canFish = false; Unused value - Marc
|
2023-01-25 15:29:21 +00:00
|
|
|
// Start is called before the first frame update
|
|
|
|
void Start()
|
|
|
|
{
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
// Update is called once per frame
|
|
|
|
void Update()
|
|
|
|
{
|
|
|
|
var cond = Conductor.instance;
|
|
|
|
|
2023-10-29 19:44:47 +00:00
|
|
|
if (PlayerInput.GetIsAction(Kitties.InputAction_BasicPress) && canClap && !Kitties.instance.IsExpectingInputNow(Kitties.InputAction_BasicPress))
|
2023-01-25 15:29:21 +00:00
|
|
|
{
|
2023-10-29 19:44:47 +00:00
|
|
|
if (PlayerInput.CurrentControlStyle == InputSystem.InputController.ControlStyles.Touch && !Kitties.instance.IsExpectingInputNow(Kitties.InputAction_AltStart))
|
|
|
|
{
|
|
|
|
SoundByte.PlayOneShot("miss");
|
|
|
|
if (spawnType != 3)
|
|
|
|
anim.Play("ClapFail", 0, 0);
|
|
|
|
else
|
|
|
|
anim.Play("FaceClapFail", 0, 0);
|
|
|
|
}
|
2023-01-25 15:29:21 +00:00
|
|
|
}
|
|
|
|
|
2023-10-29 19:44:47 +00:00
|
|
|
if ((PlayerInput.GetIsAction(Kitties.InputAction_AltStart) && canClap && !(Kitties.instance.IsExpectingInputNow(Kitties.InputAction_AltStart) || Kitties.instance.IsExpectingInputNow(Kitties.InputAction_BasicPress)))
|
|
|
|
|| (PlayerInput.GetIsAction(Kitties.InputAction_AltFinish) && canClap && !Kitties.instance.IsExpectingInputNow(Kitties.InputAction_AltFinish) && hasSpun)
|
|
|
|
|| ((PlayerInput.GetIsAction(Kitties.InputAction_TouchRelease) && !PlayerInput.GetIsAction(Kitties.InputAction_AltFinish)) && canClap && hasSpun))
|
2023-01-25 15:29:21 +00:00
|
|
|
{
|
|
|
|
RollFail();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2023-06-10 19:13:29 +00:00
|
|
|
public void ScheduleClap(double beat, int type)
|
2023-01-25 15:29:21 +00:00
|
|
|
{
|
|
|
|
spawnType = type;
|
2023-10-29 19:44:47 +00:00
|
|
|
Kitties.instance.ScheduleInput(beat, 2.5f, Kitties.InputAction_BasicPress, ClapSuccessOne, ClapMissOne, ClapEmpty);
|
|
|
|
Kitties.instance.ScheduleInput(beat, 3f, Kitties.InputAction_BasicPress, ClapSuccessTwo, ClapMissTwo, ClapEmpty);
|
2023-01-25 15:29:21 +00:00
|
|
|
}
|
|
|
|
|
2023-06-10 19:13:29 +00:00
|
|
|
public void ScheduleRoll(double beat)
|
2023-01-25 15:29:21 +00:00
|
|
|
{
|
2023-10-29 19:44:47 +00:00
|
|
|
Kitties.instance.ScheduleInput(beat, 2f, Kitties.InputAction_AltStart, SpinSuccessOne, SpinMissOne, SpinEmpty);
|
2023-01-25 15:29:21 +00:00
|
|
|
}
|
|
|
|
|
2023-06-10 19:13:29 +00:00
|
|
|
public void ScheduleRollFinish(double beat)
|
2023-01-25 15:29:21 +00:00
|
|
|
{
|
|
|
|
if (hasSpun)
|
2023-10-29 19:44:47 +00:00
|
|
|
Kitties.instance.ScheduleInput(beat, 2.75f, Kitties.InputAction_AltFinish, SpinSuccessTwo, SpinMissTwo, SpinEmpty);
|
2023-01-25 15:29:21 +00:00
|
|
|
}
|
|
|
|
|
2023-06-10 19:13:29 +00:00
|
|
|
public void ScheduleFish(double beat)
|
2023-01-25 15:29:21 +00:00
|
|
|
{
|
2023-10-29 19:44:47 +00:00
|
|
|
Kitties.instance.ScheduleInput(beat, 2.75f, Kitties.InputAction_BasicPress, FishSuccess, FishMiss, FishEmpty);
|
2023-01-25 15:29:21 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
public void ClapSuccessOne(PlayerActionEvent Caller, float state)
|
|
|
|
{
|
|
|
|
if (spawnType != 3)
|
|
|
|
{
|
|
|
|
if (state >= 1f || state <= -1f)
|
|
|
|
{ //todo: proper near miss feedback
|
2023-06-10 19:13:29 +00:00
|
|
|
SoundByte.PlayOneShotGame("kitties/ClapMiss1");
|
|
|
|
SoundByte.PlayOneShotGame("kitties/tink");
|
2023-01-25 15:29:21 +00:00
|
|
|
anim.Play("ClapMiss", 0, 0);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2023-06-10 19:13:29 +00:00
|
|
|
SoundByte.PlayOneShotGame("kitties/clap1");
|
2023-01-25 15:29:21 +00:00
|
|
|
anim.Play("Clap1", 0, 0);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
if (state >= 1f || state <= -1f)
|
|
|
|
{ //todo: proper near miss feedback
|
2023-06-10 19:13:29 +00:00
|
|
|
SoundByte.PlayOneShotGame("kitties/ClapMiss1");
|
|
|
|
SoundByte.PlayOneShotGame("kitties/tink");
|
2023-01-25 15:29:21 +00:00
|
|
|
anim.Play("FaceClapFail", 0, 0);
|
|
|
|
}
|
|
|
|
|
2023-06-10 19:13:29 +00:00
|
|
|
SoundByte.PlayOneShotGame("kitties/clap1");
|
2023-01-25 15:29:21 +00:00
|
|
|
anim.Play("FaceClap", 0, 0);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
public void ClapMissOne(PlayerActionEvent Caller)
|
|
|
|
{
|
2023-06-10 19:13:29 +00:00
|
|
|
SoundByte.PlayOneShotGame("kitties/ClapMiss1");
|
2023-01-25 15:29:21 +00:00
|
|
|
}
|
|
|
|
public void ClapEmpty(PlayerActionEvent Caller)
|
|
|
|
{
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
public void ClapSuccessTwo(PlayerActionEvent Caller, float state)
|
|
|
|
{
|
|
|
|
if (spawnType != 3)
|
|
|
|
{
|
|
|
|
if (state >= 1f || state <= -1f)
|
|
|
|
{ //todo: proper near miss feedback
|
2023-06-10 19:13:29 +00:00
|
|
|
SoundByte.PlayOneShotGame("kitties/ClapMiss2");
|
|
|
|
SoundByte.PlayOneShotGame("kitties/tink");
|
2023-01-25 15:29:21 +00:00
|
|
|
anim.Play("ClapMiss", 0, 0);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2023-06-10 19:13:29 +00:00
|
|
|
SoundByte.PlayOneShotGame("kitties/clap2");
|
2023-01-25 15:29:21 +00:00
|
|
|
anim.Play("Clap2", 0, 0);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
if (state >= 1f || state <= -1f)
|
|
|
|
{ //todo: proper near miss feedback
|
2023-06-10 19:13:29 +00:00
|
|
|
SoundByte.PlayOneShotGame("kitties/ClapMiss2");
|
|
|
|
SoundByte.PlayOneShotGame("kitties/tink");
|
2023-01-25 15:29:21 +00:00
|
|
|
anim.Play("FaceClapFail", 0, 0);
|
|
|
|
}
|
|
|
|
|
2023-06-10 19:13:29 +00:00
|
|
|
SoundByte.PlayOneShotGame("kitties/clap2");
|
2023-01-25 15:29:21 +00:00
|
|
|
anim.Play("FaceClap", 0, 0);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
public void ClapMissTwo(PlayerActionEvent Caller)
|
|
|
|
{
|
2023-06-10 19:13:29 +00:00
|
|
|
SoundByte.PlayOneShotGame("kitties/ClapMiss2");
|
2023-01-25 15:29:21 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
public void SpinSuccessOne(PlayerActionEvent caller, float beat)
|
|
|
|
{
|
|
|
|
hasSpun = true;
|
2023-06-10 19:13:29 +00:00
|
|
|
SoundByte.PlayOneShotGame("kitties/roll5");
|
2023-01-25 15:29:21 +00:00
|
|
|
anim.Play("Rolling", 0, 0);
|
2023-10-29 19:44:47 +00:00
|
|
|
ScheduleRollFinish(caller.startBeat);
|
2023-01-25 15:29:21 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
public void SpinSuccessTwo(PlayerActionEvent caller, float beat)
|
|
|
|
{
|
2023-06-10 19:13:29 +00:00
|
|
|
SoundByte.PlayOneShotGame("kitties/roll6");
|
2023-01-25 15:29:21 +00:00
|
|
|
anim.Play("RollEnd", 0, 0);
|
2023-10-29 19:44:47 +00:00
|
|
|
hasSpun = false;
|
2023-01-25 15:29:21 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
public void SpinMissOne(PlayerActionEvent caller)
|
|
|
|
{
|
|
|
|
hasSpun = false;
|
|
|
|
var cond = Conductor.instance;
|
2023-06-10 19:13:29 +00:00
|
|
|
SoundByte.PlayOneShotGame("kitties/roll5", -1f, 1, .1f);
|
|
|
|
SoundByte.PlayOneShotGame("kitties/roll6", cond.songPositionInBeatsAsDouble + .75f, 1, .1f);
|
2023-01-25 15:29:21 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
public void SpinMissTwo(PlayerActionEvent caller)
|
|
|
|
{
|
|
|
|
if (hasSpun)
|
|
|
|
{
|
|
|
|
RollFail();
|
|
|
|
}
|
2023-06-10 19:13:29 +00:00
|
|
|
SoundByte.PlayOneShotGame("kitties/roll6", -1f, 1, .3f);
|
2023-01-25 15:29:21 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
public void SpinEmpty(PlayerActionEvent caller)
|
|
|
|
{
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
public void RollFail()
|
|
|
|
{
|
2023-06-10 19:13:29 +00:00
|
|
|
SoundByte.PlayOneShot("miss");
|
2023-01-25 15:29:21 +00:00
|
|
|
anim.Play("RollFail", 0, 0);
|
|
|
|
hasSpun = false;
|
|
|
|
}
|
|
|
|
|
|
|
|
public void FishSuccess(PlayerActionEvent caller, float beat)
|
|
|
|
{
|
|
|
|
Kitties.instance.RemoveCats(false);
|
2023-06-10 19:13:29 +00:00
|
|
|
SoundByte.PlayOneShotGame("kitties/fish4");
|
2023-01-25 15:29:21 +00:00
|
|
|
fish.Play("CaughtSuccess", 0, 0);
|
|
|
|
}
|
|
|
|
|
|
|
|
public void FishMiss(PlayerActionEvent caller)
|
|
|
|
{
|
|
|
|
Kitties.instance.RemoveCats(false);
|
2023-06-10 19:13:29 +00:00
|
|
|
SoundByte.PlayOneShot("miss");
|
2023-01-25 15:29:21 +00:00
|
|
|
fish.Play("CaughtFail", 0, 0);
|
|
|
|
}
|
|
|
|
|
|
|
|
public void FishEmpty(PlayerActionEvent caller)
|
|
|
|
{
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|