2022-07-27 22:35:18 +00:00
|
|
|
using System.Collections;
|
|
|
|
using System.Collections.Generic;
|
|
|
|
using UnityEngine;
|
|
|
|
|
2022-07-30 02:25:48 +00:00
|
|
|
using NaughtyBezierCurves;
|
|
|
|
|
2022-07-27 22:35:18 +00:00
|
|
|
using HeavenStudio.Util;
|
|
|
|
|
|
|
|
namespace HeavenStudio.Games.Scripts_KarateMan
|
|
|
|
{
|
2023-05-07 20:33:15 +00:00
|
|
|
public class KarateManPot : MonoBehaviour
|
2022-07-27 22:35:18 +00:00
|
|
|
{
|
|
|
|
public float startBeat;
|
|
|
|
public ItemType type;
|
|
|
|
public int path = 1;
|
2022-07-28 23:12:21 +00:00
|
|
|
|
|
|
|
public GameObject Shadow;
|
|
|
|
public GameObject ShadowInstance;
|
2022-08-03 22:55:13 +00:00
|
|
|
SpriteRenderer shadowRenderer;
|
2022-07-28 23:12:21 +00:00
|
|
|
|
2022-07-31 01:16:48 +00:00
|
|
|
//hit effects
|
2022-07-30 02:25:48 +00:00
|
|
|
public GameObject HitMark;
|
2022-07-31 01:16:48 +00:00
|
|
|
public ParticleSystem[] HitParticles;
|
2022-07-30 02:25:48 +00:00
|
|
|
|
2022-07-28 23:12:21 +00:00
|
|
|
public string awakeAnim;
|
|
|
|
FlyStatus status = FlyStatus.Fly;
|
2022-07-29 16:18:17 +00:00
|
|
|
Color effectTint = Color.white;
|
2022-07-28 23:12:21 +00:00
|
|
|
|
2022-08-12 14:41:41 +00:00
|
|
|
[SerializeField] SpriteRenderer[] cellRenderers;
|
|
|
|
Material[] cellMaterials;
|
|
|
|
[SerializeField] Color[] ItemAlienMap;
|
|
|
|
[SerializeField] Color[] ItemBombMap;
|
|
|
|
[SerializeField] Color[] ItemBarrelMap;
|
|
|
|
[SerializeField] Color[] ItemCookingLidMap;
|
2022-08-11 23:36:47 +00:00
|
|
|
|
2022-08-15 00:47:13 +00:00
|
|
|
public bool KickBarrelContent = false;
|
|
|
|
public int OnHitExpression = (int) KarateMan.KarateManFaces.Normal;
|
|
|
|
|
2022-07-28 23:12:21 +00:00
|
|
|
public int comboId = -1;
|
|
|
|
static int _lastCombo = -1;
|
|
|
|
public static int LastCombo { get { return _lastCombo; } }
|
|
|
|
public static int GetNewCombo() { _lastCombo++; return _lastCombo; }
|
|
|
|
public static void ResetLastCombo() { _lastCombo = -1; }
|
2022-07-27 22:35:18 +00:00
|
|
|
|
|
|
|
public enum ItemType {
|
|
|
|
Pot, // path 1
|
|
|
|
Bulb, // path 1
|
|
|
|
Rock, // path 1
|
|
|
|
Ball, // path 1
|
|
|
|
Cooking, // path 1
|
|
|
|
Alien, // path 1
|
|
|
|
TacoBell, // path 1
|
2022-08-15 00:47:13 +00:00
|
|
|
Bomb, // path 1
|
2022-07-27 22:35:18 +00:00
|
|
|
|
|
|
|
KickBarrel, // path 1
|
|
|
|
KickBomb, // no path
|
2022-08-15 00:47:13 +00:00
|
|
|
KickBall, // no path
|
2022-07-27 22:35:18 +00:00
|
|
|
|
|
|
|
ComboPot1, // path 1
|
|
|
|
ComboPot2, // path 1
|
|
|
|
ComboPot3, // path 2
|
|
|
|
ComboPot4, // path 3
|
|
|
|
ComboPot5, // path 4
|
2022-08-07 01:09:28 +00:00
|
|
|
ComboBarrel,// path 5
|
|
|
|
|
|
|
|
CookingLid, //only used for hit
|
2022-07-27 22:35:18 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
public enum FlyStatus {
|
|
|
|
Fly,
|
|
|
|
Hit,
|
|
|
|
NG,
|
|
|
|
HitWeak
|
|
|
|
}
|
|
|
|
|
|
|
|
//pot trajectory stuff
|
|
|
|
public Transform[] HitPosition;
|
|
|
|
public float[] HitPositionOffset;
|
2022-07-28 23:12:21 +00:00
|
|
|
public Vector3[] StartPositionOffset;
|
|
|
|
public float[] ItemSlipRt;
|
2022-07-30 02:25:48 +00:00
|
|
|
public BezierCurve3D[] ItemCurves;
|
|
|
|
public BezierCurve3D CurrentCurve;
|
|
|
|
public float curveTargetBeat;
|
2022-07-27 22:35:18 +00:00
|
|
|
|
2022-07-29 16:18:17 +00:00
|
|
|
public SpriteRenderer BulbLight;
|
|
|
|
|
|
|
|
public void SetBulbColor(Color c) {
|
|
|
|
effectTint = c;
|
|
|
|
BulbLight.color = c;
|
|
|
|
}
|
|
|
|
|
2022-07-27 22:35:18 +00:00
|
|
|
float ProgressToHitPosition(float progress) {
|
2022-07-28 23:12:21 +00:00
|
|
|
return progress + (HitPositionOffset[path] - 0.5f);
|
2022-07-27 22:35:18 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
Vector3 ProgressToFlyPosition()
|
|
|
|
{
|
|
|
|
var cond = Conductor.instance;
|
2022-07-28 23:12:21 +00:00
|
|
|
float progress = Mathf.Min(cond.GetPositionFromBeat(startBeat, 2f), 1f - ItemSlipRt[path]);
|
2022-07-27 22:35:18 +00:00
|
|
|
float progressToHitPosition = ProgressToHitPosition(progress);
|
|
|
|
|
2022-07-28 23:12:21 +00:00
|
|
|
Vector3 hitPosition = HitPosition[path].position;
|
2022-07-27 22:35:18 +00:00
|
|
|
|
|
|
|
//https://www.desmos.com/calculator/ycn9v62i4f
|
|
|
|
float offset = HitPositionOffset[path];
|
|
|
|
float flyHeight = (progressToHitPosition*(progressToHitPosition-1f))/(offset*(offset-1f));
|
|
|
|
float floorHeight = HitPosition[0].position.y;
|
|
|
|
|
2022-07-28 23:12:21 +00:00
|
|
|
Vector3 startPosition = hitPosition + StartPositionOffset[path];
|
|
|
|
Vector3 endPosition = hitPosition - StartPositionOffset[path];
|
2022-07-27 22:35:18 +00:00
|
|
|
Vector3 flyPosition = new Vector3(
|
|
|
|
Mathf.Lerp(startPosition.x, endPosition.x, progress),
|
2022-07-29 16:52:59 +00:00
|
|
|
floorHeight + (HitPosition[path].position.y - floorHeight + (StartPositionOffset[path].y * (1 - Mathf.Min(cond.GetPositionFromBeat(startBeat, 1f), 1f)))) * flyHeight,
|
2022-07-27 22:35:18 +00:00
|
|
|
Mathf.Lerp(startPosition.z, endPosition.z, progress)
|
|
|
|
);
|
|
|
|
|
|
|
|
if (progress >= 0.5f && flyPosition.y < HitPosition[0].position.y) {
|
|
|
|
flyPosition.y = floorHeight;
|
|
|
|
}
|
|
|
|
return flyPosition;
|
|
|
|
}
|
2022-07-28 23:12:21 +00:00
|
|
|
|
2022-08-12 14:41:41 +00:00
|
|
|
void SetColourMapping()
|
|
|
|
{
|
|
|
|
Color alpha, bravo, delta;
|
|
|
|
switch (type)
|
|
|
|
{
|
|
|
|
case ItemType.Alien:
|
|
|
|
alpha = ItemAlienMap[0];
|
|
|
|
bravo = ItemAlienMap[1];
|
2022-08-14 21:39:42 +00:00
|
|
|
delta = KarateMan.ItemColor;
|
2022-08-12 14:41:41 +00:00
|
|
|
break;
|
2022-08-15 00:47:13 +00:00
|
|
|
case ItemType.Bomb:
|
2022-08-12 14:41:41 +00:00
|
|
|
case ItemType.KickBomb:
|
|
|
|
alpha = ItemBombMap[0];
|
|
|
|
bravo = ItemBombMap[1];
|
2022-08-14 21:39:42 +00:00
|
|
|
delta = KarateMan.ItemColor;
|
2022-08-12 14:41:41 +00:00
|
|
|
break;
|
|
|
|
case ItemType.KickBarrel:
|
|
|
|
case ItemType.ComboBarrel:
|
|
|
|
alpha = ItemBarrelMap[0];
|
|
|
|
bravo = ItemBarrelMap[1];
|
|
|
|
delta = ItemBarrelMap[2];
|
|
|
|
break;
|
|
|
|
case ItemType.Cooking:
|
|
|
|
case ItemType.CookingLid:
|
|
|
|
alpha = ItemCookingLidMap[0];
|
|
|
|
bravo = ItemCookingLidMap[1];
|
2022-08-14 21:39:42 +00:00
|
|
|
delta = KarateMan.ItemColor;
|
2022-08-12 14:41:41 +00:00
|
|
|
break;
|
|
|
|
default:
|
2022-08-14 21:39:42 +00:00
|
|
|
alpha = KarateMan.ItemColor;
|
|
|
|
bravo = KarateMan.ItemColor;
|
|
|
|
delta = KarateMan.ItemColor;
|
2022-08-12 14:41:41 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
for (int i = 0; i < cellRenderers.Length; i++) {
|
|
|
|
SpriteRenderer r = cellRenderers[i];
|
|
|
|
if (r.material != null)
|
|
|
|
{
|
|
|
|
if (cellMaterials == null)
|
|
|
|
{
|
|
|
|
cellMaterials = new Material[cellRenderers.Length];
|
|
|
|
cellMaterials[i] = Instantiate(r.material);
|
|
|
|
r.material = cellMaterials[i];
|
|
|
|
}
|
|
|
|
|
|
|
|
r.material.SetColor("_ColorAlpha", alpha);
|
|
|
|
r.material.SetColor("_ColorBravo", bravo);
|
|
|
|
r.material.SetColor("_ColorDelta", delta);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2022-08-14 04:34:19 +00:00
|
|
|
|
|
|
|
PlayerActionEvent OnHit;
|
|
|
|
PlayerActionEvent OnHitWrongAction;
|
2022-07-28 23:12:21 +00:00
|
|
|
void Awake()
|
|
|
|
{
|
|
|
|
switch (type)
|
|
|
|
{
|
|
|
|
case ItemType.ComboPot1:
|
2022-08-14 04:34:19 +00:00
|
|
|
OnHit = KarateMan.instance.ScheduleInput(startBeat, 1f, InputType.STANDARD_ALT_DOWN, ComboStartJustOrNg, ComboStartThrough, ComboStartOut);
|
|
|
|
OnHitWrongAction = KarateMan.instance.ScheduleUserInput(startBeat, 1f, InputType.STANDARD_DOWN | InputType.DIRECTION_DOWN, ComboStartWrongAction, ComboStartOut, ComboStartOut);
|
2022-07-28 23:12:21 +00:00
|
|
|
path = 1;
|
|
|
|
break;
|
|
|
|
case ItemType.ComboPot2:
|
|
|
|
path = 1;
|
2022-07-29 02:09:48 +00:00
|
|
|
BeatAction.New(gameObject, new List<BeatAction.Action>() { new BeatAction.Action(startBeat + 1f, delegate { JoeComboSequence(); }) });
|
2022-07-28 23:12:21 +00:00
|
|
|
break;
|
|
|
|
case ItemType.ComboPot3:
|
|
|
|
path = 2;
|
2022-07-29 02:09:48 +00:00
|
|
|
BeatAction.New(gameObject, new List<BeatAction.Action>() { new BeatAction.Action(startBeat + 1f, delegate { JoeComboSequence(); }) });
|
2022-07-28 23:12:21 +00:00
|
|
|
break;
|
|
|
|
case ItemType.ComboPot4:
|
|
|
|
path = 3;
|
|
|
|
//if the button isn't held anymore make Joe spin
|
2022-07-29 02:09:48 +00:00
|
|
|
BeatAction.New(gameObject, new List<BeatAction.Action>() { new BeatAction.Action(startBeat + 1f, delegate { JoeComboSequence(); }) });
|
2022-07-28 23:12:21 +00:00
|
|
|
break;
|
|
|
|
case ItemType.ComboPot5:
|
|
|
|
path = 4;
|
2022-07-29 02:09:48 +00:00
|
|
|
BeatAction.New(gameObject, new List<BeatAction.Action>() { new BeatAction.Action(startBeat + 1f, delegate { JoeComboSequence(); }) });
|
2022-07-28 23:12:21 +00:00
|
|
|
break;
|
|
|
|
case ItemType.ComboBarrel:
|
2022-07-29 16:18:17 +00:00
|
|
|
//check for button release
|
2022-08-14 04:34:19 +00:00
|
|
|
OnHit = KarateMan.instance.ScheduleInput(startBeat, 1f, InputType.STANDARD_ALT_UP, ComboEndJustOrNg, ComboEndThrough, ComboEndOut);
|
2022-07-29 16:18:17 +00:00
|
|
|
//button presses
|
2022-07-29 19:06:22 +00:00
|
|
|
KarateMan.instance.ScheduleUserInput(startBeat, 1f, InputType.STANDARD_DOWN | InputType.DIRECTION_DOWN, ComboEndWrongAction, ItemOut, ItemOut);
|
|
|
|
KarateMan.instance.ScheduleUserInput(startBeat, 1f, InputType.STANDARD_ALT_DOWN, ComboEndWrongActionAlt, ItemOut, ItemOut);
|
2022-07-28 23:12:21 +00:00
|
|
|
path = 5;
|
|
|
|
break;
|
2022-07-29 19:26:59 +00:00
|
|
|
case ItemType.KickBarrel:
|
2022-08-14 04:34:19 +00:00
|
|
|
OnHit = KarateMan.instance.ScheduleInput(startBeat, 1f, InputType.STANDARD_DOWN | InputType.DIRECTION_DOWN, KickChargeJustOrNg, ItemThrough, ItemOut);
|
|
|
|
OnHitWrongAction = KarateMan.instance.ScheduleUserInput(startBeat, 1f, InputType.STANDARD_ALT_DOWN, ItemWrongAction, ItemOut, ItemOut);
|
2022-07-29 19:26:59 +00:00
|
|
|
path = 1;
|
|
|
|
comboId = -1;
|
|
|
|
break;
|
2022-07-31 01:16:48 +00:00
|
|
|
case ItemType.KickBomb:
|
2022-08-14 04:34:19 +00:00
|
|
|
OnHit = KarateMan.instance.ScheduleInput(startBeat, 0.75f, InputType.STANDARD_UP | InputType.DIRECTION_UP, KickJustOrNg, KickThrough, KickOut);
|
2022-07-31 01:16:48 +00:00
|
|
|
CurrentCurve = ItemCurves[6];
|
|
|
|
curveTargetBeat = 2 * 0.75f;
|
|
|
|
path = 1;
|
|
|
|
comboId = -1;
|
|
|
|
break;
|
2022-08-15 00:47:13 +00:00
|
|
|
case ItemType.KickBall:
|
|
|
|
OnHit = KarateMan.instance.ScheduleInput(startBeat, 0.75f, InputType.STANDARD_UP | InputType.DIRECTION_UP, KickJustOrNg, KickThrough, KickOut);
|
|
|
|
CurrentCurve = ItemCurves[6];
|
|
|
|
curveTargetBeat = 2 * 0.75f;
|
|
|
|
path = 1;
|
|
|
|
comboId = -1;
|
|
|
|
break;
|
2022-08-07 01:09:28 +00:00
|
|
|
case ItemType.CookingLid:
|
|
|
|
CurrentCurve = ItemCurves[9];
|
|
|
|
path = 1;
|
|
|
|
curveTargetBeat = 2f;
|
|
|
|
status = FlyStatus.Hit;
|
|
|
|
comboId = -1;
|
|
|
|
break;
|
2022-08-15 00:47:13 +00:00
|
|
|
case ItemType.Bomb:
|
|
|
|
OnHit = KarateMan.instance.ScheduleInput(startBeat, 1f, InputType.STANDARD_DOWN | InputType.DIRECTION_DOWN, ItemJustOrNg, ItemThrough, ItemOut);
|
|
|
|
OnHitWrongAction = KarateMan.instance.ScheduleUserInput(startBeat, 1f, InputType.STANDARD_ALT_DOWN, ItemWrongAction, ItemOut, ItemOut);
|
|
|
|
path = 1;
|
|
|
|
comboId = -1;
|
|
|
|
break;
|
2022-07-28 23:12:21 +00:00
|
|
|
default:
|
2022-08-14 04:34:19 +00:00
|
|
|
OnHit = KarateMan.instance.ScheduleInput(startBeat, 1f, InputType.STANDARD_DOWN | InputType.DIRECTION_DOWN, ItemJustOrNg, ItemThrough, ItemOut);
|
|
|
|
OnHitWrongAction = KarateMan.instance.ScheduleUserInput(startBeat, 1f, InputType.STANDARD_ALT_DOWN, ItemWrongAction, ItemOut, ItemOut);
|
2022-07-28 23:12:21 +00:00
|
|
|
path = 1;
|
|
|
|
comboId = -1;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
float floorHeight = HitPosition[0].position.y;
|
2022-07-31 01:16:48 +00:00
|
|
|
if (CurrentCurve == null)
|
|
|
|
transform.position = ProgressToFlyPosition();
|
|
|
|
else
|
|
|
|
transform.position = CurrentCurve.GetPoint(0f);
|
2022-07-28 23:12:21 +00:00
|
|
|
|
|
|
|
transform.rotation = Quaternion.Euler(0, 0, transform.rotation.eulerAngles.z + (-360f * Time.deltaTime) + UnityEngine.Random.Range(0f, 360f));
|
|
|
|
|
2022-07-29 19:06:22 +00:00
|
|
|
ShadowInstance = GameObject.Instantiate(Shadow, KarateMan.instance.ItemHolder);
|
2022-08-03 22:55:13 +00:00
|
|
|
shadowRenderer = ShadowInstance.GetComponent<SpriteRenderer>();
|
|
|
|
shadowRenderer.color = KarateMan.instance.GetShadowColor();
|
2022-07-28 23:12:21 +00:00
|
|
|
ShadowInstance.SetActive(true);
|
|
|
|
ShadowInstance.transform.position = new Vector3(transform.position.x, floorHeight - 0.5f, transform.position.z);
|
|
|
|
}
|
|
|
|
|
2022-08-12 14:41:41 +00:00
|
|
|
void Start()
|
|
|
|
{
|
|
|
|
Animator mobjAnim = GetComponent<Animator>();
|
|
|
|
mobjAnim.Play(awakeAnim, -1, 0);
|
|
|
|
SetColourMapping();
|
|
|
|
}
|
|
|
|
|
2022-07-28 23:12:21 +00:00
|
|
|
void Update()
|
|
|
|
{
|
|
|
|
var cond = Conductor.instance;
|
|
|
|
float floorHeight = HitPosition[0].position.y;
|
|
|
|
switch (status)
|
|
|
|
{
|
|
|
|
case FlyStatus.Fly:
|
|
|
|
float prog = cond.GetPositionFromBeat(startBeat, 2f);
|
2022-07-31 01:16:48 +00:00
|
|
|
if (CurrentCurve == null)
|
|
|
|
transform.position = ProgressToFlyPosition();
|
|
|
|
else
|
|
|
|
{
|
|
|
|
prog = cond.GetPositionFromBeat(startBeat, curveTargetBeat);
|
|
|
|
transform.position = CurrentCurve.GetPoint(Mathf.Min(prog, 1f));
|
|
|
|
}
|
2022-08-18 16:12:02 +00:00
|
|
|
|
|
|
|
if (type == ItemType.Bomb && cond.songPositionInBeats >= startBeat + 2f)
|
|
|
|
{
|
|
|
|
ParticleSystem p = Instantiate(HitParticles[7], transform.position, Quaternion.identity, KarateMan.instance.ItemHolder);
|
|
|
|
p.Play();
|
2022-07-31 01:16:48 +00:00
|
|
|
|
2022-08-18 16:12:02 +00:00
|
|
|
GameObject.Destroy(ShadowInstance.gameObject);
|
|
|
|
GameObject.Destroy(gameObject);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
else if (prog >= 2f || (ItemKickable() && prog >= 1f)) {
|
2022-08-03 20:14:37 +00:00
|
|
|
if (type == ItemType.KickBomb)
|
|
|
|
{
|
|
|
|
ParticleSystem p = Instantiate(HitParticles[7], ItemCurves[6].GetPoint(1f), Quaternion.identity, KarateMan.instance.ItemHolder);
|
|
|
|
p.Play();
|
|
|
|
}
|
2022-07-28 23:12:21 +00:00
|
|
|
GameObject.Destroy(ShadowInstance.gameObject);
|
|
|
|
GameObject.Destroy(gameObject);
|
|
|
|
return;
|
|
|
|
}
|
2022-07-31 01:16:48 +00:00
|
|
|
else if (CurrentCurve == null && prog < 1f - ItemSlipRt[path]) {
|
2022-07-29 19:26:59 +00:00
|
|
|
transform.rotation = Quaternion.Euler(0, 0, transform.rotation.eulerAngles.z + (125f * Time.deltaTime * (1/cond.pitchedSecPerBeat)));
|
2022-07-28 23:12:21 +00:00
|
|
|
}
|
2022-07-31 01:16:48 +00:00
|
|
|
else if (CurrentCurve != null && prog < 1f)
|
|
|
|
{
|
|
|
|
transform.rotation = Quaternion.Euler(0, 0, transform.rotation.eulerAngles.z + (-90f * Time.deltaTime * (1/cond.pitchedSecPerBeat)));
|
|
|
|
}
|
2022-07-28 23:12:21 +00:00
|
|
|
break;
|
|
|
|
case FlyStatus.Hit:
|
2022-07-30 02:25:48 +00:00
|
|
|
prog = cond.GetPositionFromBeat(startBeat, curveTargetBeat);
|
2022-08-15 00:47:13 +00:00
|
|
|
if (type == ItemType.Bomb && cond.songPositionInBeats >= startBeat + curveTargetBeat)
|
|
|
|
{
|
|
|
|
ParticleSystem p = Instantiate(HitParticles[7], CurrentCurve.GetPoint(1f), Quaternion.identity, KarateMan.instance.ItemHolder);
|
|
|
|
p.Play();
|
|
|
|
|
|
|
|
GameObject.Destroy(ShadowInstance.gameObject);
|
|
|
|
GameObject.Destroy(gameObject);
|
|
|
|
|
|
|
|
Jukebox.PlayOneShotGame("karateman/bombBreak", volume: 0.25f);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
else if (cond.songPositionInBeats >= startBeat + Mathf.Max(2f, curveTargetBeat) || CurrentCurve == null) {
|
2022-08-03 20:14:37 +00:00
|
|
|
|
|
|
|
if (type == ItemType.KickBomb)
|
|
|
|
{
|
|
|
|
ParticleSystem p = Instantiate(HitParticles[6], ItemCurves[7].GetPoint(1f), Quaternion.identity, KarateMan.instance.ItemHolder);
|
|
|
|
p.Play();
|
|
|
|
}
|
2022-08-15 00:47:13 +00:00
|
|
|
else if (type == ItemType.KickBall && cond.songPositionInBeats < startBeat + curveTargetBeat + 1f)
|
|
|
|
return;
|
|
|
|
|
2022-07-30 02:25:48 +00:00
|
|
|
GameObject.Destroy(ShadowInstance.gameObject);
|
|
|
|
GameObject.Destroy(gameObject);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
if (prog <= 1f)
|
|
|
|
{
|
|
|
|
transform.position = CurrentCurve.GetPoint(prog);
|
2022-08-07 23:40:06 +00:00
|
|
|
transform.rotation = Quaternion.Euler(0, 0, transform.rotation.eulerAngles.z + (-270f * Time.deltaTime * (1/cond.pitchedSecPerBeat)));
|
2022-07-30 02:25:48 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
transform.position = CurrentCurve.GetPoint(1f);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
break;
|
2022-07-28 23:12:21 +00:00
|
|
|
case FlyStatus.NG:
|
2022-07-31 01:16:48 +00:00
|
|
|
prog = cond.GetPositionFromBeat(startBeat, curveTargetBeat);
|
2022-08-18 16:12:02 +00:00
|
|
|
|
|
|
|
if (type == ItemType.Bomb && cond.songPositionInBeats >= startBeat + curveTargetBeat)
|
|
|
|
{
|
|
|
|
KarateMan.instance.Joe.RemoveBombGlow(startBeat + curveTargetBeat, 1f);
|
|
|
|
ParticleSystem p = Instantiate(HitParticles[7], CurrentCurve.GetPoint(1f), Quaternion.identity, KarateMan.instance.ItemHolder);
|
|
|
|
p.Play();
|
|
|
|
|
|
|
|
GameObject.Destroy(ShadowInstance.gameObject);
|
|
|
|
GameObject.Destroy(gameObject);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
else if (cond.songPositionInBeats >= startBeat + Mathf.Max(2f, curveTargetBeat) || (ItemKickable() && prog >= 1f) || CurrentCurve == null) {
|
2022-08-03 20:14:37 +00:00
|
|
|
if (type == ItemType.KickBomb)
|
|
|
|
{
|
|
|
|
ParticleSystem p = Instantiate(HitParticles[7], ItemCurves[8].GetPoint(1f), Quaternion.identity, KarateMan.instance.ItemHolder);
|
|
|
|
p.Play();
|
|
|
|
}
|
2022-07-31 01:16:48 +00:00
|
|
|
GameObject.Destroy(ShadowInstance.gameObject);
|
|
|
|
GameObject.Destroy(gameObject);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
if (prog <= 1f)
|
|
|
|
{
|
|
|
|
transform.position = CurrentCurve.GetPoint(prog);
|
|
|
|
transform.rotation = Quaternion.Euler(0, 0, transform.rotation.eulerAngles.z + (-90f * Time.deltaTime * (1/cond.pitchedSecPerBeat)));
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
transform.position = CurrentCurve.GetPoint(1f);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
break;
|
2022-07-28 23:12:21 +00:00
|
|
|
case FlyStatus.HitWeak:
|
2022-08-13 01:06:41 +00:00
|
|
|
prog = cond.GetPositionFromBeat(startBeat, 1f);
|
2022-08-18 16:12:02 +00:00
|
|
|
|
|
|
|
Vector3 pos = new Vector3(HitPosition[1].position.x + 0.25f, HitPosition[0].position.y, HitPosition[1].position.z);
|
|
|
|
if (type == ItemType.Bomb && cond.songPositionInBeats >= startBeat + 1f)
|
|
|
|
{
|
|
|
|
KarateMan.instance.Joe.RemoveBombGlow(startBeat + 1f, 1f);
|
|
|
|
|
|
|
|
ParticleSystem p = Instantiate(HitParticles[7], pos, Quaternion.identity, KarateMan.instance.ItemHolder);
|
|
|
|
p.Play();
|
|
|
|
|
|
|
|
GameObject.Destroy(ShadowInstance.gameObject);
|
|
|
|
GameObject.Destroy(gameObject);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
else if (cond.songPositionInBeats >= startBeat + 3f)
|
2022-08-13 01:06:41 +00:00
|
|
|
{
|
|
|
|
GameObject.Destroy(ShadowInstance.gameObject);
|
|
|
|
GameObject.Destroy(gameObject);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
if (prog <= 1f)
|
|
|
|
{
|
|
|
|
pos.y = EasingFunction.EaseInCubic(HitPosition[1].position.y, HitPosition[0].position.y, prog);
|
|
|
|
}
|
|
|
|
transform.position = pos;
|
2022-07-28 23:12:21 +00:00
|
|
|
break;
|
|
|
|
}
|
2022-07-30 02:25:48 +00:00
|
|
|
ShadowInstance.transform.position = new Vector3(transform.position.x, floorHeight - 0.5f, transform.position.z);
|
2022-08-03 22:55:13 +00:00
|
|
|
shadowRenderer.color = KarateMan.instance.GetShadowColor();
|
2022-08-12 14:41:41 +00:00
|
|
|
SetColourMapping();
|
2022-07-30 02:25:48 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void CreateHitMark(bool useLocalPos = false)
|
|
|
|
{
|
|
|
|
GameObject hitMark = GameObject.Instantiate(HitMark, KarateMan.instance.ItemHolder);
|
|
|
|
if (useLocalPos)
|
|
|
|
hitMark.transform.localPosition = transform.position;
|
|
|
|
else
|
|
|
|
hitMark.transform.position = HitPosition[path].position;
|
|
|
|
|
|
|
|
hitMark.SetActive(true);
|
2022-07-28 23:12:21 +00:00
|
|
|
}
|
|
|
|
|
2022-07-29 16:18:17 +00:00
|
|
|
//handles hitsound and particles
|
2022-07-30 02:25:48 +00:00
|
|
|
void ItemHitEffect(bool straight = false)
|
2022-07-29 16:18:17 +00:00
|
|
|
{
|
2022-08-03 20:14:37 +00:00
|
|
|
ParticleSystem p;
|
2022-08-15 00:47:13 +00:00
|
|
|
CreateHitMark(ItemKickable());
|
2022-08-14 22:59:28 +00:00
|
|
|
KarateMan game = KarateMan.instance;
|
2022-07-29 16:18:17 +00:00
|
|
|
switch (type)
|
|
|
|
{
|
|
|
|
case ItemType.Bulb:
|
2022-07-30 02:25:48 +00:00
|
|
|
CurrentCurve = ItemCurves[straight ? 1 : 0];
|
2022-08-07 23:40:06 +00:00
|
|
|
curveTargetBeat = straight ? 1f : 1.5f;;
|
2022-07-29 16:18:17 +00:00
|
|
|
Jukebox.PlayOneShotGame("karateman/lightbulbHit", forcePlay: true);
|
2022-08-14 22:59:28 +00:00
|
|
|
p = Instantiate(HitParticles[5], HitPosition[1].position, Quaternion.Euler(0, 0, UnityEngine.Random.Range(0f, 360f)), game.ItemHolder);
|
2022-08-03 20:14:37 +00:00
|
|
|
|
|
|
|
if (effectTint.a == 0)
|
|
|
|
break;
|
|
|
|
|
|
|
|
//change gradient to match own colour
|
|
|
|
var col = p.colorOverLifetime;
|
|
|
|
col.enabled = true;
|
|
|
|
Gradient grad = new Gradient();
|
|
|
|
grad.SetKeys(new GradientColorKey[] { new GradientColorKey(Color.white, 0.0f), new GradientColorKey(Color.white, 0.25f), new GradientColorKey(effectTint, 0.5f), new GradientColorKey(effectTint, 1.0f) }, new GradientAlphaKey[] { new GradientAlphaKey(1.0f, 0.0f), new GradientAlphaKey(1.0f, 0.5f), new GradientAlphaKey(0.0f, 1.0f) });
|
|
|
|
col.color = grad;
|
|
|
|
|
|
|
|
var col2 = p.gameObject.transform.GetChild(0).GetComponent<ParticleSystem>().colorOverLifetime;
|
|
|
|
col2.enabled = true;
|
|
|
|
Gradient grad2 = new Gradient();
|
|
|
|
grad2.SetKeys(new GradientColorKey[] { new GradientColorKey(Color.white, 0.0f), new GradientColorKey(effectTint, 0.5f) }, new GradientAlphaKey[] { new GradientAlphaKey(1.0f, 0.0f), new GradientAlphaKey(1.0f, 1.0f) });
|
|
|
|
col2.color = grad2;
|
|
|
|
|
|
|
|
p.Play();
|
2022-07-29 16:18:17 +00:00
|
|
|
break;
|
|
|
|
case ItemType.Rock:
|
2022-07-30 02:25:48 +00:00
|
|
|
CurrentCurve = ItemCurves[1];
|
2022-08-07 23:40:06 +00:00
|
|
|
curveTargetBeat = 1f;
|
2022-07-29 16:18:17 +00:00
|
|
|
Jukebox.PlayOneShotGame("karateman/rockHit", forcePlay: true);
|
2022-08-14 22:59:28 +00:00
|
|
|
p = Instantiate(HitParticles[4], HitPosition[1].position, Quaternion.identity, game.ItemHolder);
|
2022-08-03 20:14:37 +00:00
|
|
|
p.Play();
|
2022-08-18 16:12:02 +00:00
|
|
|
|
|
|
|
if (game.IsNoriActive && game.NoriPerformance >= 1f)
|
|
|
|
Jukebox.PlayOneShotGame("karateman/rockHit_fullNori", forcePlay: true);
|
2022-07-29 16:18:17 +00:00
|
|
|
break;
|
|
|
|
case ItemType.Ball:
|
2022-07-30 02:25:48 +00:00
|
|
|
CurrentCurve = ItemCurves[1];
|
2022-08-07 23:40:06 +00:00
|
|
|
curveTargetBeat = 1f;
|
2022-07-29 16:18:17 +00:00
|
|
|
Jukebox.PlayOneShotGame("karateman/soccerHit", forcePlay: true);
|
2022-08-14 22:59:28 +00:00
|
|
|
p = Instantiate(HitParticles[1], HitPosition[1].position, Quaternion.Euler(0, 0, UnityEngine.Random.Range(0f, 360f)), game.ItemHolder);
|
2022-07-31 01:16:48 +00:00
|
|
|
p.Play();
|
2022-07-29 16:18:17 +00:00
|
|
|
break;
|
|
|
|
case ItemType.Cooking:
|
2022-07-30 02:25:48 +00:00
|
|
|
CurrentCurve = ItemCurves[1];
|
2022-08-07 23:40:06 +00:00
|
|
|
curveTargetBeat = 1f;
|
2022-07-29 16:18:17 +00:00
|
|
|
Jukebox.PlayOneShotGame("karateman/cookingPot", forcePlay: true);
|
2022-08-14 22:59:28 +00:00
|
|
|
p = Instantiate(HitParticles[1], HitPosition[1].position, Quaternion.Euler(0, 0, UnityEngine.Random.Range(0f, 360f)), game.ItemHolder);
|
2022-07-31 01:16:48 +00:00
|
|
|
p.Play();
|
2022-08-15 00:47:13 +00:00
|
|
|
game.CreateItemInstance(startBeat + 1f, "Item09", 0, ItemType.CookingLid);
|
2022-08-07 01:09:28 +00:00
|
|
|
GetComponent<Animator>().Play("Item08", -1, 0);
|
2022-08-18 16:12:02 +00:00
|
|
|
|
|
|
|
if (game.IsNoriActive && game.NoriPerformance >= 1f)
|
|
|
|
Jukebox.PlayOneShotGame("karateman/rockHit_fullNori", forcePlay: true);
|
2022-07-29 16:18:17 +00:00
|
|
|
break;
|
|
|
|
case ItemType.Alien:
|
2022-07-30 02:25:48 +00:00
|
|
|
CurrentCurve = ItemCurves[1];
|
2022-08-07 23:40:06 +00:00
|
|
|
curveTargetBeat = 1f;
|
2022-07-29 16:18:17 +00:00
|
|
|
Jukebox.PlayOneShotGame("karateman/alienHit", forcePlay: true);
|
2022-08-14 22:59:28 +00:00
|
|
|
p = Instantiate(HitParticles[1], HitPosition[1].position, Quaternion.Euler(0, 0, UnityEngine.Random.Range(0f, 360f)), game.ItemHolder);
|
2022-07-31 01:16:48 +00:00
|
|
|
p.Play();
|
2022-08-18 16:12:02 +00:00
|
|
|
|
|
|
|
if (game.IsNoriActive && game.NoriPerformance >= 1f)
|
|
|
|
Jukebox.PlayOneShotGame("karateman/rockHit_fullNori", forcePlay: true);
|
2022-07-29 16:18:17 +00:00
|
|
|
break;
|
2022-08-15 00:47:13 +00:00
|
|
|
case ItemType.Bomb:
|
|
|
|
CurrentCurve = ItemCurves[1];
|
|
|
|
curveTargetBeat = 1f;
|
|
|
|
Jukebox.PlayOneShotGame("karateman/bombHit", forcePlay: true);
|
|
|
|
p = Instantiate(HitParticles[2], HitPosition[1].position, Quaternion.Euler(0, 0, UnityEngine.Random.Range(0f, 360f)), game.ItemHolder);
|
|
|
|
p.Play();
|
|
|
|
game.Joe.RemoveBombGlow(startBeat + 1f, 1f);
|
2022-08-18 16:12:02 +00:00
|
|
|
|
|
|
|
if (game.IsNoriActive && game.NoriPerformance >= 1f)
|
|
|
|
Jukebox.PlayOneShotGame("karateman/rockHit_fullNori", forcePlay: true);
|
2022-08-15 00:47:13 +00:00
|
|
|
break;
|
2022-07-29 16:18:17 +00:00
|
|
|
case ItemType.TacoBell:
|
2022-07-30 02:25:48 +00:00
|
|
|
CurrentCurve = ItemCurves[1];
|
2022-08-07 23:40:06 +00:00
|
|
|
curveTargetBeat = 1f;
|
2022-07-29 16:18:17 +00:00
|
|
|
Jukebox.PlayOneShotGame("karateman/rockHit", forcePlay: true);
|
|
|
|
Jukebox.PlayOneShotGame("karateman/tacobell", forcePlay: true);
|
2022-08-14 22:59:28 +00:00
|
|
|
p = Instantiate(HitParticles[1], HitPosition[1].position, Quaternion.Euler(0, 0, UnityEngine.Random.Range(0f, 360f)), game.ItemHolder);
|
2022-07-31 01:16:48 +00:00
|
|
|
p.Play();
|
2022-08-18 16:12:02 +00:00
|
|
|
|
|
|
|
if (game.IsNoriActive && game.NoriPerformance >= 1f)
|
|
|
|
Jukebox.PlayOneShotGame("karateman/rockHit_fullNori", forcePlay: true);
|
2022-07-29 16:18:17 +00:00
|
|
|
break;
|
|
|
|
case ItemType.ComboPot1:
|
2022-07-30 02:25:48 +00:00
|
|
|
CurrentCurve = ItemCurves[straight ? 1 : 0];
|
2022-08-07 23:40:06 +00:00
|
|
|
curveTargetBeat = 1.5f;
|
2022-07-29 16:18:17 +00:00
|
|
|
Jukebox.PlayOneShotGame("karateman/comboHit1", forcePlay: true);
|
2022-08-14 22:59:28 +00:00
|
|
|
p = Instantiate(HitParticles[1], HitPosition[1].position, Quaternion.Euler(0, 0, UnityEngine.Random.Range(0f, 360f)), game.ItemHolder);
|
2022-07-31 01:16:48 +00:00
|
|
|
p.Play();
|
2022-07-29 16:18:17 +00:00
|
|
|
break;
|
|
|
|
case ItemType.ComboPot2:
|
2022-07-30 02:25:48 +00:00
|
|
|
CurrentCurve = ItemCurves[0];
|
2022-08-07 23:40:06 +00:00
|
|
|
curveTargetBeat = 1.5f;
|
2022-07-29 16:18:17 +00:00
|
|
|
Jukebox.PlayOneShotGame("karateman/comboHit1", forcePlay: true);
|
2022-08-14 22:59:28 +00:00
|
|
|
p = Instantiate(HitParticles[1], HitPosition[1].position, Quaternion.Euler(0, 0, UnityEngine.Random.Range(0f, 360f)), game.ItemHolder);
|
2022-07-31 01:16:48 +00:00
|
|
|
p.Play();
|
2022-07-29 16:18:17 +00:00
|
|
|
break;
|
|
|
|
case ItemType.ComboPot3:
|
2022-07-30 02:25:48 +00:00
|
|
|
CurrentCurve = ItemCurves[2];
|
|
|
|
curveTargetBeat = 1f;
|
2022-07-29 16:18:17 +00:00
|
|
|
Jukebox.PlayOneShotGame("karateman/comboHit2", forcePlay: true);
|
2022-08-14 22:59:28 +00:00
|
|
|
p = Instantiate(HitParticles[1], HitPosition[2].position, Quaternion.Euler(0, 0, UnityEngine.Random.Range(0f, 360f)), game.ItemHolder);
|
2022-07-31 01:16:48 +00:00
|
|
|
p.Play();
|
2022-07-29 16:18:17 +00:00
|
|
|
break;
|
|
|
|
case ItemType.ComboPot4:
|
2022-07-30 02:25:48 +00:00
|
|
|
CurrentCurve = ItemCurves[3];
|
|
|
|
curveTargetBeat = 1f;
|
2022-07-29 16:18:17 +00:00
|
|
|
Jukebox.PlayOneShotGame("karateman/comboHit3", forcePlay: true);
|
2022-08-14 22:59:28 +00:00
|
|
|
p = Instantiate(HitParticles[1], HitPosition[3].position, Quaternion.Euler(0, 0, UnityEngine.Random.Range(0f, 360f)), game.ItemHolder);
|
2022-07-31 01:16:48 +00:00
|
|
|
p.Play();
|
2022-07-29 16:18:17 +00:00
|
|
|
break;
|
|
|
|
case ItemType.ComboPot5:
|
2022-07-30 02:25:48 +00:00
|
|
|
CurrentCurve = ItemCurves[4];
|
|
|
|
curveTargetBeat = 1f;
|
2022-07-29 16:18:17 +00:00
|
|
|
Jukebox.PlayOneShotGame("karateman/comboHit3", forcePlay: true);
|
2022-08-14 22:59:28 +00:00
|
|
|
p = Instantiate(HitParticles[1], HitPosition[4].position, Quaternion.Euler(0, 0, UnityEngine.Random.Range(0f, 360f)), game.ItemHolder);
|
2022-07-31 01:16:48 +00:00
|
|
|
p.Play();
|
2022-07-29 16:18:17 +00:00
|
|
|
break;
|
|
|
|
case ItemType.ComboBarrel:
|
|
|
|
Jukebox.PlayOneShotGame("karateman/comboHit4", forcePlay: true);
|
2022-08-14 22:59:28 +00:00
|
|
|
p = Instantiate(HitParticles[0], HitPosition[5].position, Quaternion.identity, game.ItemHolder);
|
2022-07-31 01:16:48 +00:00
|
|
|
p.Play();
|
2022-08-14 22:59:28 +00:00
|
|
|
p = Instantiate(HitParticles[1], HitPosition[5].position, Quaternion.Euler(0, 0, UnityEngine.Random.Range(0f, 360f)), game.ItemHolder);
|
2022-07-31 01:16:48 +00:00
|
|
|
p.Play();
|
2022-07-29 16:18:17 +00:00
|
|
|
break;
|
2022-07-29 19:26:59 +00:00
|
|
|
case ItemType.KickBarrel:
|
2022-08-15 00:47:13 +00:00
|
|
|
if (KickBarrelContent)
|
|
|
|
game.CreateItemInstance(startBeat + 1f, "Item03", OnHitExpression, ItemType.KickBall);
|
|
|
|
else
|
|
|
|
{
|
|
|
|
game.Joe.ApplyBombGlow();
|
|
|
|
game.CreateItemInstance(startBeat + 1f, "Item04", OnHitExpression, ItemType.KickBomb);
|
|
|
|
}
|
2022-07-29 19:26:59 +00:00
|
|
|
Jukebox.PlayOneShotGame("karateman/barrelBreak", forcePlay: true);
|
2022-08-14 22:59:28 +00:00
|
|
|
p = Instantiate(HitParticles[0], HitPosition[1].position, Quaternion.Euler(0, 0, -5f), game.ItemHolder);
|
2022-07-31 01:16:48 +00:00
|
|
|
p.Play();
|
2022-08-14 22:59:28 +00:00
|
|
|
p = Instantiate(HitParticles[1], HitPosition[1].position, Quaternion.Euler(0, 0, UnityEngine.Random.Range(0f, 360f)), game.ItemHolder);
|
2022-07-31 01:16:48 +00:00
|
|
|
p.Play();
|
2022-08-14 22:59:28 +00:00
|
|
|
|
2022-07-31 01:16:48 +00:00
|
|
|
break;
|
|
|
|
case ItemType.KickBomb:
|
|
|
|
Jukebox.PlayOneShotGame("karateman/bombKick", forcePlay: true);
|
2022-08-14 22:59:28 +00:00
|
|
|
p = Instantiate(HitParticles[2], ItemCurves[6].GetPoint(0.5f), Quaternion.identity, game.ItemHolder);
|
2022-08-03 20:14:37 +00:00
|
|
|
p.Play();
|
2022-08-14 22:59:28 +00:00
|
|
|
|
|
|
|
game.Joe.RemoveBombGlow(startBeat + 0.75f);
|
2022-07-29 19:26:59 +00:00
|
|
|
break;
|
2022-08-15 00:47:13 +00:00
|
|
|
case ItemType.KickBall:
|
|
|
|
Jukebox.PlayOneShotGame("karateman/bombKick", forcePlay: true);
|
|
|
|
p = Instantiate(HitParticles[1], ItemCurves[6].GetPoint(0.5f), Quaternion.identity, game.ItemHolder);
|
|
|
|
p.Play();
|
|
|
|
break;
|
2022-07-29 16:18:17 +00:00
|
|
|
default:
|
2022-07-30 02:25:48 +00:00
|
|
|
CurrentCurve = ItemCurves[straight ? 1 : 0];
|
2022-08-07 23:40:06 +00:00
|
|
|
curveTargetBeat = straight ? 1f : 1.5f;
|
2022-08-18 16:12:02 +00:00
|
|
|
if (game.IsNoriActive && game.NoriPerformance < 0.6f)
|
|
|
|
{
|
|
|
|
Jukebox.PlayOneShotGame("karateman/potHit_lowNori", forcePlay: true);
|
|
|
|
Jukebox.PlayOneShotGame("karateman/potHit", volume: 0.66f, forcePlay: true);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
Jukebox.PlayOneShotGame("karateman/potHit", forcePlay: true);
|
2022-08-14 22:59:28 +00:00
|
|
|
p = Instantiate(HitParticles[3], HitPosition[1].position, Quaternion.identity, game.ItemHolder);
|
2022-08-03 20:14:37 +00:00
|
|
|
p.Play();
|
2022-08-18 16:12:02 +00:00
|
|
|
|
2022-07-29 16:18:17 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
2022-07-31 01:16:48 +00:00
|
|
|
startBeat = Conductor.instance.songPositionInBeats;
|
2022-07-29 16:18:17 +00:00
|
|
|
status = FlyStatus.Hit;
|
|
|
|
}
|
|
|
|
|
|
|
|
int ItemPunchHand()
|
|
|
|
{
|
|
|
|
switch (type)
|
|
|
|
{
|
|
|
|
case ItemType.Rock:
|
|
|
|
case ItemType.Ball:
|
|
|
|
case ItemType.Cooking:
|
|
|
|
case ItemType.Alien:
|
|
|
|
case ItemType.TacoBell:
|
2022-08-15 00:47:13 +00:00
|
|
|
case ItemType.Bomb:
|
2022-07-29 19:26:59 +00:00
|
|
|
case ItemType.KickBarrel:
|
2022-07-29 16:18:17 +00:00
|
|
|
return 2;
|
|
|
|
default:
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2022-08-15 00:47:13 +00:00
|
|
|
bool ItemKickable()
|
|
|
|
{
|
|
|
|
switch (type)
|
|
|
|
{
|
|
|
|
case ItemType.KickBomb:
|
|
|
|
case ItemType.KickBall:
|
|
|
|
return true;
|
|
|
|
default:
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2022-08-18 16:12:02 +00:00
|
|
|
bool ItemNeedNori()
|
|
|
|
{
|
|
|
|
switch (type)
|
|
|
|
{
|
|
|
|
case ItemType.Rock:
|
|
|
|
case ItemType.Cooking:
|
|
|
|
case ItemType.Alien:
|
|
|
|
case ItemType.Bomb:
|
|
|
|
case ItemType.TacoBell:
|
|
|
|
return true;
|
|
|
|
default:
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2022-07-29 02:09:48 +00:00
|
|
|
void JoeComboSequence()
|
|
|
|
{
|
2022-07-29 19:06:22 +00:00
|
|
|
if (GameManager.instance.currentGame != "karateman") return;
|
|
|
|
var joe = KarateMan.instance.Joe;
|
2022-07-29 02:09:48 +00:00
|
|
|
if (joe.GetShouldComboId() != comboId || !joe.inCombo) return;
|
|
|
|
switch (type)
|
|
|
|
{
|
|
|
|
case ItemType.ComboPot2:
|
|
|
|
joe.Punch(2);
|
|
|
|
if (joe.GetComboId() != comboId)
|
|
|
|
Jukebox.PlayOneShotGame("karateman/swingNoHit_Alt", forcePlay: true);
|
|
|
|
else
|
|
|
|
{
|
2022-07-29 16:18:17 +00:00
|
|
|
ItemHitEffect();
|
2022-07-29 02:09:48 +00:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
case ItemType.ComboPot3:
|
|
|
|
joe.ComboSequence(0);
|
|
|
|
if (joe.GetComboId() != comboId) {}
|
|
|
|
else
|
|
|
|
{
|
2022-07-29 16:18:17 +00:00
|
|
|
ItemHitEffect();
|
2022-07-29 02:09:48 +00:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
case ItemType.ComboPot4:
|
|
|
|
//if the button isn't held anymore make Joe spin
|
|
|
|
if (joe.GetComboId() != comboId) {
|
|
|
|
joe.ComboMiss(startBeat + 1f);
|
|
|
|
Jukebox.PlayOneShotGame("karateman/comboMiss", forcePlay: true);
|
|
|
|
joe.SetShouldComboId(-2);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
joe.ComboSequence(1);
|
2022-07-29 19:06:22 +00:00
|
|
|
joe.lockedInCombo = true;
|
2022-07-29 16:18:17 +00:00
|
|
|
ItemHitEffect();
|
2022-07-29 02:09:48 +00:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
case ItemType.ComboPot5:
|
|
|
|
joe.ComboSequence(2);
|
|
|
|
if (joe.GetComboId() != comboId) {}
|
|
|
|
else
|
|
|
|
{
|
2022-07-29 16:18:17 +00:00
|
|
|
ItemHitEffect();
|
2022-07-29 02:09:48 +00:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2022-08-15 00:47:13 +00:00
|
|
|
void DoHitExpression(float offset)
|
|
|
|
{
|
|
|
|
if (OnHitExpression == (int) KarateMan.KarateManFaces.Normal)
|
|
|
|
return;
|
|
|
|
var joe = KarateMan.instance.Joe;
|
|
|
|
BeatAction.New(joe.gameObject, new List<BeatAction.Action>()
|
|
|
|
{
|
|
|
|
new BeatAction.Action(offset, delegate {
|
|
|
|
joe.SetFaceExpression(OnHitExpression);
|
|
|
|
}),
|
|
|
|
new BeatAction.Action(offset + 2f, delegate {
|
|
|
|
joe.SetFaceExpression((int) KarateMan.KarateManFaces.Normal);
|
|
|
|
})
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
2022-07-28 23:12:21 +00:00
|
|
|
public void ItemJustOrNg(PlayerActionEvent caller, float state)
|
|
|
|
{
|
2022-07-29 19:06:22 +00:00
|
|
|
if (GameManager.instance.currentGame != "karateman") return;
|
|
|
|
var joe = KarateMan.instance.Joe;
|
2022-08-13 01:06:41 +00:00
|
|
|
if (status == FlyStatus.Fly && !(joe.inCombo || joe.inNuriLock)) {
|
2022-07-28 23:12:21 +00:00
|
|
|
if (state <= -1f || state >= 1f) {
|
2022-08-13 01:06:41 +00:00
|
|
|
bool straight = joe.Punch(ItemPunchHand());
|
2022-07-31 01:16:48 +00:00
|
|
|
startBeat = Conductor.instance.songPositionInBeats;
|
|
|
|
CurrentCurve = ItemCurves[6];
|
|
|
|
curveTargetBeat = 1f;
|
2022-07-28 23:12:21 +00:00
|
|
|
Jukebox.PlayOneShot("miss");
|
|
|
|
status = FlyStatus.NG;
|
2022-08-07 23:40:06 +00:00
|
|
|
|
2022-08-06 02:37:06 +00:00
|
|
|
joe.SetFaceExpression((int) KarateMan.KarateManFaces.Sad);
|
2022-08-07 23:40:06 +00:00
|
|
|
BeatAction.New(joe.gameObject, new List<BeatAction.Action>()
|
|
|
|
{
|
|
|
|
new BeatAction.Action(startBeat + 2f, delegate {
|
|
|
|
joe.SetFaceExpression((int) KarateMan.KarateManFaces.Normal);
|
|
|
|
}),
|
|
|
|
});
|
2022-08-13 01:06:41 +00:00
|
|
|
|
|
|
|
KarateMan.instance.Nori.DoNG();
|
2022-07-28 23:12:21 +00:00
|
|
|
}
|
|
|
|
else {
|
2022-08-13 01:06:41 +00:00
|
|
|
if (KarateMan.instance.IsNoriActive)
|
|
|
|
{
|
2022-08-18 16:12:02 +00:00
|
|
|
if (ItemNeedNori() && KarateMan.instance.NoriPerformance < 0.6f)
|
2022-08-13 01:06:41 +00:00
|
|
|
{
|
|
|
|
CreateHitMark(false);
|
|
|
|
startBeat = Conductor.instance.songPositionInBeats;
|
|
|
|
status = FlyStatus.HitWeak;
|
|
|
|
Jukebox.PlayOneShotGame("karateman/hitNoNori", forcePlay: true);
|
|
|
|
joe.Punch(3);
|
|
|
|
transform.rotation = Quaternion.Euler(0, 0, transform.rotation.eulerAngles.z - 30f);
|
|
|
|
KarateMan.instance.Nori.DoNG();
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
bool straight = joe.Punch(ItemPunchHand());
|
2022-08-15 00:47:13 +00:00
|
|
|
DoHitExpression(startBeat + 1f);
|
2022-07-30 02:25:48 +00:00
|
|
|
ItemHitEffect(straight);
|
2022-07-28 23:12:21 +00:00
|
|
|
status = FlyStatus.Hit;
|
2022-08-13 01:06:41 +00:00
|
|
|
KarateMan.instance.Nori.DoHit();
|
2022-07-28 23:12:21 +00:00
|
|
|
}
|
|
|
|
}
|
2022-08-14 04:34:19 +00:00
|
|
|
OnHit.CanHit(false);
|
|
|
|
OnHitWrongAction.CanHit(false);
|
2022-07-28 23:12:21 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
public void ItemWrongAction(PlayerActionEvent caller, float state)
|
|
|
|
{
|
2022-07-29 19:06:22 +00:00
|
|
|
if (GameManager.instance.currentGame != "karateman") return;
|
2022-08-14 21:39:42 +00:00
|
|
|
if (!KarateMan.IsComboEnable) return;
|
2022-07-28 23:12:21 +00:00
|
|
|
//hitting a normal object with the alt input
|
2022-07-29 16:18:17 +00:00
|
|
|
//WHEN SCORING THIS IS A MISS
|
2022-07-29 19:06:22 +00:00
|
|
|
var joe = KarateMan.instance.Joe;
|
2022-08-13 01:06:41 +00:00
|
|
|
if (status == FlyStatus.Fly && !(joe.inCombo || joe.inNuriLock)) {
|
2022-07-29 16:18:17 +00:00
|
|
|
joe.ForceFailCombo(Conductor.instance.songPositionInBeats);
|
|
|
|
if (state <= -1f || state >= 1f) {
|
2022-07-31 01:16:48 +00:00
|
|
|
startBeat = Conductor.instance.songPositionInBeats;
|
|
|
|
CurrentCurve = ItemCurves[6];
|
|
|
|
curveTargetBeat = 1f;
|
2022-07-29 16:18:17 +00:00
|
|
|
Jukebox.PlayOneShot("miss");
|
|
|
|
status = FlyStatus.NG;
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
ItemHitEffect();
|
|
|
|
}
|
2022-08-07 23:40:06 +00:00
|
|
|
|
|
|
|
BeatAction.New(joe.gameObject, new List<BeatAction.Action>()
|
|
|
|
{
|
|
|
|
new BeatAction.Action(startBeat + 4f, delegate {
|
|
|
|
joe.SetFaceExpression((int) KarateMan.KarateManFaces.Sad);
|
|
|
|
}),
|
|
|
|
new BeatAction.Action(startBeat + 6f, delegate {
|
|
|
|
joe.SetFaceExpression((int) KarateMan.KarateManFaces.Normal);
|
|
|
|
}),
|
|
|
|
});
|
2022-08-13 01:06:41 +00:00
|
|
|
KarateMan.instance.Nori.DoThrough();
|
2022-07-29 16:18:17 +00:00
|
|
|
}
|
2022-08-14 04:34:19 +00:00
|
|
|
OnHit.CanHit(false);
|
|
|
|
OnHitWrongAction.CanHit(false);
|
2022-07-28 23:12:21 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
public void ItemOut(PlayerActionEvent caller) {}
|
|
|
|
|
|
|
|
public void ItemThrough(PlayerActionEvent caller)
|
|
|
|
{
|
2022-08-07 23:40:06 +00:00
|
|
|
var joe = KarateMan.instance.Joe;
|
2022-07-29 19:06:22 +00:00
|
|
|
if (GameManager.instance.currentGame != "karateman") return;
|
2022-07-29 16:18:17 +00:00
|
|
|
if (status != FlyStatus.Fly || gameObject == null) return;
|
2022-08-07 23:40:06 +00:00
|
|
|
BeatAction.New(joe.gameObject, new List<BeatAction.Action>()
|
2022-07-28 23:12:21 +00:00
|
|
|
{
|
|
|
|
new BeatAction.Action(startBeat + 2f, delegate {
|
2022-08-07 23:40:06 +00:00
|
|
|
joe.SetFaceExpression((int) KarateMan.KarateManFaces.Surprise);
|
2022-08-13 01:06:41 +00:00
|
|
|
Jukebox.PlayOneShotGame("karateman/karate_through", forcePlay: true);
|
2022-08-07 23:40:06 +00:00
|
|
|
}),
|
2022-08-15 00:47:13 +00:00
|
|
|
new BeatAction.Action(startBeat + 5f, delegate {
|
2022-08-07 23:40:06 +00:00
|
|
|
if (joe.wantFace == -1)
|
|
|
|
joe.SetFaceExpression((int) KarateMan.KarateManFaces.Normal);
|
|
|
|
}),
|
2022-07-28 23:12:21 +00:00
|
|
|
});
|
2022-08-13 01:06:41 +00:00
|
|
|
KarateMan.instance.Nori.DoThrough();
|
2022-08-14 04:34:19 +00:00
|
|
|
OnHit.CanHit(false);
|
|
|
|
OnHitWrongAction.CanHit(false);
|
2022-07-28 23:12:21 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
public void ComboStartJustOrNg(PlayerActionEvent caller, float state)
|
|
|
|
{
|
2022-07-29 19:06:22 +00:00
|
|
|
if (GameManager.instance.currentGame != "karateman") return;
|
|
|
|
var joe = KarateMan.instance.Joe;
|
2022-08-13 01:06:41 +00:00
|
|
|
if (status == FlyStatus.Fly && !(joe.inKick || joe.wantKick || joe.inCombo || joe.inNuriLock)) {
|
2022-07-29 02:09:48 +00:00
|
|
|
joe.inCombo = true;
|
|
|
|
joe.Punch(1);
|
|
|
|
joe.SetComboId(comboId);
|
|
|
|
joe.SetShouldComboId(comboId);
|
2022-07-28 23:12:21 +00:00
|
|
|
if (state <= -1f || state >= 1f) {
|
2022-07-31 01:16:48 +00:00
|
|
|
startBeat = Conductor.instance.songPositionInBeats;
|
|
|
|
CurrentCurve = ItemCurves[6];
|
|
|
|
curveTargetBeat = 1f;
|
2022-07-28 23:12:21 +00:00
|
|
|
Jukebox.PlayOneShot("miss");
|
|
|
|
status = FlyStatus.NG;
|
2022-08-13 01:06:41 +00:00
|
|
|
|
|
|
|
KarateMan.instance.Nori.DoNG();
|
2022-07-28 23:12:21 +00:00
|
|
|
}
|
|
|
|
else {
|
2022-07-29 16:18:17 +00:00
|
|
|
ItemHitEffect();
|
2022-08-13 01:06:41 +00:00
|
|
|
KarateMan.instance.Nori.DoHit();
|
2022-07-28 23:12:21 +00:00
|
|
|
}
|
|
|
|
}
|
2022-08-14 04:34:19 +00:00
|
|
|
OnHit.CanHit(false);
|
|
|
|
OnHitWrongAction.CanHit(false);
|
2022-07-28 23:12:21 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
public void ComboStartOut(PlayerActionEvent caller) {}
|
2022-07-29 16:18:17 +00:00
|
|
|
public void ComboStartThrough(PlayerActionEvent caller)
|
|
|
|
{
|
2022-08-07 23:40:06 +00:00
|
|
|
var joe = KarateMan.instance.Joe;
|
2022-08-06 02:37:06 +00:00
|
|
|
if (GameManager.instance.currentGame != "karateman") return;
|
2022-07-29 16:18:17 +00:00
|
|
|
if (status != FlyStatus.Fly || gameObject == null) return;
|
2022-08-07 23:40:06 +00:00
|
|
|
BeatAction.New(joe.gameObject, new List<BeatAction.Action>()
|
2022-08-06 02:37:06 +00:00
|
|
|
{
|
2022-08-13 01:06:41 +00:00
|
|
|
new BeatAction.Action(startBeat + 2f, delegate {
|
2022-08-07 23:40:06 +00:00
|
|
|
joe.SetFaceExpression((int) KarateMan.KarateManFaces.Surprise);
|
2022-08-13 01:06:41 +00:00
|
|
|
Jukebox.PlayOneShotGame("karateman/karate_through", forcePlay: true);
|
2022-08-07 23:40:06 +00:00
|
|
|
}),
|
2022-08-15 00:47:13 +00:00
|
|
|
new BeatAction.Action(startBeat + 5f, delegate {
|
2022-08-07 23:40:06 +00:00
|
|
|
if (joe.wantFace == -1)
|
|
|
|
joe.SetFaceExpression((int) KarateMan.KarateManFaces.Normal);
|
|
|
|
}),
|
2022-08-06 02:37:06 +00:00
|
|
|
});
|
2022-08-13 01:06:41 +00:00
|
|
|
KarateMan.instance.Nori.DoThrough();
|
2022-08-14 04:34:19 +00:00
|
|
|
OnHit.CanHit(false);
|
|
|
|
OnHitWrongAction.CanHit(false);
|
2022-07-29 16:18:17 +00:00
|
|
|
}
|
2022-07-28 23:12:21 +00:00
|
|
|
|
|
|
|
public void ComboStartWrongAction(PlayerActionEvent caller, float state)
|
|
|
|
{
|
2022-07-29 19:06:22 +00:00
|
|
|
if (GameManager.instance.currentGame != "karateman") return;
|
2022-07-29 16:18:17 +00:00
|
|
|
//hitting a combo start with the normal input
|
|
|
|
//WHEN SCORING THIS IS A MISS
|
2022-07-29 19:06:22 +00:00
|
|
|
var joe = KarateMan.instance.Joe;
|
2022-08-13 01:06:41 +00:00
|
|
|
if (status == FlyStatus.Fly && !(joe.inCombo || joe.inNuriLock)) {
|
2022-07-30 02:25:48 +00:00
|
|
|
bool straight = joe.Punch(ItemPunchHand());
|
2022-07-29 16:18:17 +00:00
|
|
|
if (state <= -1f || state >= 1f) {
|
2022-07-31 01:16:48 +00:00
|
|
|
startBeat = Conductor.instance.songPositionInBeats;
|
|
|
|
CurrentCurve = ItemCurves[6];
|
|
|
|
curveTargetBeat = 1f;
|
2022-07-29 16:18:17 +00:00
|
|
|
Jukebox.PlayOneShot("miss");
|
|
|
|
status = FlyStatus.NG;
|
|
|
|
}
|
|
|
|
else {
|
2022-07-30 02:25:48 +00:00
|
|
|
ItemHitEffect(straight);
|
2022-07-29 16:18:17 +00:00
|
|
|
}
|
2022-08-13 01:06:41 +00:00
|
|
|
KarateMan.instance.Nori.DoThrough();
|
2022-07-29 16:18:17 +00:00
|
|
|
}
|
2022-08-14 04:34:19 +00:00
|
|
|
OnHit.CanHit(false);
|
|
|
|
OnHitWrongAction.CanHit(false);
|
2022-07-28 23:12:21 +00:00
|
|
|
}
|
2022-07-29 02:09:48 +00:00
|
|
|
|
|
|
|
public void ComboEndJustOrNg(PlayerActionEvent caller, float state)
|
|
|
|
{
|
2022-07-29 19:06:22 +00:00
|
|
|
if (GameManager.instance.currentGame != "karateman") return;
|
|
|
|
var joe = KarateMan.instance.Joe;
|
2022-07-29 02:09:48 +00:00
|
|
|
if (status == FlyStatus.Fly && joe.inCombo && joe.GetComboId() == comboId) {
|
|
|
|
joe.inCombo = false;
|
|
|
|
joe.SetComboId(-1);
|
|
|
|
joe.SetShouldComboId(-1);
|
2022-07-29 16:18:17 +00:00
|
|
|
joe.ComboSequence(3);
|
2022-07-29 02:09:48 +00:00
|
|
|
if (state <= -1f || state >= 1f) {
|
2022-07-31 01:16:48 +00:00
|
|
|
startBeat = Conductor.instance.songPositionInBeats;
|
|
|
|
CurrentCurve = ItemCurves[5];
|
|
|
|
curveTargetBeat = 1f;
|
2022-07-29 02:09:48 +00:00
|
|
|
Jukebox.PlayOneShot("miss");
|
|
|
|
status = FlyStatus.NG;
|
2022-08-06 02:37:06 +00:00
|
|
|
|
|
|
|
BeatAction.New(joe.gameObject, new List<BeatAction.Action>()
|
|
|
|
{
|
|
|
|
new BeatAction.Action(startBeat + 2f, delegate {
|
|
|
|
joe.SetFaceExpression((int) KarateMan.KarateManFaces.Sad);
|
2022-08-07 23:40:06 +00:00
|
|
|
}),
|
|
|
|
new BeatAction.Action(startBeat + 6f, delegate {
|
|
|
|
joe.SetFaceExpression((int) KarateMan.KarateManFaces.Normal);
|
|
|
|
}),
|
2022-08-06 02:37:06 +00:00
|
|
|
});
|
2022-08-13 01:06:41 +00:00
|
|
|
|
|
|
|
KarateMan.instance.Nori.DoNG();
|
2022-07-29 02:09:48 +00:00
|
|
|
}
|
|
|
|
else {
|
2022-08-15 00:47:13 +00:00
|
|
|
DoHitExpression(startBeat + 1.5f);
|
2022-07-29 16:18:17 +00:00
|
|
|
ItemHitEffect();
|
2022-08-13 01:06:41 +00:00
|
|
|
KarateMan.instance.Nori.DoHit();
|
2022-07-29 02:09:48 +00:00
|
|
|
}
|
|
|
|
}
|
2022-08-14 04:34:19 +00:00
|
|
|
OnHit.CanHit(false);
|
2022-07-29 02:09:48 +00:00
|
|
|
}
|
|
|
|
|
2022-08-08 00:24:07 +00:00
|
|
|
public void ComboEndOut(PlayerActionEvent caller) {
|
|
|
|
if (GameManager.instance.currentGame != "karateman") return;
|
|
|
|
var joe = KarateMan.instance.Joe;
|
|
|
|
if (status == FlyStatus.Fly && joe.inCombo && joe.GetComboId() == comboId && joe.comboWaiting)
|
|
|
|
{
|
|
|
|
joe.inCombo = false;
|
|
|
|
joe.SetComboId(-1);
|
|
|
|
joe.SetShouldComboId(-1);
|
|
|
|
joe.ComboSequence(3);
|
|
|
|
Jukebox.PlayOneShotGame("karateman/swingKick", forcePlay: true);
|
|
|
|
}
|
2022-08-14 04:34:19 +00:00
|
|
|
OnHit.CanHit(false);
|
2022-08-08 00:24:07 +00:00
|
|
|
}
|
|
|
|
|
2022-07-29 16:18:17 +00:00
|
|
|
public void ComboEndThrough(PlayerActionEvent caller)
|
|
|
|
{
|
2022-07-29 19:06:22 +00:00
|
|
|
if (GameManager.instance.currentGame != "karateman") return;
|
2022-07-29 16:18:17 +00:00
|
|
|
if (status != FlyStatus.Fly || gameObject == null) return;
|
2022-07-29 19:06:22 +00:00
|
|
|
var joe = KarateMan.instance.Joe;
|
2022-08-06 02:37:06 +00:00
|
|
|
if (joe.GetComboId() != comboId || !joe.inCombo)
|
2022-07-29 16:18:17 +00:00
|
|
|
{
|
2022-08-06 02:37:06 +00:00
|
|
|
BeatAction.New(joe.gameObject, new List<BeatAction.Action>()
|
|
|
|
{
|
|
|
|
new BeatAction.Action(startBeat + 2f, delegate {
|
|
|
|
joe.SetFaceExpression((int) KarateMan.KarateManFaces.Surprise);
|
2022-08-07 23:40:06 +00:00
|
|
|
}),
|
2022-08-15 00:47:13 +00:00
|
|
|
new BeatAction.Action(startBeat + 5f, delegate {
|
2022-08-07 23:40:06 +00:00
|
|
|
if (joe.wantFace == -1)
|
|
|
|
joe.SetFaceExpression((int) KarateMan.KarateManFaces.Normal);
|
|
|
|
}),
|
2022-08-06 02:37:06 +00:00
|
|
|
});
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2022-08-07 23:40:06 +00:00
|
|
|
joe.SetFaceExpression((int) KarateMan.KarateManFaces.VerySad);
|
2022-08-06 02:37:06 +00:00
|
|
|
BeatAction.New(joe.gameObject, new List<BeatAction.Action>()
|
|
|
|
{
|
|
|
|
new BeatAction.Action(startBeat + 1.5f, delegate {
|
|
|
|
joe.inCombo = false;
|
|
|
|
joe.SetComboId(-1);
|
|
|
|
joe.SetShouldComboId(-1);
|
|
|
|
joe.ComboSequence(4);
|
|
|
|
}),
|
2022-08-07 23:40:06 +00:00
|
|
|
new BeatAction.Action(startBeat + 2f, delegate {
|
2022-08-06 02:37:06 +00:00
|
|
|
joe.SetFaceExpression((int) KarateMan.KarateManFaces.VerySad);
|
2022-08-07 23:40:06 +00:00
|
|
|
}),
|
|
|
|
new BeatAction.Action(startBeat + 5f, delegate {
|
|
|
|
joe.SetFaceExpression((int) KarateMan.KarateManFaces.Normal);
|
2022-08-06 02:37:06 +00:00
|
|
|
})
|
|
|
|
});
|
|
|
|
}
|
2022-08-13 01:06:41 +00:00
|
|
|
KarateMan.instance.Nori.DoThrough();
|
2022-08-14 04:34:19 +00:00
|
|
|
OnHit.CanHit(false);
|
2022-07-29 16:18:17 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
public void ComboEndWrongAction(PlayerActionEvent caller, float state)
|
|
|
|
{
|
2022-07-29 19:06:22 +00:00
|
|
|
if (GameManager.instance.currentGame != "karateman") return;
|
2022-08-13 01:06:41 +00:00
|
|
|
if (!(KarateMan.instance.Joe.inCombo || KarateMan.instance.Joe.inNuriLock))
|
|
|
|
KarateMan.instance.Joe.Punch(1);
|
2022-07-29 16:18:17 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
public void ComboEndWrongActionAlt(PlayerActionEvent caller, float state)
|
|
|
|
{
|
2022-07-29 19:06:22 +00:00
|
|
|
if (GameManager.instance.currentGame != "karateman") return;
|
2022-08-14 21:39:42 +00:00
|
|
|
if (KarateMan.IsComboEnable && !(KarateMan.instance.Joe.inCombo || KarateMan.instance.Joe.inNuriLock))
|
2022-08-13 01:06:41 +00:00
|
|
|
KarateMan.instance.Joe.ForceFailCombo(Conductor.instance.songPositionInBeats);
|
2022-07-29 16:18:17 +00:00
|
|
|
}
|
2022-07-30 02:25:48 +00:00
|
|
|
|
|
|
|
public void KickChargeJustOrNg(PlayerActionEvent caller, float state)
|
|
|
|
{
|
|
|
|
if (GameManager.instance.currentGame != "karateman") return;
|
|
|
|
var joe = KarateMan.instance.Joe;
|
2022-08-13 01:06:41 +00:00
|
|
|
if (status == FlyStatus.Fly && !(joe.inKick || joe.wantKick || joe.inCombo || joe.inNuriLock)) {
|
2022-07-30 02:25:48 +00:00
|
|
|
joe.Punch(ItemPunchHand());
|
|
|
|
if (state <= -1f || state >= 1f) {
|
2022-07-31 01:16:48 +00:00
|
|
|
startBeat = Conductor.instance.songPositionInBeats;
|
|
|
|
CurrentCurve = ItemCurves[6];
|
|
|
|
curveTargetBeat = 1f;
|
2022-07-30 02:25:48 +00:00
|
|
|
Jukebox.PlayOneShot("miss");
|
|
|
|
status = FlyStatus.NG;
|
2022-08-07 23:40:06 +00:00
|
|
|
|
|
|
|
joe.SetFaceExpression((int) KarateMan.KarateManFaces.Sad);
|
|
|
|
BeatAction.New(joe.gameObject, new List<BeatAction.Action>()
|
|
|
|
{
|
|
|
|
new BeatAction.Action(startBeat + 2f, delegate {
|
|
|
|
joe.SetFaceExpression((int) KarateMan.KarateManFaces.Normal);
|
|
|
|
}),
|
|
|
|
});
|
2022-08-13 01:06:41 +00:00
|
|
|
KarateMan.instance.Nori.DoNG();
|
2022-07-30 02:25:48 +00:00
|
|
|
}
|
|
|
|
else {
|
|
|
|
joe.StartKickCharge(startBeat + 1.25f);
|
|
|
|
ItemHitEffect();
|
|
|
|
status = FlyStatus.Hit;
|
2022-08-13 01:06:41 +00:00
|
|
|
KarateMan.instance.Nori.DoHit();
|
2022-07-30 02:25:48 +00:00
|
|
|
}
|
|
|
|
}
|
2022-08-14 04:34:19 +00:00
|
|
|
OnHit.CanHit(false);
|
|
|
|
OnHitWrongAction.CanHit(false);
|
2022-07-30 02:25:48 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
public void KickChargeOut(PlayerActionEvent caller) {}
|
|
|
|
|
|
|
|
public void KickChargeThrough(PlayerActionEvent caller)
|
|
|
|
{
|
2022-08-06 02:37:06 +00:00
|
|
|
var joe = KarateMan.instance.Joe;
|
2022-07-30 02:25:48 +00:00
|
|
|
if (GameManager.instance.currentGame != "karateman") return;
|
|
|
|
if (status != FlyStatus.Fly || gameObject == null) return;
|
2022-08-06 02:37:06 +00:00
|
|
|
BeatAction.New(joe.gameObject, new List<BeatAction.Action>()
|
2022-07-30 02:25:48 +00:00
|
|
|
{
|
2022-08-13 01:06:41 +00:00
|
|
|
new BeatAction.Action(startBeat + 2f, delegate {
|
2022-08-06 02:37:06 +00:00
|
|
|
joe.SetFaceExpression((int) KarateMan.KarateManFaces.Surprise);
|
2022-08-13 01:06:41 +00:00
|
|
|
Jukebox.PlayOneShotGame("karateman/karate_through", forcePlay: true);
|
2022-08-07 23:40:06 +00:00
|
|
|
}),
|
2022-08-15 00:47:13 +00:00
|
|
|
new BeatAction.Action(startBeat + 5f, delegate {
|
2022-08-07 23:40:06 +00:00
|
|
|
if (joe.wantFace == -1)
|
|
|
|
joe.SetFaceExpression((int) KarateMan.KarateManFaces.Normal);
|
|
|
|
}),
|
2022-07-30 02:25:48 +00:00
|
|
|
});
|
2022-08-13 01:06:41 +00:00
|
|
|
KarateMan.instance.Nori.DoThrough();
|
2022-08-14 04:34:19 +00:00
|
|
|
OnHit.CanHit(false);
|
|
|
|
OnHitWrongAction.CanHit(false);
|
2022-07-30 02:25:48 +00:00
|
|
|
}
|
2022-07-31 01:16:48 +00:00
|
|
|
|
|
|
|
public void KickJustOrNg(PlayerActionEvent caller, float state)
|
|
|
|
{
|
|
|
|
if (GameManager.instance.currentGame != "karateman") return;
|
|
|
|
var joe = KarateMan.instance.Joe;
|
|
|
|
if (status == FlyStatus.Fly && joe.inKick) {
|
|
|
|
joe.Kick(Conductor.instance.songPositionInBeats);
|
|
|
|
if (state <= -1f || state >= 1f) {
|
|
|
|
startBeat = Conductor.instance.songPositionInBeats;
|
|
|
|
CurrentCurve = ItemCurves[8];
|
|
|
|
curveTargetBeat = 1f;
|
|
|
|
Jukebox.PlayOneShot("miss");
|
|
|
|
status = FlyStatus.NG;
|
2022-08-07 23:40:06 +00:00
|
|
|
|
|
|
|
BeatAction.New(joe.gameObject, new List<BeatAction.Action>()
|
|
|
|
{
|
|
|
|
new BeatAction.Action(startBeat + 1.25f, delegate {
|
|
|
|
joe.SetFaceExpression((int) KarateMan.KarateManFaces.Sad);
|
|
|
|
}),
|
|
|
|
new BeatAction.Action(startBeat + 4.25f, delegate {
|
|
|
|
joe.SetFaceExpression((int) KarateMan.KarateManFaces.Normal);
|
|
|
|
}),
|
|
|
|
});
|
2022-08-13 01:06:41 +00:00
|
|
|
|
|
|
|
KarateMan.instance.Nori.DoNG();
|
2022-08-15 00:47:13 +00:00
|
|
|
if (type == ItemType.KickBomb)
|
|
|
|
joe.RemoveBombGlow(startBeat + 0.75f);
|
2022-07-31 01:16:48 +00:00
|
|
|
}
|
|
|
|
else {
|
2022-08-15 00:47:13 +00:00
|
|
|
DoHitExpression(startBeat + 2f);
|
2022-07-31 01:16:48 +00:00
|
|
|
ItemHitEffect();
|
|
|
|
status = FlyStatus.Hit;
|
|
|
|
CurrentCurve = ItemCurves[7];
|
|
|
|
startBeat = Conductor.instance.songPositionInBeats;
|
|
|
|
curveTargetBeat = 3f;
|
2022-08-13 01:06:41 +00:00
|
|
|
KarateMan.instance.Nori.DoHit();
|
2022-07-31 01:16:48 +00:00
|
|
|
}
|
|
|
|
}
|
2022-08-14 04:34:19 +00:00
|
|
|
OnHit.CanHit(false);
|
2022-07-31 01:16:48 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
public void KickOut(PlayerActionEvent caller) {}
|
|
|
|
|
|
|
|
public void KickThrough(PlayerActionEvent caller)
|
|
|
|
{
|
|
|
|
if (GameManager.instance.currentGame != "karateman") return;
|
|
|
|
if (status != FlyStatus.Fly || gameObject == null) return;
|
2022-08-06 02:37:06 +00:00
|
|
|
BeatAction.New(KarateMan.instance.Joe.gameObject, new List<BeatAction.Action>()
|
2022-07-31 01:16:48 +00:00
|
|
|
{
|
|
|
|
new BeatAction.Action(startBeat + 2f, delegate {
|
2022-08-06 02:37:06 +00:00
|
|
|
KarateMan.instance.Joe.SetFaceExpression((int) KarateMan.KarateManFaces.VerySad);
|
2022-08-15 00:47:13 +00:00
|
|
|
}),
|
|
|
|
new BeatAction.Action(startBeat + 4f, delegate {
|
|
|
|
KarateMan.instance.Joe.SetFaceExpression((int) KarateMan.KarateManFaces.Normal);
|
2022-07-31 01:16:48 +00:00
|
|
|
})
|
|
|
|
});
|
2022-08-13 01:06:41 +00:00
|
|
|
KarateMan.instance.Nori.DoThrough();
|
2022-08-14 04:34:19 +00:00
|
|
|
OnHit.CanHit(false);
|
2022-08-15 00:47:13 +00:00
|
|
|
if (type == ItemType.KickBomb)
|
|
|
|
KarateMan.instance.Joe.RemoveBombGlow(startBeat + 0.75f * 2, 1.5f);
|
2022-07-31 01:16:48 +00:00
|
|
|
}
|
2022-07-27 22:35:18 +00:00
|
|
|
}
|
|
|
|
}
|