blue bear InputAction
This commit is contained in:
parent
fefde12bc2
commit
ee0cd1bcd8
|
|
@ -1,6 +1,7 @@
|
|||
using DG.Tweening;
|
||||
using NaughtyBezierCurves;
|
||||
using HeavenStudio.Util;
|
||||
using HeavenStudio.InputSystem;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
|
@ -10,17 +11,18 @@ namespace HeavenStudio.Games.Loaders
|
|||
using static Minigames;
|
||||
public static class CtrBearLoader
|
||||
{
|
||||
public static Minigame AddGame(EventCaller eventCaller) {
|
||||
public static Minigame AddGame(EventCaller eventCaller)
|
||||
{
|
||||
return new Minigame("blueBear", "Blue Bear", "b4e6f6", false, false, new List<GameAction>()
|
||||
{
|
||||
new GameAction("donut", "Donut")
|
||||
{
|
||||
function = delegate { BlueBear.instance.SpawnTreat(eventCaller.currentEntity.beat, false); },
|
||||
function = delegate { BlueBear.instance.SpawnTreat(eventCaller.currentEntity.beat, false); },
|
||||
defaultLength = 3,
|
||||
},
|
||||
new GameAction("cake", "Cake")
|
||||
{
|
||||
function = delegate { BlueBear.instance.SpawnTreat(eventCaller.currentEntity.beat, true); },
|
||||
function = delegate { BlueBear.instance.SpawnTreat(eventCaller.currentEntity.beat, true); },
|
||||
defaultLength = 4,
|
||||
},
|
||||
new GameAction("setEmotion", "Set Emotion")
|
||||
|
|
@ -49,9 +51,9 @@ namespace HeavenStudio.Games.Loaders
|
|||
}
|
||||
}
|
||||
},
|
||||
new List<string>() {"ctr", "normal"},
|
||||
new List<string>() { "ctr", "normal" },
|
||||
"ctrbear", "en",
|
||||
new List<string>() {}
|
||||
new List<string>() { }
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
@ -110,6 +112,61 @@ namespace HeavenStudio.Games
|
|||
|
||||
public static BlueBear instance;
|
||||
|
||||
const int IALeft = 0;
|
||||
const int IARight = 1;
|
||||
protected static bool IA_PadLeft(out double dt)
|
||||
{
|
||||
return PlayerInput.GetPadDown(InputController.ActionsPad.Up, out dt)
|
||||
|| PlayerInput.GetPadDown(InputController.ActionsPad.Down, out dt)
|
||||
|| PlayerInput.GetPadDown(InputController.ActionsPad.Left, out dt)
|
||||
|| PlayerInput.GetPadDown(InputController.ActionsPad.Right, out dt);
|
||||
}
|
||||
protected static bool IA_BatonLeft(out double dt)
|
||||
{
|
||||
return PlayerInput.GetBatonDown(InputController.ActionsBaton.West, out dt);
|
||||
}
|
||||
protected static bool IA_TouchLeft(out double dt)
|
||||
{
|
||||
bool want = PlayerInput.GetTouchDown(InputController.ActionsTouch.Left, out dt);
|
||||
bool simul = false;
|
||||
// if (!want)
|
||||
// {
|
||||
// simul = PlayerInput.GetTouchDown(InputController.ActionsTouch.Tap, out dt)
|
||||
// && instance.IsExpectingInputNow(InputAction_Left.inputLockCategory)
|
||||
// && instance.IsExpectingInputNow(InputAction_Right.inputLockCategory);
|
||||
// }
|
||||
return want || simul;
|
||||
}
|
||||
|
||||
protected static bool IA_PadRight(out double dt)
|
||||
{
|
||||
return PlayerInput.GetPadDown(InputController.ActionsPad.East, out dt);
|
||||
}
|
||||
protected static bool IA_BatonRight(out double dt)
|
||||
{
|
||||
return PlayerInput.GetBatonDown(InputController.ActionsBaton.East, out dt);
|
||||
}
|
||||
protected static bool IA_TouchRight(out double dt)
|
||||
{
|
||||
bool want = PlayerInput.GetTouchDown(InputController.ActionsTouch.Right, out dt);
|
||||
bool simul = false;
|
||||
// if (!want)
|
||||
// {
|
||||
// simul = PlayerInput.GetTouchDown(InputController.ActionsTouch.Tap, out dt)
|
||||
// && instance.IsExpectingInputNow(InputAction_Right.inputLockCategory)
|
||||
// && instance.IsExpectingInputNow(InputAction_Left.inputLockCategory);
|
||||
// }
|
||||
return want || simul;
|
||||
}
|
||||
|
||||
public static PlayerInput.InputAction InputAction_Left =
|
||||
new("BlueBearLeft", new int[] { IALeft, IALeft, IALeft },
|
||||
IA_PadLeft, IA_TouchLeft, IA_BatonLeft);
|
||||
|
||||
public static PlayerInput.InputAction InputAction_Right =
|
||||
new("BlueBearRight", new int[] { IARight, IARight, IARight },
|
||||
IA_PadRight, IA_TouchRight, IA_BatonRight);
|
||||
|
||||
void OnDestroy()
|
||||
{
|
||||
if (Conductor.instance.isPlaying || Conductor.instance.isPaused) return;
|
||||
|
|
@ -132,16 +189,16 @@ namespace HeavenStudio.Games
|
|||
{
|
||||
headAndBodyAnim.SetBool("ShouldOpenMouth", foodHolder.childCount != 0);
|
||||
|
||||
if (PlayerInput.GetAnyDirectionDown() && !IsExpectingInputNow(InputType.DIRECTION_DOWN))
|
||||
if (PlayerInput.GetIsAction(InputAction_Left, out _) && !IsExpectingInputNow(InputAction_Left.inputLockCategory))
|
||||
{
|
||||
Bite(true);
|
||||
}
|
||||
else if (PlayerInput.Pressed() && !IsExpectingInputNow(InputType.STANDARD_DOWN))
|
||||
else if (PlayerInput.GetIsAction(InputAction_Right, out _) && !IsExpectingInputNow(InputAction_Right.inputLockCategory))
|
||||
{
|
||||
Bite(false);
|
||||
}
|
||||
|
||||
var cond = Conductor.instance;
|
||||
Conductor cond = Conductor.instance;
|
||||
|
||||
if (cond.isPlaying && !cond.isPaused)
|
||||
{
|
||||
|
|
@ -274,7 +331,7 @@ namespace HeavenStudio.Games
|
|||
{
|
||||
var objectToSpawn = isCake ? cakeBase : donutBase;
|
||||
var newTreat = GameObject.Instantiate(objectToSpawn, foodHolder);
|
||||
|
||||
|
||||
var treatComp = newTreat.GetComponent<Treat>();
|
||||
treatComp.startBeat = beat;
|
||||
treatComp.curve = isCake ? cakeCurve : donutCurve;
|
||||
|
|
|
|||
|
|
@ -21,7 +21,7 @@ namespace HeavenStudio.Games.Scripts_BlueBear
|
|||
[NonSerialized] public BezierCurve3D curve;
|
||||
|
||||
private BlueBear game;
|
||||
|
||||
|
||||
private void Awake()
|
||||
{
|
||||
game = BlueBear.instance;
|
||||
|
|
@ -30,7 +30,7 @@ namespace HeavenStudio.Games.Scripts_BlueBear
|
|||
private void Start()
|
||||
{
|
||||
flyBeats = isCake ? 3f : 2f;
|
||||
game.ScheduleInput(startBeat, flyBeats, isCake ? InputType.DIRECTION_DOWN : InputType.STANDARD_DOWN, Just, Out, Out);
|
||||
game.ScheduleInput(startBeat, flyBeats, isCake ? BlueBear.InputAction_Left : BlueBear.InputAction_Right, Just, Out, Out);
|
||||
}
|
||||
|
||||
private void Update()
|
||||
|
|
@ -45,7 +45,7 @@ namespace HeavenStudio.Games.Scripts_BlueBear
|
|||
|
||||
if (flyPos > 1f)
|
||||
{
|
||||
GameObject.Destroy(gameObject);
|
||||
Destroy(gameObject);
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
@ -76,7 +76,8 @@ namespace HeavenStudio.Games.Scripts_BlueBear
|
|||
|
||||
private void Just(PlayerActionEvent caller, float state)
|
||||
{
|
||||
if (state >= 1f || state <= -1f) { //todo: proper near miss feedback
|
||||
if (state >= 1f || state <= -1f)
|
||||
{ //todo: proper near miss feedback
|
||||
if (isCake)
|
||||
{
|
||||
game.headAndBodyAnim.Play("BiteL", 0, 0);
|
||||
|
|
@ -85,14 +86,14 @@ namespace HeavenStudio.Games.Scripts_BlueBear
|
|||
{
|
||||
game.headAndBodyAnim.Play("BiteR", 0, 0);
|
||||
}
|
||||
return;
|
||||
return;
|
||||
}
|
||||
EatFood();
|
||||
}
|
||||
|
||||
private void Miss(PlayerActionEvent caller) {}
|
||||
private void Miss(PlayerActionEvent caller) { }
|
||||
|
||||
private void Out(PlayerActionEvent caller) {}
|
||||
private void Out(PlayerActionEvent caller) { }
|
||||
|
||||
void SpawnCrumbs()
|
||||
{
|
||||
|
|
|
|||
|
|
@ -5,6 +5,7 @@ using UnityEngine;
|
|||
using HeavenStudio.Util;
|
||||
using HeavenStudio.Common;
|
||||
using HeavenStudio.InputSystem;
|
||||
using System;
|
||||
|
||||
namespace HeavenStudio.Games
|
||||
{
|
||||
|
|
@ -171,6 +172,7 @@ namespace HeavenStudio.Games
|
|||
/// <param name="OnMiss">Method to run if the Input has been Missed</param>
|
||||
/// <param name="OnBlank">Method to run whenever there's an Input while this is Scheduled (Shouldn't be used too much)</param>
|
||||
/// <returns></returns>
|
||||
[Obsolete("Use Input Action ScheduleInput instead")]
|
||||
public PlayerActionEvent ScheduleInput(
|
||||
double startBeat,
|
||||
double timer,
|
||||
|
|
@ -209,6 +211,7 @@ namespace HeavenStudio.Games
|
|||
return evt;
|
||||
}
|
||||
|
||||
[Obsolete("Use Input Action ScheduleInput instead")]
|
||||
public PlayerActionEvent ScheduleAutoplayInput(double startBeat,
|
||||
double timer,
|
||||
InputType inputType,
|
||||
|
|
@ -221,6 +224,7 @@ namespace HeavenStudio.Games
|
|||
return evt;
|
||||
}
|
||||
|
||||
[Obsolete("Use Input Action ScheduleInput instead")]
|
||||
public PlayerActionEvent ScheduleUserInput(double startBeat,
|
||||
double timer,
|
||||
InputType inputType,
|
||||
|
|
|
|||
|
|
@ -234,14 +234,14 @@ namespace HeavenStudio.InputSystem
|
|||
case 0:
|
||||
return bt;
|
||||
case 1:
|
||||
if (bt && rawPointerPos.x <= screenBounds.x * 0.5f)
|
||||
if (bt && rawPointerPos.x <= ScreenBounds.x * 0.5f)
|
||||
{
|
||||
lastDownPointerPos = rawPointerPos;
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
case 2:
|
||||
if (bt && rawPointerPos.x >= screenBounds.x * 0.5f)
|
||||
if (bt && rawPointerPos.x >= ScreenBounds.x * 0.5f)
|
||||
{
|
||||
lastDownPointerPos = rawPointerPos;
|
||||
return true;
|
||||
|
|
@ -264,7 +264,7 @@ namespace HeavenStudio.InputSystem
|
|||
case 0:
|
||||
return bt;
|
||||
case 1:
|
||||
if (bt && rawPointerPos.x <= screenBounds.x * 0.5f)
|
||||
if (bt && rawPointerPos.x <= ScreenBounds.x * 0.5f)
|
||||
{
|
||||
lastDownPointerPos = rawPointerPos;
|
||||
startPointerPos = rawPointerPos;
|
||||
|
|
@ -272,7 +272,7 @@ namespace HeavenStudio.InputSystem
|
|||
}
|
||||
return false;
|
||||
case 2:
|
||||
if (bt && rawPointerPos.x >= screenBounds.x * 0.5f)
|
||||
if (bt && rawPointerPos.x >= ScreenBounds.x * 0.5f)
|
||||
{
|
||||
lastDownPointerPos = rawPointerPos;
|
||||
startPointerPos = rawPointerPos;
|
||||
|
|
@ -296,14 +296,14 @@ namespace HeavenStudio.InputSystem
|
|||
case 0:
|
||||
return bt;
|
||||
case 1:
|
||||
if (bt && rawPointerPos.x <= screenBounds.x * 0.5f)
|
||||
if (bt && rawPointerPos.x <= ScreenBounds.x * 0.5f)
|
||||
{
|
||||
lastUpPointerPos = rawPointerPos;
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
case 2:
|
||||
if (bt && rawPointerPos.x >= screenBounds.x * 0.5f)
|
||||
if (bt && rawPointerPos.x >= ScreenBounds.x * 0.5f)
|
||||
{
|
||||
lastUpPointerPos = rawPointerPos;
|
||||
return true;
|
||||
|
|
|
|||
Loading…
Reference in a new issue