mirror of
https://github.com/RHeavenStudio/HeavenStudio.git
synced 2025-06-12 08:37:37 +02:00
Merge pull request #143 from minenice55/karate-man-2
WIP Karate Man Rework
This commit is contained in:
@ -19,9 +19,9 @@ namespace HeavenStudio
|
||||
/**
|
||||
default cam position, for quick-resetting
|
||||
**/
|
||||
static Vector3 defaultPosition = new Vector3(0, 0, -10);
|
||||
static Vector3 defaultRotEluer = new Vector3(0, 0, 0);
|
||||
static Vector3 defaultScale = new Vector3(16, 9, 1);
|
||||
public static Vector3 defaultPosition = new Vector3(0, 0, -10);
|
||||
public static Vector3 defaultRotEluer = new Vector3(0, 0, 0);
|
||||
public static Vector3 defaultScale = new Vector3(16, 9, 1);
|
||||
|
||||
/**
|
||||
camera's current transformation
|
||||
|
@ -1,118 +0,0 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
using DG.Tweening;
|
||||
|
||||
namespace HeavenStudio.Games.Scripts_KarateMan
|
||||
{
|
||||
// Physics in Rhythm Heaven Mania? nah im just fuckin lazy
|
||||
public class BarrelDestroyEffect : MonoBehaviour
|
||||
{
|
||||
public SpriteRenderer SpriteRenderer;
|
||||
private Rigidbody2D rb2d;
|
||||
private BoxCollider2D col;
|
||||
public int spriteIndex;
|
||||
public int index;
|
||||
|
||||
public bool combo;
|
||||
|
||||
|
||||
public GameObject shadow;
|
||||
|
||||
public void Init()
|
||||
{
|
||||
SpriteRenderer = this.gameObject.GetComponent<SpriteRenderer>();
|
||||
SpriteRenderer.sprite = KarateMan.instance.BarrelSprites[spriteIndex];
|
||||
|
||||
rb2d = this.gameObject.AddComponent<Rigidbody2D>();
|
||||
rb2d.gravityScale = 11;
|
||||
rb2d.collisionDetectionMode = CollisionDetectionMode2D.Continuous;
|
||||
// rb2d.interpolation = RigidbodyInterpolation2D.Interpolate;
|
||||
|
||||
float yRange = 0;
|
||||
float xRange = Random.Range(500, 800);
|
||||
|
||||
switch (index)
|
||||
{
|
||||
case 0:
|
||||
yRange = Random.Range(400, 1500);
|
||||
break;
|
||||
case 1:
|
||||
yRange = Random.Range(200, 700);
|
||||
break;
|
||||
case 2:
|
||||
yRange = Random.Range(300, 1200);
|
||||
break;
|
||||
case 3:
|
||||
yRange = Random.Range(300, 1200);
|
||||
break;
|
||||
case 4:
|
||||
yRange = Random.Range(300, 1200);
|
||||
break;
|
||||
case 5:
|
||||
yRange = Random.Range(300, 1200);
|
||||
break;
|
||||
case 6:
|
||||
yRange = Random.Range(300, 1200);
|
||||
break;
|
||||
case 7:
|
||||
yRange = Random.Range(500, 1600);
|
||||
break;
|
||||
}
|
||||
if (combo)
|
||||
{
|
||||
yRange = Random.Range(800, 1600);
|
||||
xRange = Random.Range(200, 500);
|
||||
}
|
||||
|
||||
rb2d.AddForce(Vector3.up * yRange);
|
||||
rb2d.AddForce(Vector3.right * xRange);
|
||||
// this.gameObject.AddComponent<Rotate>().rotateSpeed = Random.Range(60, 450);
|
||||
|
||||
col = this.gameObject.AddComponent<BoxCollider2D>();
|
||||
|
||||
PhysicsMaterial2D mat = new PhysicsMaterial2D();
|
||||
mat.bounciness = 0;
|
||||
|
||||
col.sharedMaterial = mat;
|
||||
col.offset = new Vector2(-0.0574677f, -0.07480353f);
|
||||
col.size = new Vector2(0.5694333f, 1.912059f);
|
||||
|
||||
StartCoroutine(FadeOut());
|
||||
|
||||
gameObject.name = "barrel_p";
|
||||
}
|
||||
|
||||
private void OnCollisionEnter2D(Collision2D collision)
|
||||
{
|
||||
if (collision.gameObject.name != "barrel_p")
|
||||
{
|
||||
Destroy(rb2d);
|
||||
Destroy(col);
|
||||
}
|
||||
else
|
||||
{
|
||||
Physics2D.IgnoreCollision(collision.collider, col);
|
||||
}
|
||||
}
|
||||
|
||||
private void Update()
|
||||
{
|
||||
if (rb2d != null)
|
||||
this.transform.eulerAngles = new Vector3(0, 0, rb2d.velocity.magnitude * 4);
|
||||
|
||||
shadow.transform.localPosition = new Vector3(this.transform.localPosition.x, shadow.transform.localPosition.y);
|
||||
}
|
||||
|
||||
private IEnumerator FadeOut()
|
||||
{
|
||||
yield return new WaitForSeconds(Conductor.instance.secPerBeat * 3);
|
||||
var shadowSprite = shadow.GetComponent<SpriteRenderer>();
|
||||
var fadeColor = shadowSprite.color;
|
||||
fadeColor.a = 0;
|
||||
SpriteRenderer.DOColor(new Color(1, 1, 1, 0), Conductor.instance.secPerBeat * 3).OnComplete(delegate { Destroy(this.gameObject); });
|
||||
shadowSprite.DOColor(fadeColor, Conductor.instance.secPerBeat * 3).OnComplete(delegate { Destroy(shadow); });
|
||||
}
|
||||
}
|
||||
}
|
@ -1,143 +0,0 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
using HeavenStudio.Util;
|
||||
|
||||
namespace HeavenStudio.Games.Scripts_KarateMan
|
||||
{
|
||||
public class Bomb : PlayerActionObject
|
||||
{
|
||||
private Animator anim;
|
||||
|
||||
private float startBeat;
|
||||
private float hitBeat;
|
||||
private float missBeat;
|
||||
|
||||
public bool kicked;
|
||||
private bool missed;
|
||||
private bool eligible;
|
||||
|
||||
public GameObject Holder;
|
||||
public GameObject RotHolder;
|
||||
private Vector3 lastRot;
|
||||
|
||||
public GameObject shadow;
|
||||
private float shadowY;
|
||||
|
||||
[Header("Curves")]
|
||||
[SerializeField] private AnimationCurve outCurve;
|
||||
[SerializeField] private AnimationCurve shadowHitCurve;
|
||||
|
||||
private void Awake()
|
||||
{
|
||||
anim = GetComponent<Animator>();
|
||||
|
||||
startBeat = Conductor.instance.songPositionInBeats;
|
||||
eligible = true;
|
||||
|
||||
PlayerActionInit(this.gameObject, startBeat);
|
||||
}
|
||||
|
||||
public override void OnAce()
|
||||
{
|
||||
Hit();
|
||||
}
|
||||
|
||||
private void Update()
|
||||
{
|
||||
shadow.transform.localPosition = new Vector3(Holder.transform.localPosition.x, shadow.transform.localPosition.y);
|
||||
if (!kicked)
|
||||
{
|
||||
if (!missed)
|
||||
{
|
||||
float normalizedBeatAnim = Conductor.instance.GetPositionFromBeat(startBeat, 1.25f);
|
||||
|
||||
anim.Play("BombOut", 0, normalizedBeatAnim);
|
||||
anim.speed = 0;
|
||||
|
||||
float normalizedBeat = Conductor.instance.GetPositionFromBeat(startBeat, 0.75f);
|
||||
|
||||
StateCheckNoList(normalizedBeat);
|
||||
|
||||
RotHolder.transform.eulerAngles = new Vector3(0, 0, Mathf.Lerp(0, -90, outCurve.Evaluate(normalizedBeatAnim)));
|
||||
lastRot = RotHolder.transform.eulerAngles;
|
||||
|
||||
shadowY = shadow.transform.localPosition.y;
|
||||
|
||||
if (normalizedBeat > 1.5f)
|
||||
{
|
||||
eligible = false;
|
||||
// explode animation
|
||||
if (normalizedBeat > 4)
|
||||
Destroy(this.gameObject);
|
||||
}
|
||||
|
||||
|
||||
if (PlayerInput.PressedUp())
|
||||
{
|
||||
if (state.perfect)
|
||||
{
|
||||
Hit();
|
||||
}
|
||||
else
|
||||
{
|
||||
Miss();
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
float normalizedBeatAnim = Conductor.instance.GetPositionFromBeat(missBeat, 1f);
|
||||
anim.Play("BombMiss", 0, normalizedBeatAnim);
|
||||
anim.speed = 0;
|
||||
RotHolder.transform.eulerAngles = new Vector3(0, 0, Mathf.Lerp(lastRot.z, lastRot.z - 180, normalizedBeatAnim));
|
||||
|
||||
if (normalizedBeatAnim > 2)
|
||||
{
|
||||
Destroy(this.gameObject);
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
float normalizedBeatAnim = Conductor.instance.GetPositionFromBeat(hitBeat, 3f);
|
||||
anim.Play("BombHit", 0, normalizedBeatAnim);
|
||||
anim.speed = 0;
|
||||
|
||||
RotHolder.transform.eulerAngles = new Vector3(0, 0, Mathf.Lerp(lastRot.z, lastRot.z - 180, normalizedBeatAnim));
|
||||
|
||||
shadow.transform.localPosition = new Vector3(shadow.transform.localPosition.x, Mathf.Lerp(shadowY, 0.881f, shadowHitCurve.Evaluate(normalizedBeatAnim)));
|
||||
shadow.transform.localScale = Holder.transform.localScale;
|
||||
|
||||
if (normalizedBeatAnim > 1)
|
||||
{
|
||||
Destroy(this.gameObject);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void Hit()
|
||||
{
|
||||
KarateJoe.instance.HitEffectF(new Vector3(0.9f, 2.0549f));
|
||||
|
||||
Jukebox.PlayOneShotGame("karateman/bombKick");
|
||||
hitBeat = Conductor.instance.songPositionInBeats;
|
||||
kicked = true;
|
||||
RotHolder.transform.eulerAngles = lastRot;
|
||||
|
||||
KarateJoe.instance.ResetKick();
|
||||
KarateJoe.instance.AnimPlay("Kick");
|
||||
}
|
||||
|
||||
public void Miss()
|
||||
{
|
||||
missBeat = Conductor.instance.songPositionInBeats;
|
||||
missed = true;
|
||||
Jukebox.PlayOneShot("miss");
|
||||
|
||||
KarateJoe.instance.ResetKick();
|
||||
KarateJoe.instance.AnimPlay("Kick");
|
||||
}
|
||||
}
|
||||
}
|
@ -1,11 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: bb2c19bd0f31d1040925d1fc2dff960c
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@ -1,53 +0,0 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
using DG.Tweening;
|
||||
|
||||
namespace HeavenStudio.Games.Scripts_KarateMan
|
||||
{
|
||||
// Physics in Rhythm Heaven Mania? nah im just fuckin lazy
|
||||
public class CookingPotDestroyEffect : MonoBehaviour
|
||||
{
|
||||
public SpriteRenderer SpriteRenderer;
|
||||
public int spriteIndex;
|
||||
public int index;
|
||||
|
||||
private float rotationSpeed;
|
||||
|
||||
public GameObject pot;
|
||||
|
||||
private void Awake()
|
||||
{
|
||||
SpriteRenderer sr = gameObject.AddComponent<SpriteRenderer>();
|
||||
sr.sprite = KarateMan.instance.CookingPotSprites[1];
|
||||
|
||||
Rigidbody2D rb2d = gameObject.AddComponent<Rigidbody2D>();
|
||||
rb2d.gravityScale = 5;
|
||||
rb2d.collisionDetectionMode = CollisionDetectionMode2D.Continuous;
|
||||
|
||||
rb2d.AddForce(Vector3.up * Random.Range(875, 925));
|
||||
|
||||
rotationSpeed = Random.Range(100, 200);
|
||||
|
||||
PhysicsMaterial2D mat = new PhysicsMaterial2D();
|
||||
mat.bounciness = 0;
|
||||
|
||||
StartCoroutine(FadeOut());
|
||||
|
||||
gameObject.name = "cookingpot_lid";
|
||||
}
|
||||
|
||||
private void Update()
|
||||
{
|
||||
transform.eulerAngles -= new Vector3(0, 0, rotationSpeed * Time.deltaTime);
|
||||
transform.position = new Vector3(pot.transform.position.x, transform.position.y, transform.position.z);
|
||||
}
|
||||
|
||||
private IEnumerator FadeOut()
|
||||
{
|
||||
yield return new WaitForSeconds(Conductor.instance.secPerBeat * 3);
|
||||
Destroy(gameObject);
|
||||
}
|
||||
}
|
||||
}
|
@ -1,325 +0,0 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
using HeavenStudio.Util;
|
||||
|
||||
namespace HeavenStudio.Games.Scripts_KarateMan
|
||||
{
|
||||
public class KarateJoe : MonoBehaviour
|
||||
{
|
||||
|
||||
[Header("Components")]
|
||||
public Animator anim;
|
||||
public GameObject HitEffect;
|
||||
public GameObject BulbHit;
|
||||
[SerializeField] private SpriteRenderer head;
|
||||
[SerializeField] private Sprite[] heads;
|
||||
[SerializeField] private GameObject missEffect;
|
||||
[SerializeField] private SpriteRenderer[] shadows;
|
||||
|
||||
[Header("Properties")]
|
||||
public bool hitBarrel = false;
|
||||
public Coroutine kickC;
|
||||
public Coroutine missC;
|
||||
private float barrelBeat;
|
||||
public bool inCombo;
|
||||
public bool hitCombo;
|
||||
private float comboBeat;
|
||||
public List<Pot> currentComboPots = new List<Pot>();
|
||||
private int comboPotIndex;
|
||||
private int currentComboHitInList;
|
||||
private int comboIndex;
|
||||
public float comboNormalizedBeat = 0;
|
||||
|
||||
public static KarateJoe instance { get; set; }
|
||||
|
||||
private void Awake()
|
||||
{
|
||||
instance = this;
|
||||
anim = GetComponent<Animator>();
|
||||
}
|
||||
|
||||
private void Update()
|
||||
{
|
||||
if (inCombo)
|
||||
{
|
||||
comboNormalizedBeat = Conductor.instance.GetPositionFromBeat(comboBeat, 1);
|
||||
|
||||
if (hitCombo)
|
||||
{
|
||||
if (currentComboPots[comboPotIndex] == null) return;
|
||||
}
|
||||
else
|
||||
{
|
||||
comboNormalizedBeat += 1;
|
||||
}
|
||||
|
||||
if (comboNormalizedBeat >= 1 && comboIndex < 1)
|
||||
{
|
||||
if (hitCombo)
|
||||
{
|
||||
currentComboPots[comboPotIndex].Hit();
|
||||
HitEffectF(currentComboPots[comboPotIndex].Holder.transform.localPosition);
|
||||
comboPotIndex++;
|
||||
Jukebox.PlayOneShotGame("karateman/comboHit1");
|
||||
}
|
||||
else
|
||||
{
|
||||
Jukebox.PlayOneShotGame("karateman/swingNoHit");
|
||||
}
|
||||
comboIndex++;
|
||||
AnimPlay("PunchLeft");
|
||||
}
|
||||
else if (comboNormalizedBeat >= 1.25f && comboIndex < 2)
|
||||
{
|
||||
if (hitCombo)
|
||||
{
|
||||
currentComboPots[comboPotIndex].Hit();
|
||||
HitEffectF(currentComboPots[comboPotIndex].Holder.transform.localPosition);
|
||||
comboPotIndex++;
|
||||
Jukebox.PlayOneShotGame("karateman/comboHit1");
|
||||
}
|
||||
else
|
||||
{
|
||||
Jukebox.PlayOneShotGame("karateman/swingNoHit_Alt");
|
||||
}
|
||||
comboIndex++;
|
||||
AnimPlay("PunchRight");
|
||||
}
|
||||
else if (comboNormalizedBeat >= 1.5f && comboIndex < 3)
|
||||
{
|
||||
if (hitCombo)
|
||||
{
|
||||
currentComboPots[comboPotIndex].Hit();
|
||||
HitEffectF(currentComboPots[comboPotIndex].Holder.transform.localPosition);
|
||||
comboPotIndex++;
|
||||
Jukebox.PlayOneShotGame("karateman/comboHit2");
|
||||
}
|
||||
comboIndex++;
|
||||
AnimPlay("ComboCrouch");
|
||||
}
|
||||
else if (comboNormalizedBeat >= 1.75f && comboIndex < 4)
|
||||
{
|
||||
if (hitCombo)
|
||||
{
|
||||
currentComboPots[comboPotIndex].Hit();
|
||||
HitEffectF(currentComboPots[comboPotIndex].Holder.transform.localPosition);
|
||||
comboPotIndex++;
|
||||
Jukebox.PlayOneShotGame("karateman/comboHit3");
|
||||
}
|
||||
else
|
||||
{
|
||||
Jukebox.PlayOneShotGame("karateman/comboMiss");
|
||||
}
|
||||
comboIndex++;
|
||||
AnimPlay("ComboKick");
|
||||
}
|
||||
else if (comboNormalizedBeat >= 2f && comboIndex < 5)
|
||||
{
|
||||
if (hitCombo)
|
||||
{
|
||||
currentComboPots[comboPotIndex].Hit();
|
||||
HitEffectF(currentComboPots[comboPotIndex].Holder.transform.localPosition);
|
||||
comboPotIndex++;
|
||||
Jukebox.PlayOneShotGame("karateman/comboHit3");
|
||||
}
|
||||
comboIndex++;
|
||||
AnimPlay("ComboCrouchPunch");
|
||||
}
|
||||
else if (comboNormalizedBeat >= 2.05f)
|
||||
{
|
||||
if (hitCombo)
|
||||
{
|
||||
if (PlayerInput.AltPressedUp())
|
||||
{
|
||||
// ComboPow(null);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// fail anim
|
||||
AnimPlay("ComboMiss");
|
||||
ResetCombo();
|
||||
}
|
||||
|
||||
if (comboNormalizedBeat >= 3.5f && comboIndex < 69)
|
||||
{
|
||||
ResetCombo();
|
||||
AnimPlay("ComboCrouchPunchToIdle");
|
||||
comboIndex = 69;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!inCombo)
|
||||
if (PlayerInput.AltPressed())
|
||||
{
|
||||
Combo(null);
|
||||
}
|
||||
}
|
||||
|
||||
if (!hitBarrel)
|
||||
{
|
||||
if (PlayerInput.Pressed() && !inCombo)
|
||||
{
|
||||
Swing(null);
|
||||
}
|
||||
}
|
||||
|
||||
for(int i=0;i < shadows.Length; i++)
|
||||
{
|
||||
shadows[i].color = KarateMan.instance.GetShadowColor();
|
||||
}
|
||||
}
|
||||
|
||||
public void Combo(Pot p)
|
||||
{
|
||||
if (p == null)
|
||||
{
|
||||
comboBeat = Conductor.instance.songPositionInBeats;
|
||||
hitCombo = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
comboBeat = p.createBeat;
|
||||
hitCombo = true;
|
||||
}
|
||||
|
||||
inCombo = true;
|
||||
}
|
||||
|
||||
public void ComboPow(Pot p, bool overrideState = false)
|
||||
{
|
||||
if (!hitCombo || !inCombo || !hitCombo && !inCombo) return;
|
||||
|
||||
anim.Play("Pow", 0, 0);
|
||||
|
||||
/*if (currentComboPots[comboPotIndex].state.perfect)
|
||||
{
|
||||
// BarrelDestroy(currentComboPots[comboPotIndex], true);
|
||||
HitEffectF(currentComboPots[comboPotIndex].Holder.transform.localPosition);
|
||||
Destroy(currentComboPots[comboPotIndex].gameObject);
|
||||
Jukebox.PlayOneShotGame("karateman/comboHit4");
|
||||
}
|
||||
else
|
||||
{
|
||||
Jukebox.PlayOneShot("miss");
|
||||
currentComboPots[comboPotIndex].Miss();
|
||||
}*/
|
||||
|
||||
if (p != null)
|
||||
{
|
||||
if (p.state.perfect || overrideState)
|
||||
{
|
||||
p.BarrelDestroy(true);
|
||||
HitEffectF(p.Holder.transform.localPosition);
|
||||
Destroy(p.gameObject);
|
||||
Jukebox.PlayOneShotGame("karateman/comboHit4");
|
||||
}
|
||||
else if (p.state.notPerfect())
|
||||
{
|
||||
p.Miss();
|
||||
}
|
||||
}
|
||||
|
||||
ResetCombo();
|
||||
}
|
||||
|
||||
private void ResetCombo()
|
||||
{
|
||||
SetHead(0);
|
||||
hitCombo = false;
|
||||
inCombo = false;
|
||||
comboPotIndex = 0;
|
||||
comboIndex = 0;
|
||||
currentComboHitInList = 0;
|
||||
currentComboPots.Clear();
|
||||
}
|
||||
|
||||
public IEnumerator PrepareKick()
|
||||
{
|
||||
barrelBeat = Conductor.instance.songPositionInBeats;
|
||||
hitBarrel = true;
|
||||
yield return new WaitForSeconds(0.17f);
|
||||
AnimPlay("KickPrepare");
|
||||
}
|
||||
|
||||
public void ResetKick()
|
||||
{
|
||||
if (kickC != null)
|
||||
{
|
||||
StopCoroutine(kickC);
|
||||
}
|
||||
hitBarrel = false;
|
||||
}
|
||||
|
||||
public void Swing(Pot p)
|
||||
{
|
||||
SetHead(0);
|
||||
bool punchLeft = true;
|
||||
|
||||
if (p == null)
|
||||
{
|
||||
Jukebox.PlayOneShotGame("karateman/swingNoHit");
|
||||
}
|
||||
else
|
||||
{
|
||||
if (p.type == 2 || p.type == 3 || p.type == 4 || p.type == 6 || p.type == 999)
|
||||
{
|
||||
punchLeft = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
punchLeft = true;
|
||||
}
|
||||
|
||||
if (p.type == 4)
|
||||
{
|
||||
if (kickC != null) StopCoroutine(kickC);
|
||||
kickC = StartCoroutine(PrepareKick());
|
||||
}
|
||||
|
||||
if (!p.combo)
|
||||
HitEffectF(HitEffect.transform.localPosition);
|
||||
}
|
||||
|
||||
if (punchLeft)
|
||||
AnimPlay("PunchLeft");
|
||||
else
|
||||
AnimPlay("PunchRight");
|
||||
}
|
||||
|
||||
public void HitEffectF(Vector3 pos)
|
||||
{
|
||||
GameObject hit = Instantiate(HitEffect);
|
||||
hit.transform.parent = HitEffect.transform.parent;
|
||||
hit.transform.localPosition = pos;
|
||||
hit.SetActive(true);
|
||||
Destroy(hit, 0.06f);
|
||||
}
|
||||
|
||||
public void AnimPlay(string name)
|
||||
{
|
||||
anim.Play(name, 0, 0);
|
||||
anim.speed = 1;
|
||||
}
|
||||
|
||||
public void SetHead(int index)
|
||||
{
|
||||
head.sprite = heads[index];
|
||||
}
|
||||
|
||||
public IEnumerator Miss()
|
||||
{
|
||||
// I couldn't find the sound for this
|
||||
GameObject miss = Instantiate(missEffect, missEffect.transform.parent);
|
||||
miss.SetActive(true);
|
||||
SetHead(2);
|
||||
yield return new WaitForSeconds(0.08f);
|
||||
Destroy(miss);
|
||||
SetHead(0);
|
||||
}
|
||||
}
|
||||
}
|
File diff suppressed because it is too large
Load Diff
@ -1,5 +1,5 @@
|
||||
fileFormatVersion: 2
|
||||
guid: f7c69b76f8c0a85489aa15813dfef687
|
||||
guid: af41fb607b88d8644b683298f8fcaf54
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
|
12
Assets/Scripts/Games/KarateMan/KarateManHitMark.cs
Normal file
12
Assets/Scripts/Games/KarateMan/KarateManHitMark.cs
Normal file
@ -0,0 +1,12 @@
|
||||
using UnityEngine;
|
||||
|
||||
namespace HeavenStudio.Games.Scripts_KarateMan
|
||||
{
|
||||
public class KarateManHitMark : MonoBehaviour
|
||||
{
|
||||
void KillHitMark()
|
||||
{
|
||||
Destroy(gameObject);
|
||||
}
|
||||
}
|
||||
}
|
@ -1,5 +1,5 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 523d89bc8ebbac84dbe347ffa8fb0c04
|
||||
guid: d73c427be556896499214ab4666ff3b3
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
319
Assets/Scripts/Games/KarateMan/KarateManJoe.cs
Normal file
319
Assets/Scripts/Games/KarateMan/KarateManJoe.cs
Normal file
@ -0,0 +1,319 @@
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
using HeavenStudio;
|
||||
using HeavenStudio.Util;
|
||||
|
||||
namespace HeavenStudio.Games.Scripts_KarateMan
|
||||
{
|
||||
public class KarateManJoe : MonoBehaviour
|
||||
{
|
||||
public Animator anim;
|
||||
public Animator FaceAnim;
|
||||
public GameEvent bop = new GameEvent();
|
||||
public SpriteRenderer[] Shadows;
|
||||
|
||||
float lastPunchTime = Single.MinValue;
|
||||
float lastComboMissTime = Single.MinValue;
|
||||
float lastUpperCutTime = Single.MinValue;
|
||||
public bool inCombo = false;
|
||||
public bool lockedInCombo = false;
|
||||
public bool comboWaiting = false;
|
||||
int inComboId = -1;
|
||||
int shouldComboId = -1;
|
||||
public void SetComboId(int id) { inComboId = id; }
|
||||
public void SetShouldComboId(int id) { shouldComboId = id; }
|
||||
public int GetComboId() { return inComboId; }
|
||||
public int GetShouldComboId() { return shouldComboId; }
|
||||
|
||||
public bool wantKick = false;
|
||||
public bool inKick = false;
|
||||
float lastChargeTime = Single.MinValue;
|
||||
float unPrepareTime = Single.MinValue;
|
||||
bool canEmote = false;
|
||||
public int wantFace = 0;
|
||||
|
||||
bool inSpecial { get { return inCombo || lockedInCombo || Conductor.instance.GetPositionFromBeat(lastChargeTime, 2.75f) <= 0.25f; } }
|
||||
|
||||
private void Awake()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
private void Update()
|
||||
{
|
||||
var cond = Conductor.instance;
|
||||
|
||||
if (unPrepareTime != Single.MinValue && cond.songPositionInBeats >= unPrepareTime)
|
||||
{
|
||||
unPrepareTime = Single.MinValue;
|
||||
anim.speed = 1f;
|
||||
anim.Play("Beat", -1, 0);
|
||||
}
|
||||
|
||||
if (cond.ReportBeat(ref bop.lastReportedBeat, bop.startBeat % 1, false) && cond.songPositionInBeats > bop.startBeat && cond.songPositionInBeats >= unPrepareTime && !inCombo)
|
||||
{
|
||||
anim.speed = 1f;
|
||||
anim.Play("Beat", -1, 0);
|
||||
lastChargeTime = Single.MinValue;
|
||||
}
|
||||
|
||||
if (inCombo && shouldComboId == -2)
|
||||
{
|
||||
float missProg = cond.GetPositionFromBeat(lastComboMissTime, 3f);
|
||||
if (missProg >= 0f && missProg < 1f)
|
||||
{
|
||||
anim.DoScaledAnimation("LowKickMiss", lastComboMissTime, 3f);
|
||||
bop.startBeat = lastComboMissTime + 3f;
|
||||
}
|
||||
else if (missProg >= 1f)
|
||||
{
|
||||
anim.speed = 1f;
|
||||
bop.startBeat = lastComboMissTime + 3f;
|
||||
lastComboMissTime = Single.MinValue;
|
||||
inCombo = false;
|
||||
inComboId = -1;
|
||||
shouldComboId = -1;
|
||||
}
|
||||
}
|
||||
|
||||
if (inKick)
|
||||
{
|
||||
float chargeProg = cond.GetPositionFromBeat(lastChargeTime, 2.75f);
|
||||
if (chargeProg >= 0f && chargeProg < 1f)
|
||||
{
|
||||
anim.DoScaledAnimation("ManCharge", lastChargeTime, 2.75f);
|
||||
bop.startBeat = lastChargeTime + 1.75f;
|
||||
}
|
||||
else if (chargeProg >= 1f)
|
||||
{
|
||||
anim.speed = 1f;
|
||||
bop.startBeat = lastChargeTime + 1.75f;
|
||||
lastChargeTime = Single.MinValue;
|
||||
inKick = false;
|
||||
}
|
||||
}
|
||||
|
||||
if (PlayerInput.Pressed(true) && !inSpecial)
|
||||
{
|
||||
if (!KarateMan.instance.IsExpectingInputNow())
|
||||
{
|
||||
Punch(1);
|
||||
Jukebox.PlayOneShotGame("karateman/swingNoHit", forcePlay: true);
|
||||
}
|
||||
}
|
||||
else if (PlayerInput.AltPressed() && !inSpecial)
|
||||
{
|
||||
if (!KarateMan.instance.IsExpectingInputNow())
|
||||
{
|
||||
//start a forced-fail combo sequence
|
||||
ForceFailCombo(cond.songPositionInBeats);
|
||||
}
|
||||
}
|
||||
else if (PlayerInput.AltPressedUp())
|
||||
{
|
||||
if (!KarateMan.instance.IsExpectingInputNow())
|
||||
{
|
||||
if (inComboId != -1 && !lockedInCombo)
|
||||
{
|
||||
inComboId = -1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ((!GameManager.instance.autoplay) && (PlayerInput.PressedUp(true) && !PlayerInput.Pressing(true)))
|
||||
{
|
||||
if (wantKick)
|
||||
{
|
||||
//stopped holding, don't charge
|
||||
wantKick = false;
|
||||
}
|
||||
else if (inKick && cond.GetPositionFromBeat(lastChargeTime, 2.75f) <= 0.5f && !KarateMan.instance.IsExpectingInputNow())
|
||||
{
|
||||
Kick(cond.songPositionInBeats);
|
||||
Jukebox.PlayOneShotGame("karateman/swingKick", forcePlay: true);
|
||||
}
|
||||
}
|
||||
|
||||
UpdateShadowColour();
|
||||
|
||||
if (canEmote && wantFace >= 0)
|
||||
{
|
||||
SetFaceExpressionForced(wantFace);
|
||||
if (wantFace == (int) KarateMan.KarateManFaces.Surprise) wantFace = -1;
|
||||
}
|
||||
}
|
||||
|
||||
public bool Punch(int forceHand = 0)
|
||||
{
|
||||
if (GameManager.instance.currentGame != "karateman") return false;
|
||||
var cond = Conductor.instance;
|
||||
bool straight = false;
|
||||
|
||||
anim.speed = 1f;
|
||||
unPrepareTime = Single.MinValue;
|
||||
lastChargeTime = Single.MinValue;
|
||||
inKick = false;
|
||||
|
||||
switch (forceHand)
|
||||
{
|
||||
case 0:
|
||||
if (cond.songPositionInBeats - lastPunchTime < 0.25f + (Minigame.LateTime() - 1f))
|
||||
{
|
||||
lastPunchTime = Single.MinValue;
|
||||
anim.DoScaledAnimationAsync("Straight", 0.5f);
|
||||
straight = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
lastPunchTime = cond.songPositionInBeats;
|
||||
anim.DoScaledAnimationAsync("Jab", 0.5f);
|
||||
}
|
||||
break;
|
||||
case 1:
|
||||
anim.DoScaledAnimationAsync("Jab", 0.5f);
|
||||
break;
|
||||
case 2:
|
||||
anim.DoScaledAnimationAsync("Straight", 0.5f);
|
||||
straight = true;
|
||||
break;
|
||||
}
|
||||
bop.startBeat = cond.songPositionInBeats + 0.5f;
|
||||
return straight; //returns what hand was used to punch the object
|
||||
}
|
||||
|
||||
public void ComboSequence(int seq)
|
||||
{
|
||||
if (GameManager.instance.currentGame != "karateman") return;
|
||||
var cond = Conductor.instance;
|
||||
bop.startBeat = cond.songPositionInBeats + 1f;
|
||||
unPrepareTime = Single.MinValue;
|
||||
switch (seq)
|
||||
{
|
||||
case 0:
|
||||
anim.Play("LowJab", -1, 0);
|
||||
break;
|
||||
case 1:
|
||||
anim.Play("LowKick", -1, 0);
|
||||
break;
|
||||
case 2:
|
||||
anim.DoScaledAnimationAsync("BackHand", 0.5f);
|
||||
comboWaiting = true;
|
||||
break;
|
||||
case 3:
|
||||
anim.DoScaledAnimationAsync("UpperCut", 0.5f);
|
||||
lockedInCombo = false;
|
||||
comboWaiting = false;
|
||||
break;
|
||||
case 4:
|
||||
anim.Play("ToReady", -1, 0);
|
||||
bop.startBeat = cond.songPositionInBeats + 0.5f;
|
||||
lockedInCombo = false;
|
||||
comboWaiting = false;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
public void ComboMiss(float beat)
|
||||
{
|
||||
var cond = Conductor.instance;
|
||||
lastComboMissTime = beat;
|
||||
bop.startBeat = beat + 3f;
|
||||
unPrepareTime = Single.MinValue;
|
||||
anim.DoNormalizedAnimation("LowKickMiss");
|
||||
}
|
||||
|
||||
public void ForceFailCombo(float beat)
|
||||
{
|
||||
if (inCombo) return;
|
||||
BeatAction.New(gameObject, new List<BeatAction.Action>()
|
||||
{
|
||||
new BeatAction.Action(beat, delegate { Punch(1); inCombo = true; inComboId = -1; shouldComboId = -1;}),
|
||||
new BeatAction.Action(beat + 0.25f, delegate { Punch(2); }),
|
||||
new BeatAction.Action(beat + 0.5f, delegate { ComboSequence(0); }),
|
||||
new BeatAction.Action(beat + 0.75f, delegate { shouldComboId = -2; ComboMiss(beat + 0.75f); }),
|
||||
});
|
||||
|
||||
MultiSound.Play(new MultiSound.Sound[]
|
||||
{
|
||||
new MultiSound.Sound("karateman/swingNoHit", beat),
|
||||
new MultiSound.Sound("karateman/swingNoHit_Alt", beat + 0.25f),
|
||||
new MultiSound.Sound("karateman/swingNoHit_Alt", beat + 0.5f),
|
||||
new MultiSound.Sound("karateman/comboMiss", beat + 0.75f),
|
||||
}, forcePlay: true);
|
||||
}
|
||||
|
||||
public void StartKickCharge(float beat)
|
||||
{
|
||||
wantKick = true;
|
||||
unPrepareTime = Single.MinValue;
|
||||
BeatAction.New(gameObject, new List<BeatAction.Action>()
|
||||
{
|
||||
new BeatAction.Action(beat, delegate {
|
||||
if (wantKick)
|
||||
{
|
||||
wantKick = false;
|
||||
inKick = true;
|
||||
lastChargeTime = beat;
|
||||
bop.startBeat = beat + 1.75f;
|
||||
}
|
||||
})
|
||||
});
|
||||
}
|
||||
|
||||
public void Kick(float beat)
|
||||
{
|
||||
if (!inKick) return;
|
||||
//play the kick animation and reset stance
|
||||
anim.speed = 1f;
|
||||
bop.startBeat = beat + 1f;
|
||||
unPrepareTime = Single.MinValue;
|
||||
lastChargeTime = Single.MinValue;
|
||||
inKick = false;
|
||||
|
||||
anim.DoScaledAnimationAsync("ManKick", 0.5f);
|
||||
}
|
||||
|
||||
public void MarkCanEmote()
|
||||
{
|
||||
canEmote = true;
|
||||
}
|
||||
|
||||
public void MarkNoEmote()
|
||||
{
|
||||
canEmote = false;
|
||||
}
|
||||
|
||||
public void UpdateShadowColour()
|
||||
{
|
||||
foreach (var shadow in Shadows)
|
||||
{
|
||||
shadow.color = KarateMan.instance.GetShadowColor();
|
||||
}
|
||||
}
|
||||
|
||||
public void Prepare(float beat, float length)
|
||||
{
|
||||
anim.speed = 0f;
|
||||
anim.Play("Beat", -1, 0);
|
||||
unPrepareTime = beat + length;
|
||||
}
|
||||
|
||||
public void SetFaceExpressionForced(int face)
|
||||
{
|
||||
wantFace = -2;
|
||||
FaceAnim.DoScaledAnimationAsync("Face" + face.ToString("D2"));
|
||||
}
|
||||
|
||||
public void SetFaceExpression(int face, bool ignoreCheck = false)
|
||||
{
|
||||
wantFace = face;
|
||||
if (canEmote || ignoreCheck)
|
||||
FaceAnim.DoScaledAnimationAsync("Face" + face.ToString("D2"));
|
||||
}
|
||||
}
|
||||
}
|
@ -1,5 +1,5 @@
|
||||
fileFormatVersion: 2
|
||||
guid: e9d184371fba53f4bad123485376f507
|
||||
guid: e6ef00cb3bdcfd647bd634066ce4107d
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
856
Assets/Scripts/Games/KarateMan/KarateManPot.cs
Normal file
856
Assets/Scripts/Games/KarateMan/KarateManPot.cs
Normal file
@ -0,0 +1,856 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
using NaughtyBezierCurves;
|
||||
|
||||
using HeavenStudio.Util;
|
||||
|
||||
namespace HeavenStudio.Games.Scripts_KarateMan
|
||||
{
|
||||
public class KarateManPot : PlayerActionObject
|
||||
{
|
||||
public float startBeat;
|
||||
public ItemType type;
|
||||
public int path = 1;
|
||||
|
||||
public GameObject Shadow;
|
||||
public GameObject ShadowInstance;
|
||||
SpriteRenderer shadowRenderer;
|
||||
|
||||
//hit effects
|
||||
public GameObject HitMark;
|
||||
public ParticleSystem[] HitParticles;
|
||||
|
||||
public string awakeAnim;
|
||||
FlyStatus status = FlyStatus.Fly;
|
||||
Color effectTint = Color.white;
|
||||
|
||||
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; }
|
||||
|
||||
public enum ItemType {
|
||||
Pot, // path 1
|
||||
Bulb, // path 1
|
||||
Rock, // path 1
|
||||
Ball, // path 1
|
||||
Cooking, // path 1
|
||||
Alien, // path 1
|
||||
TacoBell, // path 1
|
||||
|
||||
KickBarrel, // path 1
|
||||
KickBomb, // no path
|
||||
|
||||
ComboPot1, // path 1
|
||||
ComboPot2, // path 1
|
||||
ComboPot3, // path 2
|
||||
ComboPot4, // path 3
|
||||
ComboPot5, // path 4
|
||||
ComboBarrel,// path 5
|
||||
|
||||
CookingLid, //only used for hit
|
||||
}
|
||||
|
||||
public enum FlyStatus {
|
||||
Fly,
|
||||
Hit,
|
||||
NG,
|
||||
HitWeak
|
||||
}
|
||||
|
||||
//pot trajectory stuff
|
||||
public Transform[] HitPosition;
|
||||
public float[] HitPositionOffset;
|
||||
public Vector3[] StartPositionOffset;
|
||||
public float[] ItemSlipRt;
|
||||
public BezierCurve3D[] ItemCurves;
|
||||
public BezierCurve3D CurrentCurve;
|
||||
public float curveTargetBeat;
|
||||
|
||||
public SpriteRenderer BulbLight;
|
||||
|
||||
public void SetBulbColor(Color c) {
|
||||
effectTint = c;
|
||||
BulbLight.color = c;
|
||||
}
|
||||
|
||||
float ProgressToHitPosition(float progress) {
|
||||
return progress + (HitPositionOffset[path] - 0.5f);
|
||||
}
|
||||
|
||||
Vector3 ProgressToFlyPosition()
|
||||
{
|
||||
var cond = Conductor.instance;
|
||||
float progress = Mathf.Min(cond.GetPositionFromBeat(startBeat, 2f), 1f - ItemSlipRt[path]);
|
||||
float progressToHitPosition = ProgressToHitPosition(progress);
|
||||
|
||||
Vector3 hitPosition = HitPosition[path].position;
|
||||
|
||||
//https://www.desmos.com/calculator/ycn9v62i4f
|
||||
float offset = HitPositionOffset[path];
|
||||
float flyHeight = (progressToHitPosition*(progressToHitPosition-1f))/(offset*(offset-1f));
|
||||
float floorHeight = HitPosition[0].position.y;
|
||||
|
||||
Vector3 startPosition = hitPosition + StartPositionOffset[path];
|
||||
Vector3 endPosition = hitPosition - StartPositionOffset[path];
|
||||
Vector3 flyPosition = new Vector3(
|
||||
Mathf.Lerp(startPosition.x, endPosition.x, progress),
|
||||
floorHeight + (HitPosition[path].position.y - floorHeight + (StartPositionOffset[path].y * (1 - Mathf.Min(cond.GetPositionFromBeat(startBeat, 1f), 1f)))) * flyHeight,
|
||||
Mathf.Lerp(startPosition.z, endPosition.z, progress)
|
||||
);
|
||||
|
||||
if (progress >= 0.5f && flyPosition.y < HitPosition[0].position.y) {
|
||||
flyPosition.y = floorHeight;
|
||||
}
|
||||
return flyPosition;
|
||||
}
|
||||
|
||||
void Awake()
|
||||
{
|
||||
switch (type)
|
||||
{
|
||||
case ItemType.ComboPot1:
|
||||
KarateMan.instance.ScheduleInput(startBeat, 1f, InputType.STANDARD_ALT_DOWN, ComboStartJustOrNg, ComboStartThrough, ComboStartOut);
|
||||
KarateMan.instance.ScheduleUserInput(startBeat, 1f, InputType.STANDARD_DOWN | InputType.DIRECTION_DOWN, ComboStartWrongAction, ComboStartOut, ComboStartOut);
|
||||
path = 1;
|
||||
break;
|
||||
case ItemType.ComboPot2:
|
||||
path = 1;
|
||||
BeatAction.New(gameObject, new List<BeatAction.Action>() { new BeatAction.Action(startBeat + 1f, delegate { JoeComboSequence(); }) });
|
||||
break;
|
||||
case ItemType.ComboPot3:
|
||||
path = 2;
|
||||
BeatAction.New(gameObject, new List<BeatAction.Action>() { new BeatAction.Action(startBeat + 1f, delegate { JoeComboSequence(); }) });
|
||||
break;
|
||||
case ItemType.ComboPot4:
|
||||
path = 3;
|
||||
//if the button isn't held anymore make Joe spin
|
||||
BeatAction.New(gameObject, new List<BeatAction.Action>() { new BeatAction.Action(startBeat + 1f, delegate { JoeComboSequence(); }) });
|
||||
break;
|
||||
case ItemType.ComboPot5:
|
||||
path = 4;
|
||||
BeatAction.New(gameObject, new List<BeatAction.Action>() { new BeatAction.Action(startBeat + 1f, delegate { JoeComboSequence(); }) });
|
||||
break;
|
||||
case ItemType.ComboBarrel:
|
||||
//check for button release
|
||||
KarateMan.instance.ScheduleInput(startBeat, 1f, InputType.STANDARD_ALT_UP, ComboEndJustOrNg, ComboEndThrough, ComboEndOut);
|
||||
//button presses
|
||||
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);
|
||||
path = 5;
|
||||
break;
|
||||
case ItemType.KickBarrel:
|
||||
KarateMan.instance.ScheduleInput(startBeat, 1f, InputType.STANDARD_DOWN | InputType.DIRECTION_DOWN, KickChargeJustOrNg, ItemThrough, ItemOut);
|
||||
KarateMan.instance.ScheduleUserInput(startBeat, 1f, InputType.STANDARD_ALT_DOWN, ItemWrongAction, ItemOut, ItemOut);
|
||||
path = 1;
|
||||
comboId = -1;
|
||||
break;
|
||||
case ItemType.KickBomb:
|
||||
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;
|
||||
case ItemType.CookingLid:
|
||||
CurrentCurve = ItemCurves[9];
|
||||
path = 1;
|
||||
curveTargetBeat = 2f;
|
||||
status = FlyStatus.Hit;
|
||||
comboId = -1;
|
||||
break;
|
||||
default:
|
||||
KarateMan.instance.ScheduleInput(startBeat, 1f, InputType.STANDARD_DOWN | InputType.DIRECTION_DOWN, ItemJustOrNg, ItemThrough, ItemOut);
|
||||
KarateMan.instance.ScheduleUserInput(startBeat, 1f, InputType.STANDARD_ALT_DOWN, ItemWrongAction, ItemOut, ItemOut);
|
||||
path = 1;
|
||||
comboId = -1;
|
||||
break;
|
||||
}
|
||||
|
||||
float floorHeight = HitPosition[0].position.y;
|
||||
if (CurrentCurve == null)
|
||||
transform.position = ProgressToFlyPosition();
|
||||
else
|
||||
transform.position = CurrentCurve.GetPoint(0f);
|
||||
|
||||
Animator mobjAnim = GetComponent<Animator>();
|
||||
mobjAnim.Play(awakeAnim, -1, 0);
|
||||
transform.rotation = Quaternion.Euler(0, 0, transform.rotation.eulerAngles.z + (-360f * Time.deltaTime) + UnityEngine.Random.Range(0f, 360f));
|
||||
|
||||
ShadowInstance = GameObject.Instantiate(Shadow, KarateMan.instance.ItemHolder);
|
||||
shadowRenderer = ShadowInstance.GetComponent<SpriteRenderer>();
|
||||
shadowRenderer.color = KarateMan.instance.GetShadowColor();
|
||||
ShadowInstance.SetActive(true);
|
||||
ShadowInstance.transform.position = new Vector3(transform.position.x, floorHeight - 0.5f, transform.position.z);
|
||||
}
|
||||
|
||||
void Update()
|
||||
{
|
||||
var cond = Conductor.instance;
|
||||
float floorHeight = HitPosition[0].position.y;
|
||||
switch (status)
|
||||
{
|
||||
case FlyStatus.Fly:
|
||||
float prog = cond.GetPositionFromBeat(startBeat, 2f);
|
||||
if (CurrentCurve == null)
|
||||
transform.position = ProgressToFlyPosition();
|
||||
else
|
||||
{
|
||||
prog = cond.GetPositionFromBeat(startBeat, curveTargetBeat);
|
||||
transform.position = CurrentCurve.GetPoint(Mathf.Min(prog, 1f));
|
||||
}
|
||||
|
||||
if (prog >= 2f || (type == ItemType.KickBomb && prog >= 1f)) {
|
||||
if (type == ItemType.KickBomb)
|
||||
{
|
||||
ParticleSystem p = Instantiate(HitParticles[7], ItemCurves[6].GetPoint(1f), Quaternion.identity, KarateMan.instance.ItemHolder);
|
||||
p.Play();
|
||||
}
|
||||
GameObject.Destroy(ShadowInstance.gameObject);
|
||||
GameObject.Destroy(gameObject);
|
||||
return;
|
||||
}
|
||||
else if (CurrentCurve == null && prog < 1f - ItemSlipRt[path]) {
|
||||
transform.rotation = Quaternion.Euler(0, 0, transform.rotation.eulerAngles.z + (125f * Time.deltaTime * (1/cond.pitchedSecPerBeat)));
|
||||
}
|
||||
else if (CurrentCurve != null && prog < 1f)
|
||||
{
|
||||
transform.rotation = Quaternion.Euler(0, 0, transform.rotation.eulerAngles.z + (-90f * Time.deltaTime * (1/cond.pitchedSecPerBeat)));
|
||||
}
|
||||
break;
|
||||
case FlyStatus.Hit:
|
||||
prog = cond.GetPositionFromBeat(startBeat, curveTargetBeat);
|
||||
if (cond.songPositionInBeats >= startBeat + Mathf.Max(2f, curveTargetBeat) || CurrentCurve == null) {
|
||||
|
||||
if (type == ItemType.KickBomb)
|
||||
{
|
||||
ParticleSystem p = Instantiate(HitParticles[6], ItemCurves[7].GetPoint(1f), Quaternion.identity, KarateMan.instance.ItemHolder);
|
||||
p.Play();
|
||||
}
|
||||
|
||||
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 + (-270f * Time.deltaTime * (1/cond.pitchedSecPerBeat)));
|
||||
}
|
||||
else
|
||||
{
|
||||
transform.position = CurrentCurve.GetPoint(1f);
|
||||
}
|
||||
}
|
||||
break;
|
||||
case FlyStatus.NG:
|
||||
prog = cond.GetPositionFromBeat(startBeat, curveTargetBeat);
|
||||
if (cond.songPositionInBeats >= startBeat + Mathf.Max(2f, curveTargetBeat) || (type == ItemType.KickBomb && prog >= 1f) || CurrentCurve == null) {
|
||||
if (type == ItemType.KickBomb)
|
||||
{
|
||||
ParticleSystem p = Instantiate(HitParticles[7], ItemCurves[8].GetPoint(1f), Quaternion.identity, KarateMan.instance.ItemHolder);
|
||||
p.Play();
|
||||
}
|
||||
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;
|
||||
case FlyStatus.HitWeak:
|
||||
break;
|
||||
}
|
||||
ShadowInstance.transform.position = new Vector3(transform.position.x, floorHeight - 0.5f, transform.position.z);
|
||||
shadowRenderer.color = KarateMan.instance.GetShadowColor();
|
||||
}
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
//handles hitsound and particles
|
||||
void ItemHitEffect(bool straight = false)
|
||||
{
|
||||
ParticleSystem p;
|
||||
CreateHitMark(type == ItemType.KickBomb);
|
||||
switch (type)
|
||||
{
|
||||
case ItemType.Bulb:
|
||||
CurrentCurve = ItemCurves[straight ? 1 : 0];
|
||||
curveTargetBeat = straight ? 1f : 1.5f;;
|
||||
Jukebox.PlayOneShotGame("karateman/lightbulbHit", forcePlay: true);
|
||||
p = Instantiate(HitParticles[5], HitPosition[1].position, Quaternion.Euler(0, 0, UnityEngine.Random.Range(0f, 360f)), KarateMan.instance.ItemHolder);
|
||||
|
||||
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();
|
||||
break;
|
||||
case ItemType.Rock:
|
||||
CurrentCurve = ItemCurves[1];
|
||||
curveTargetBeat = 1f;
|
||||
Jukebox.PlayOneShotGame("karateman/rockHit", forcePlay: true);
|
||||
p = Instantiate(HitParticles[4], HitPosition[1].position, Quaternion.identity, KarateMan.instance.ItemHolder);
|
||||
p.Play();
|
||||
break;
|
||||
case ItemType.Ball:
|
||||
CurrentCurve = ItemCurves[1];
|
||||
curveTargetBeat = 1f;
|
||||
Jukebox.PlayOneShotGame("karateman/soccerHit", forcePlay: true);
|
||||
p = Instantiate(HitParticles[1], HitPosition[1].position, Quaternion.Euler(0, 0, UnityEngine.Random.Range(0f, 360f)), KarateMan.instance.ItemHolder);
|
||||
p.Play();
|
||||
break;
|
||||
case ItemType.Cooking:
|
||||
CurrentCurve = ItemCurves[1];
|
||||
curveTargetBeat = 1f;
|
||||
Jukebox.PlayOneShotGame("karateman/cookingPot", forcePlay: true);
|
||||
p = Instantiate(HitParticles[1], HitPosition[1].position, Quaternion.Euler(0, 0, UnityEngine.Random.Range(0f, 360f)), KarateMan.instance.ItemHolder);
|
||||
p.Play();
|
||||
KarateMan.instance.CreateItemInstance(startBeat + 1f, "Item09", ItemType.CookingLid);
|
||||
GetComponent<Animator>().Play("Item08", -1, 0);
|
||||
break;
|
||||
case ItemType.Alien:
|
||||
CurrentCurve = ItemCurves[1];
|
||||
curveTargetBeat = 1f;
|
||||
Jukebox.PlayOneShotGame("karateman/alienHit", forcePlay: true);
|
||||
p = Instantiate(HitParticles[1], HitPosition[1].position, Quaternion.Euler(0, 0, UnityEngine.Random.Range(0f, 360f)), KarateMan.instance.ItemHolder);
|
||||
p.Play();
|
||||
break;
|
||||
case ItemType.TacoBell:
|
||||
CurrentCurve = ItemCurves[1];
|
||||
curveTargetBeat = 1f;
|
||||
Jukebox.PlayOneShotGame("karateman/rockHit", forcePlay: true);
|
||||
Jukebox.PlayOneShotGame("karateman/tacobell", forcePlay: true);
|
||||
p = Instantiate(HitParticles[1], HitPosition[1].position, Quaternion.Euler(0, 0, UnityEngine.Random.Range(0f, 360f)), KarateMan.instance.ItemHolder);
|
||||
p.Play();
|
||||
break;
|
||||
case ItemType.ComboPot1:
|
||||
CurrentCurve = ItemCurves[straight ? 1 : 0];
|
||||
curveTargetBeat = 1.5f;
|
||||
Jukebox.PlayOneShotGame("karateman/comboHit1", forcePlay: true);
|
||||
p = Instantiate(HitParticles[1], HitPosition[1].position, Quaternion.Euler(0, 0, UnityEngine.Random.Range(0f, 360f)), KarateMan.instance.ItemHolder);
|
||||
p.Play();
|
||||
break;
|
||||
case ItemType.ComboPot2:
|
||||
CurrentCurve = ItemCurves[0];
|
||||
curveTargetBeat = 1.5f;
|
||||
Jukebox.PlayOneShotGame("karateman/comboHit1", forcePlay: true);
|
||||
p = Instantiate(HitParticles[1], HitPosition[1].position, Quaternion.Euler(0, 0, UnityEngine.Random.Range(0f, 360f)), KarateMan.instance.ItemHolder);
|
||||
p.Play();
|
||||
break;
|
||||
case ItemType.ComboPot3:
|
||||
CurrentCurve = ItemCurves[2];
|
||||
curveTargetBeat = 1f;
|
||||
Jukebox.PlayOneShotGame("karateman/comboHit2", forcePlay: true);
|
||||
p = Instantiate(HitParticles[1], HitPosition[2].position, Quaternion.Euler(0, 0, UnityEngine.Random.Range(0f, 360f)), KarateMan.instance.ItemHolder);
|
||||
p.Play();
|
||||
break;
|
||||
case ItemType.ComboPot4:
|
||||
CurrentCurve = ItemCurves[3];
|
||||
curveTargetBeat = 1f;
|
||||
Jukebox.PlayOneShotGame("karateman/comboHit3", forcePlay: true);
|
||||
p = Instantiate(HitParticles[1], HitPosition[3].position, Quaternion.Euler(0, 0, UnityEngine.Random.Range(0f, 360f)), KarateMan.instance.ItemHolder);
|
||||
p.Play();
|
||||
break;
|
||||
case ItemType.ComboPot5:
|
||||
CurrentCurve = ItemCurves[4];
|
||||
curveTargetBeat = 1f;
|
||||
Jukebox.PlayOneShotGame("karateman/comboHit3", forcePlay: true);
|
||||
p = Instantiate(HitParticles[1], HitPosition[4].position, Quaternion.Euler(0, 0, UnityEngine.Random.Range(0f, 360f)), KarateMan.instance.ItemHolder);
|
||||
p.Play();
|
||||
break;
|
||||
case ItemType.ComboBarrel:
|
||||
Jukebox.PlayOneShotGame("karateman/comboHit4", forcePlay: true);
|
||||
p = Instantiate(HitParticles[0], HitPosition[5].position, Quaternion.identity, KarateMan.instance.ItemHolder);
|
||||
p.Play();
|
||||
p = Instantiate(HitParticles[1], HitPosition[5].position, Quaternion.Euler(0, 0, UnityEngine.Random.Range(0f, 360f)), KarateMan.instance.ItemHolder);
|
||||
p.Play();
|
||||
break;
|
||||
case ItemType.KickBarrel:
|
||||
KarateMan.instance.CreateItemInstance(startBeat + 1f, "Item04", ItemType.KickBomb);
|
||||
Jukebox.PlayOneShotGame("karateman/barrelBreak", forcePlay: true);
|
||||
p = Instantiate(HitParticles[0], HitPosition[1].position, Quaternion.Euler(0, 0, -5f), KarateMan.instance.ItemHolder);
|
||||
p.Play();
|
||||
p = Instantiate(HitParticles[1], HitPosition[1].position, Quaternion.Euler(0, 0, UnityEngine.Random.Range(0f, 360f)), KarateMan.instance.ItemHolder);
|
||||
p.Play();
|
||||
break;
|
||||
case ItemType.KickBomb:
|
||||
Jukebox.PlayOneShotGame("karateman/bombKick", forcePlay: true);
|
||||
p = Instantiate(HitParticles[2], ItemCurves[6].GetPoint(0.5f), Quaternion.identity, KarateMan.instance.ItemHolder);
|
||||
p.Play();
|
||||
break;
|
||||
default:
|
||||
CurrentCurve = ItemCurves[straight ? 1 : 0];
|
||||
curveTargetBeat = straight ? 1f : 1.5f;
|
||||
Jukebox.PlayOneShotGame("karateman/potHit", forcePlay: true);
|
||||
p = Instantiate(HitParticles[3], HitPosition[1].position, Quaternion.identity, KarateMan.instance.ItemHolder);
|
||||
p.Play();
|
||||
break;
|
||||
}
|
||||
|
||||
startBeat = Conductor.instance.songPositionInBeats;
|
||||
status = FlyStatus.Hit;
|
||||
}
|
||||
|
||||
int ItemPunchHand()
|
||||
{
|
||||
switch (type)
|
||||
{
|
||||
case ItemType.Rock:
|
||||
case ItemType.Ball:
|
||||
case ItemType.Cooking:
|
||||
case ItemType.Alien:
|
||||
case ItemType.TacoBell:
|
||||
case ItemType.KickBarrel:
|
||||
return 2;
|
||||
default:
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
void JoeComboSequence()
|
||||
{
|
||||
if (GameManager.instance.currentGame != "karateman") return;
|
||||
var joe = KarateMan.instance.Joe;
|
||||
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
|
||||
{
|
||||
ItemHitEffect();
|
||||
}
|
||||
break;
|
||||
case ItemType.ComboPot3:
|
||||
joe.ComboSequence(0);
|
||||
if (joe.GetComboId() != comboId) {}
|
||||
else
|
||||
{
|
||||
ItemHitEffect();
|
||||
}
|
||||
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);
|
||||
joe.lockedInCombo = true;
|
||||
ItemHitEffect();
|
||||
}
|
||||
break;
|
||||
case ItemType.ComboPot5:
|
||||
joe.ComboSequence(2);
|
||||
if (joe.GetComboId() != comboId) {}
|
||||
else
|
||||
{
|
||||
ItemHitEffect();
|
||||
}
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
public void ItemJustOrNg(PlayerActionEvent caller, float state)
|
||||
{
|
||||
if (GameManager.instance.currentGame != "karateman") return;
|
||||
var joe = KarateMan.instance.Joe;
|
||||
if (status == FlyStatus.Fly && !joe.inCombo) {
|
||||
bool straight = joe.Punch(ItemPunchHand());
|
||||
if (state <= -1f || state >= 1f) {
|
||||
startBeat = Conductor.instance.songPositionInBeats;
|
||||
CurrentCurve = ItemCurves[6];
|
||||
curveTargetBeat = 1f;
|
||||
Jukebox.PlayOneShot("miss");
|
||||
status = FlyStatus.NG;
|
||||
|
||||
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);
|
||||
}),
|
||||
});
|
||||
}
|
||||
else {
|
||||
ItemHitEffect(straight);
|
||||
status = FlyStatus.Hit;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void ItemWrongAction(PlayerActionEvent caller, float state)
|
||||
{
|
||||
if (GameManager.instance.currentGame != "karateman") return;
|
||||
//hitting a normal object with the alt input
|
||||
//WHEN SCORING THIS IS A MISS
|
||||
var joe = KarateMan.instance.Joe;
|
||||
if (status == FlyStatus.Fly && !joe.inCombo) {
|
||||
joe.ForceFailCombo(Conductor.instance.songPositionInBeats);
|
||||
if (state <= -1f || state >= 1f) {
|
||||
startBeat = Conductor.instance.songPositionInBeats;
|
||||
CurrentCurve = ItemCurves[6];
|
||||
curveTargetBeat = 1f;
|
||||
Jukebox.PlayOneShot("miss");
|
||||
status = FlyStatus.NG;
|
||||
}
|
||||
else {
|
||||
ItemHitEffect();
|
||||
}
|
||||
|
||||
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);
|
||||
}),
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
public void ItemOut(PlayerActionEvent caller) {}
|
||||
|
||||
public void ItemThrough(PlayerActionEvent caller)
|
||||
{
|
||||
var joe = KarateMan.instance.Joe;
|
||||
if (GameManager.instance.currentGame != "karateman") return;
|
||||
if (status != FlyStatus.Fly || gameObject == null) return;
|
||||
BeatAction.New(joe.gameObject, new List<BeatAction.Action>()
|
||||
{
|
||||
new BeatAction.Action(startBeat + 2f, delegate {
|
||||
//TODO: play miss sound
|
||||
//deduct flow if applicable
|
||||
joe.SetFaceExpression((int) KarateMan.KarateManFaces.Surprise);
|
||||
}),
|
||||
new BeatAction.Action(startBeat + 6f, delegate {
|
||||
if (joe.wantFace == -1)
|
||||
joe.SetFaceExpression((int) KarateMan.KarateManFaces.Normal);
|
||||
}),
|
||||
});
|
||||
}
|
||||
|
||||
public void ComboStartJustOrNg(PlayerActionEvent caller, float state)
|
||||
{
|
||||
if (GameManager.instance.currentGame != "karateman") return;
|
||||
var joe = KarateMan.instance.Joe;
|
||||
if (status == FlyStatus.Fly && !(joe.inKick || joe.wantKick || joe.inCombo)) {
|
||||
joe.inCombo = true;
|
||||
joe.Punch(1);
|
||||
joe.SetComboId(comboId);
|
||||
joe.SetShouldComboId(comboId);
|
||||
if (state <= -1f || state >= 1f) {
|
||||
startBeat = Conductor.instance.songPositionInBeats;
|
||||
CurrentCurve = ItemCurves[6];
|
||||
curveTargetBeat = 1f;
|
||||
Jukebox.PlayOneShot("miss");
|
||||
status = FlyStatus.NG;
|
||||
}
|
||||
else {
|
||||
ItemHitEffect();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void ComboStartOut(PlayerActionEvent caller) {}
|
||||
public void ComboStartThrough(PlayerActionEvent caller)
|
||||
{
|
||||
var joe = KarateMan.instance.Joe;
|
||||
if (GameManager.instance.currentGame != "karateman") return;
|
||||
if (status != FlyStatus.Fly || gameObject == null) return;
|
||||
BeatAction.New(joe.gameObject, new List<BeatAction.Action>()
|
||||
{
|
||||
new BeatAction.Action(startBeat + 2f, delegate {
|
||||
//TODO: play miss sound
|
||||
//deduct flow if applicable
|
||||
joe.SetFaceExpression((int) KarateMan.KarateManFaces.Surprise);
|
||||
}),
|
||||
new BeatAction.Action(startBeat + 6f, delegate {
|
||||
if (joe.wantFace == -1)
|
||||
joe.SetFaceExpression((int) KarateMan.KarateManFaces.Normal);
|
||||
}),
|
||||
});
|
||||
}
|
||||
|
||||
public void ComboStartWrongAction(PlayerActionEvent caller, float state)
|
||||
{
|
||||
if (GameManager.instance.currentGame != "karateman") return;
|
||||
//hitting a combo start with the normal input
|
||||
//WHEN SCORING THIS IS A MISS
|
||||
var joe = KarateMan.instance.Joe;
|
||||
if (status == FlyStatus.Fly && !joe.inCombo) {
|
||||
bool straight = joe.Punch(ItemPunchHand());
|
||||
if (state <= -1f || state >= 1f) {
|
||||
startBeat = Conductor.instance.songPositionInBeats;
|
||||
CurrentCurve = ItemCurves[6];
|
||||
curveTargetBeat = 1f;
|
||||
Jukebox.PlayOneShot("miss");
|
||||
status = FlyStatus.NG;
|
||||
}
|
||||
else {
|
||||
ItemHitEffect(straight);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void ComboEndJustOrNg(PlayerActionEvent caller, float state)
|
||||
{
|
||||
if (GameManager.instance.currentGame != "karateman") return;
|
||||
var joe = KarateMan.instance.Joe;
|
||||
if (status == FlyStatus.Fly && joe.inCombo && joe.GetComboId() == comboId) {
|
||||
joe.inCombo = false;
|
||||
joe.SetComboId(-1);
|
||||
joe.SetShouldComboId(-1);
|
||||
joe.ComboSequence(3);
|
||||
if (state <= -1f || state >= 1f) {
|
||||
startBeat = Conductor.instance.songPositionInBeats;
|
||||
CurrentCurve = ItemCurves[5];
|
||||
curveTargetBeat = 1f;
|
||||
Jukebox.PlayOneShot("miss");
|
||||
status = FlyStatus.NG;
|
||||
|
||||
BeatAction.New(joe.gameObject, new List<BeatAction.Action>()
|
||||
{
|
||||
new BeatAction.Action(startBeat + 2f, delegate {
|
||||
joe.SetFaceExpression((int) KarateMan.KarateManFaces.Sad);
|
||||
}),
|
||||
new BeatAction.Action(startBeat + 6f, delegate {
|
||||
joe.SetFaceExpression((int) KarateMan.KarateManFaces.Normal);
|
||||
}),
|
||||
});
|
||||
}
|
||||
else {
|
||||
ItemHitEffect();
|
||||
BeatAction.New(joe.gameObject, new List<BeatAction.Action>()
|
||||
{
|
||||
new BeatAction.Action(startBeat + 1.5f, delegate {
|
||||
joe.SetFaceExpression((int) KarateMan.KarateManFaces.Happy);
|
||||
}),
|
||||
new BeatAction.Action(startBeat + 3.5f, delegate {
|
||||
joe.SetFaceExpression((int) KarateMan.KarateManFaces.Normal);
|
||||
})
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
||||
public void ComboEndThrough(PlayerActionEvent caller)
|
||||
{
|
||||
if (GameManager.instance.currentGame != "karateman") return;
|
||||
if (status != FlyStatus.Fly || gameObject == null) return;
|
||||
var joe = KarateMan.instance.Joe;
|
||||
if (joe.GetComboId() != comboId || !joe.inCombo)
|
||||
{
|
||||
BeatAction.New(joe.gameObject, new List<BeatAction.Action>()
|
||||
{
|
||||
new BeatAction.Action(startBeat + 2f, delegate {
|
||||
//TODO: play miss sound
|
||||
//deduct flow if applicable
|
||||
joe.SetFaceExpression((int) KarateMan.KarateManFaces.Surprise);
|
||||
}),
|
||||
new BeatAction.Action(startBeat + 6f, delegate {
|
||||
if (joe.wantFace == -1)
|
||||
joe.SetFaceExpression((int) KarateMan.KarateManFaces.Normal);
|
||||
}),
|
||||
});
|
||||
}
|
||||
else
|
||||
{
|
||||
joe.SetFaceExpression((int) KarateMan.KarateManFaces.VerySad);
|
||||
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);
|
||||
}),
|
||||
new BeatAction.Action(startBeat + 2f, delegate {
|
||||
joe.SetFaceExpression((int) KarateMan.KarateManFaces.VerySad);
|
||||
}),
|
||||
new BeatAction.Action(startBeat + 5f, delegate {
|
||||
joe.SetFaceExpression((int) KarateMan.KarateManFaces.Normal);
|
||||
})
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
public void ComboEndWrongAction(PlayerActionEvent caller, float state)
|
||||
{
|
||||
if (GameManager.instance.currentGame != "karateman") return;
|
||||
KarateMan.instance.Joe.Punch(1);
|
||||
}
|
||||
|
||||
public void ComboEndWrongActionAlt(PlayerActionEvent caller, float state)
|
||||
{
|
||||
if (GameManager.instance.currentGame != "karateman") return;
|
||||
KarateMan.instance.Joe.ForceFailCombo(Conductor.instance.songPositionInBeats);
|
||||
}
|
||||
|
||||
public void KickChargeJustOrNg(PlayerActionEvent caller, float state)
|
||||
{
|
||||
if (GameManager.instance.currentGame != "karateman") return;
|
||||
var joe = KarateMan.instance.Joe;
|
||||
if (status == FlyStatus.Fly && !(joe.inKick || joe.wantKick || joe.inCombo)) {
|
||||
joe.Punch(ItemPunchHand());
|
||||
if (state <= -1f || state >= 1f) {
|
||||
startBeat = Conductor.instance.songPositionInBeats;
|
||||
CurrentCurve = ItemCurves[6];
|
||||
curveTargetBeat = 1f;
|
||||
Jukebox.PlayOneShot("miss");
|
||||
status = FlyStatus.NG;
|
||||
|
||||
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);
|
||||
}),
|
||||
});
|
||||
}
|
||||
else {
|
||||
joe.StartKickCharge(startBeat + 1.25f);
|
||||
ItemHitEffect();
|
||||
status = FlyStatus.Hit;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void KickChargeOut(PlayerActionEvent caller) {}
|
||||
|
||||
public void KickChargeThrough(PlayerActionEvent caller)
|
||||
{
|
||||
var joe = KarateMan.instance.Joe;
|
||||
if (GameManager.instance.currentGame != "karateman") return;
|
||||
if (status != FlyStatus.Fly || gameObject == null) return;
|
||||
BeatAction.New(joe.gameObject, new List<BeatAction.Action>()
|
||||
{
|
||||
new BeatAction.Action(startBeat + 2f, delegate {
|
||||
//TODO: play miss sound
|
||||
//deduct flow if applicable
|
||||
joe.SetFaceExpression((int) KarateMan.KarateManFaces.Surprise);
|
||||
}),
|
||||
new BeatAction.Action(startBeat + 6f, delegate {
|
||||
if (joe.wantFace == -1)
|
||||
joe.SetFaceExpression((int) KarateMan.KarateManFaces.Normal);
|
||||
}),
|
||||
});
|
||||
}
|
||||
|
||||
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;
|
||||
|
||||
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);
|
||||
}),
|
||||
});
|
||||
}
|
||||
else {
|
||||
ItemHitEffect();
|
||||
status = FlyStatus.Hit;
|
||||
CurrentCurve = ItemCurves[7];
|
||||
startBeat = Conductor.instance.songPositionInBeats;
|
||||
curveTargetBeat = 3f;
|
||||
|
||||
|
||||
BeatAction.New(joe.gameObject, new List<BeatAction.Action>()
|
||||
{
|
||||
new BeatAction.Action(startBeat + 1.25f, delegate {
|
||||
joe.SetFaceExpression((int) KarateMan.KarateManFaces.Smirk);
|
||||
}),
|
||||
new BeatAction.Action(startBeat + 4.25f, delegate {
|
||||
joe.SetFaceExpression((int) KarateMan.KarateManFaces.Normal);
|
||||
})
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void KickOut(PlayerActionEvent caller) {}
|
||||
|
||||
public void KickThrough(PlayerActionEvent caller)
|
||||
{
|
||||
if (GameManager.instance.currentGame != "karateman") return;
|
||||
if (status != FlyStatus.Fly || gameObject == null) return;
|
||||
BeatAction.New(KarateMan.instance.Joe.gameObject, new List<BeatAction.Action>()
|
||||
{
|
||||
new BeatAction.Action(startBeat + 2f, delegate {
|
||||
//TODO: play miss sound
|
||||
//deduct flow if applicable
|
||||
KarateMan.instance.Joe.SetFaceExpression((int) KarateMan.KarateManFaces.VerySad);
|
||||
})
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
@ -1,5 +1,5 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 2e632abaf6c790c44919824cf6611975
|
||||
guid: 9fe0aa75ca1a42347aea0b0b14b024a4
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
@ -1,417 +0,0 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
using HeavenStudio.Util;
|
||||
|
||||
namespace HeavenStudio.Games.Scripts_KarateMan
|
||||
{
|
||||
public class Pot : PlayerActionObject
|
||||
{
|
||||
public float startBeat;
|
||||
public float createBeat;
|
||||
[HideInInspector] public Animator anim;
|
||||
|
||||
public GameObject Holder;
|
||||
private GameObject newHolder;
|
||||
public GameObject Sprite;
|
||||
public GameObject BulbLightSprite;
|
||||
public GameObject CookingPotLid;
|
||||
private SpriteRenderer spriteComp;
|
||||
public GameObject Shadow;
|
||||
private SpriteRenderer shadowSpriteComp;
|
||||
private SpriteRenderer bulbLightSpriteComp;
|
||||
|
||||
public bool isThrown;
|
||||
public bool isHit = false;
|
||||
|
||||
public float hitBeat;
|
||||
|
||||
private Vector3 lastPos;
|
||||
private float lastShadowX;
|
||||
|
||||
public AnimationCurve hitCurve;
|
||||
public AnimationCurve hitCurveY;
|
||||
public AnimationCurve hitCurveX;
|
||||
public AnimationCurve missCurve;
|
||||
public AnimationCurve shadowCurve;
|
||||
public AnimationCurve shadowCurveScale;
|
||||
|
||||
public int type;
|
||||
public string hitSnd;
|
||||
|
||||
private float hitLength;
|
||||
|
||||
private float lastRot;
|
||||
|
||||
public bool kick;
|
||||
|
||||
public float lastPotRot;
|
||||
|
||||
public string throwAnim;
|
||||
public bool combo;
|
||||
public int comboIndex;
|
||||
|
||||
public Vector2 endShadowThrowPos;
|
||||
|
||||
private int missTimes = 0;
|
||||
|
||||
public void Init()
|
||||
{
|
||||
anim = GetComponent<Animator>();
|
||||
spriteComp = Sprite.GetComponent<SpriteRenderer>();
|
||||
shadowSpriteComp = Shadow.GetComponent<SpriteRenderer>();
|
||||
bulbLightSpriteComp = BulbLightSprite.GetComponent<SpriteRenderer>();
|
||||
|
||||
Sprite.transform.eulerAngles = new Vector3(0, 0, Random.Range(0, 360));
|
||||
BulbLightSprite.transform.eulerAngles = Sprite.transform.eulerAngles;
|
||||
|
||||
hitLength = 14f;
|
||||
|
||||
if (type == 6)
|
||||
CookingPotLid.SetActive(true);
|
||||
|
||||
/*if (combo)
|
||||
{
|
||||
if (comboIndex == 0)
|
||||
{
|
||||
isEligible = true;
|
||||
// PlayerActionInit(this.gameObject, createBeat, KarateMan.instance.EligibleCombos);
|
||||
}
|
||||
else if (comboIndex == 5)
|
||||
{
|
||||
isEligible = true;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
isEligible = true;
|
||||
// PlayerActionInit(this.gameObject, createBeat, KarateMan.instance.EligibleHits);
|
||||
}*/
|
||||
|
||||
PlayerActionInit(this.gameObject, createBeat);
|
||||
|
||||
spriteComp.enabled = false;
|
||||
}
|
||||
|
||||
public override void OnAce()
|
||||
{
|
||||
if (combo)
|
||||
{
|
||||
if (comboIndex == 0)
|
||||
{
|
||||
KarateJoe.instance.Combo(this);
|
||||
}
|
||||
else if (comboIndex == 5)
|
||||
{
|
||||
KarateJoe.instance.ComboPow(this, true);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
this.Hit();
|
||||
}
|
||||
// KarateJoe.instance.Swing(state);
|
||||
}
|
||||
|
||||
private void Update()
|
||||
{
|
||||
if (Conductor.instance.songPositionInBeats >= createBeat)
|
||||
{
|
||||
spriteComp.enabled = true;
|
||||
shadowSpriteComp.color = KarateMan.instance.GetShadowColor();
|
||||
}
|
||||
else
|
||||
{
|
||||
spriteComp.enabled = false;
|
||||
}
|
||||
|
||||
float time2Destroy = Conductor.instance.GetPositionFromBeat(createBeat, 4);
|
||||
|
||||
if (time2Destroy >= 1)
|
||||
Destroy(this.gameObject);
|
||||
|
||||
if (isThrown)
|
||||
{
|
||||
float animTime = 2.22000000002f;
|
||||
float beatTime = 1f;
|
||||
if (comboIndex == 5)
|
||||
{
|
||||
animTime = 2.27777777777f;
|
||||
}
|
||||
|
||||
float normalizedBeatAnim = Conductor.instance.GetPositionFromBeat(startBeat, animTime);
|
||||
anim.Play(throwAnim, 0, normalizedBeatAnim);
|
||||
anim.speed = 0;
|
||||
|
||||
float normalizedBeat = Conductor.instance.GetPositionFromBeat(startBeat, beatTime);
|
||||
|
||||
Shadow.transform.localScale = Vector3.Lerp(new Vector3(4.12f, 4.12f), new Vector3(0.34f, 0.34f), shadowCurveScale.Evaluate(normalizedBeatAnim));
|
||||
Shadow.transform.localPosition = new Vector3(Mathf.Lerp(7.63f, endShadowThrowPos.x, shadowCurve.Evaluate(normalizedBeatAnim)), Mathf.Lerp(-12.26f, endShadowThrowPos.y, shadowCurve.Evaluate(normalizedBeatAnim)));
|
||||
|
||||
lastPos = Holder.transform.localPosition;
|
||||
lastPotRot = Holder.transform.eulerAngles.z;
|
||||
lastShadowX = Shadow.transform.localPosition.x;
|
||||
lastRot = Holder.transform.GetChild(0).eulerAngles.z;
|
||||
|
||||
if (combo && comboIndex == 0 || !combo)
|
||||
{
|
||||
if (!KarateJoe.instance.hitCombo)
|
||||
{
|
||||
if (normalizedBeat >= 2 && missTimes == 0)
|
||||
{
|
||||
if (KarateJoe.instance.missC != null) StopCoroutine(KarateJoe.instance.missC);
|
||||
KarateJoe.instance.missC = KarateJoe.instance.StartCoroutine(KarateJoe.instance.Miss());
|
||||
missTimes = 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
StateCheck(normalizedBeat);
|
||||
|
||||
if (!combo)
|
||||
{
|
||||
if (PlayerInput.Pressed())
|
||||
{
|
||||
if (state.perfect)
|
||||
{
|
||||
Hit();
|
||||
}
|
||||
else if (state.notPerfect())
|
||||
{
|
||||
Miss();
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (comboIndex == 0)
|
||||
{
|
||||
if (PlayerInput.AltPressed())
|
||||
{
|
||||
if (state.perfect)
|
||||
{
|
||||
KarateJoe.instance.Combo(this);
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (comboIndex == 5)
|
||||
{
|
||||
if (KarateJoe.instance.comboNormalizedBeat >= 2.05f)
|
||||
if (PlayerInput.AltPressedUp())
|
||||
{
|
||||
KarateJoe.instance.ComboPow(this);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (normalizedBeat > 1)
|
||||
{
|
||||
spriteComp.sortingOrder = -20;
|
||||
bulbLightSpriteComp.sortingOrder = -20;
|
||||
shadowSpriteComp.sortingOrder = -30;
|
||||
}
|
||||
else
|
||||
{
|
||||
// Pots closer to Joe are sorted further back.
|
||||
int newOrder = 60 - Mathf.RoundToInt(10f * normalizedBeat);
|
||||
spriteComp.sortingOrder = newOrder;
|
||||
bulbLightSpriteComp.sortingOrder = newOrder;
|
||||
}
|
||||
}
|
||||
|
||||
if (!isHit && !isThrown)
|
||||
{
|
||||
float normalizedBeatAnim = Conductor.instance.GetPositionFromBeat(hitBeat, 1.5f);
|
||||
newHolder.transform.localPosition = new Vector3(transform.localPosition.x, Mathf.Lerp(0, 0.55f, Conductor.instance.GetPositionFromBeat(hitBeat, 0.45f)));
|
||||
Holder.transform.localPosition = new Vector3(Mathf.Lerp(lastPos.x, 0.9f, normalizedBeatAnim), Mathf.Lerp(lastPos.y, -3.43f, missCurve.Evaluate(normalizedBeatAnim)));
|
||||
Holder.transform.GetChild(0).transform.eulerAngles = new Vector3(0, 0, Mathf.Lerp(lastRot, lastRot - 523.203f, normalizedBeatAnim));
|
||||
Shadow.transform.localPosition = new Vector3(Mathf.Lerp(lastShadowX, 0.9f, normalizedBeatAnim), Shadow.transform.localPosition.y);
|
||||
}
|
||||
|
||||
if (kick == false)
|
||||
{
|
||||
if (isHit)
|
||||
{
|
||||
float normalizedBeatAnim = Conductor.instance.GetPositionFromBeat(hitBeat, 1.5f);
|
||||
var y = Mathf.Lerp(lastPos.y, -3.27f, hitCurve.Evaluate(normalizedBeatAnim));
|
||||
var x = Mathf.Lerp(lastPos.x, hitLength, hitCurveX.Evaluate(normalizedBeatAnim));
|
||||
newHolder.transform.localPosition = new Vector3(transform.localPosition.x, Mathf.Lerp(0, 0.45f, hitCurveY.Evaluate(normalizedBeatAnim)));
|
||||
Holder.transform.localPosition = new Vector3(x, y);
|
||||
Shadow.transform.localPosition = new Vector3(Mathf.Lerp(lastShadowX, hitLength, hitCurveX.Evaluate(normalizedBeatAnim)), Shadow.transform.localPosition.y);
|
||||
Holder.transform.eulerAngles = new Vector3(0, 0, Mathf.Lerp(lastPotRot, lastPotRot - 360, normalizedBeatAnim));
|
||||
// anim.Play("PotHit", 0, normalizedBeatAnim);
|
||||
// anim.speed = 0;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (isHit)
|
||||
{
|
||||
float normalizedBeatAnim = Conductor.instance.GetPositionFromBeat(hitBeat, 1.5f);
|
||||
newHolder.transform.localPosition = new Vector3(transform.localPosition.x, Mathf.Lerp(0, 0.55f, Conductor.instance.GetPositionFromBeat(hitBeat, 0.45f)));
|
||||
Holder.transform.localPosition = new Vector3(Mathf.Lerp(lastPos.x, 0.9f, normalizedBeatAnim), Mathf.Lerp(lastPos.y, -3.43f, missCurve.Evaluate(normalizedBeatAnim)));
|
||||
Holder.transform.GetChild(0).transform.eulerAngles = new Vector3(0, 0, Mathf.Lerp(lastRot, lastRot - 523.203f, normalizedBeatAnim));
|
||||
Shadow.transform.localPosition = new Vector3(Mathf.Lerp(lastShadowX, 0.9f, normalizedBeatAnim), Shadow.transform.localPosition.y);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void Hit()
|
||||
{
|
||||
Jukebox.PlayOneShotGame(hitSnd);
|
||||
KarateJoe.instance.Swing(this);
|
||||
|
||||
NewHolder();
|
||||
|
||||
switch (type)
|
||||
{
|
||||
case 0:
|
||||
if(!combo) KarateMan.instance.potHitEffect.Play();
|
||||
break;
|
||||
case 1:
|
||||
GameObject bulbHit = Instantiate(KarateJoe.instance.BulbHit);
|
||||
bulbHit.transform.parent = KarateJoe.instance.BulbHit.transform.parent;
|
||||
bulbHit.SetActive(true);
|
||||
Destroy(bulbHit, 0.7f);
|
||||
break;
|
||||
case 2:
|
||||
// TODO: Rock destroy particle effect
|
||||
break;
|
||||
case 4:
|
||||
BarrelDestroy(false);
|
||||
break;
|
||||
case 6:
|
||||
// TODO: Rock destroy particle effect
|
||||
CookingPotLid.SetActive(false);
|
||||
CookingPotDestroy();
|
||||
break;
|
||||
case 999:
|
||||
Jukebox.PlayOneShotGame("karateman/rockHit");
|
||||
break;
|
||||
}
|
||||
|
||||
if (!kick)
|
||||
{
|
||||
|
||||
}
|
||||
else if (kick)
|
||||
{
|
||||
KarateMan.instance.CreateBomb(this.transform.parent, Holder.transform.localScale, ref Shadow);
|
||||
|
||||
Destroy(this.gameObject);
|
||||
}
|
||||
|
||||
hitBeat = Conductor.instance.songPositionInBeats;
|
||||
|
||||
anim.enabled = false;
|
||||
isThrown = false;
|
||||
isHit = true;
|
||||
|
||||
spriteComp.sortingOrder = 49;
|
||||
bulbLightSpriteComp.sortingOrder = 49;
|
||||
}
|
||||
|
||||
public void Miss()
|
||||
{
|
||||
Jukebox.PlayOneShot("miss");
|
||||
|
||||
KarateJoe.instance.SetHead(3);
|
||||
|
||||
NewHolder();
|
||||
Holder.transform.parent = newHolder.transform;
|
||||
|
||||
hitBeat = Conductor.instance.songPositionInBeats;
|
||||
isHit = false;
|
||||
isThrown = false;
|
||||
anim.enabled = false;
|
||||
spriteComp.sortingOrder = 49;
|
||||
bulbLightSpriteComp.sortingOrder = 49;
|
||||
}
|
||||
|
||||
private void NewHolder()
|
||||
{
|
||||
newHolder = new GameObject();
|
||||
newHolder.transform.parent = this.gameObject.transform;
|
||||
Holder.transform.parent = newHolder.transform;
|
||||
}
|
||||
|
||||
public void CookingPotDestroy()
|
||||
{
|
||||
GameObject lid = new GameObject();
|
||||
lid.transform.localPosition = Holder.transform.localPosition;
|
||||
lid.transform.parent = transform.parent;
|
||||
lid.transform.localScale = Holder.transform.localScale;
|
||||
|
||||
CookingPotDestroyEffect cpde = lid.AddComponent<CookingPotDestroyEffect>();
|
||||
cpde.pot = Sprite;
|
||||
}
|
||||
|
||||
public void BarrelDestroy(bool combo)
|
||||
{
|
||||
for (int i = 0; i < 8; i++)
|
||||
{
|
||||
GameObject be = new GameObject();
|
||||
be.transform.localPosition = Holder.transform.localPosition;
|
||||
be.transform.parent = this.transform.parent;
|
||||
be.transform.localScale = Holder.transform.localScale;
|
||||
BarrelDestroyEffect bde = be.AddComponent<BarrelDestroyEffect>();
|
||||
Vector3 pos = be.transform.localPosition;
|
||||
SpriteRenderer sprite = be.AddComponent<SpriteRenderer>();
|
||||
|
||||
bde.shadow = Instantiate(Shadow, transform.parent);
|
||||
bde.shadow.transform.position = Shadow.transform.position;
|
||||
bde.shadow.transform.localScale = Shadow.transform.lossyScale;
|
||||
bde.index = i;
|
||||
bde.combo = combo;
|
||||
|
||||
switch (i)
|
||||
{
|
||||
case 0:
|
||||
be.transform.localPosition = new Vector3(pos.x, pos.y + 1.25f);
|
||||
sprite.sortingOrder = 35;
|
||||
bde.spriteIndex = 3;
|
||||
break;
|
||||
case 1:
|
||||
be.transform.localPosition = new Vector3(pos.x, pos.y + -0.55f);
|
||||
sprite.sortingOrder = 31;
|
||||
bde.spriteIndex = 3;
|
||||
break;
|
||||
case 2:
|
||||
be.transform.localPosition = new Vector3(pos.x - 0.8f, pos.y + 0.45f);
|
||||
sprite.sortingOrder = 32;
|
||||
bde.spriteIndex = 0;
|
||||
break;
|
||||
case 3:
|
||||
be.transform.localPosition = new Vector3(pos.x - 0.5f, pos.y + 0.45f);
|
||||
sprite.sortingOrder = 33;
|
||||
bde.spriteIndex = 1;
|
||||
break;
|
||||
case 4:
|
||||
be.transform.localPosition = new Vector3(pos.x, pos.y + 0.45f);
|
||||
sprite.sortingOrder = 34;
|
||||
bde.spriteIndex = 2;
|
||||
break;
|
||||
case 5:
|
||||
be.transform.localPosition = new Vector3(pos.x + 0.5f, pos.y + 0.45f);
|
||||
sprite.sortingOrder = 33;
|
||||
sprite.flipX = true;
|
||||
bde.spriteIndex = 1;
|
||||
break;
|
||||
case 6:
|
||||
be.transform.localPosition = new Vector3(pos.x + 0.8f, pos.y + 0.45f);
|
||||
sprite.sortingOrder = 32;
|
||||
sprite.flipX = true;
|
||||
bde.spriteIndex = 0;
|
||||
break;
|
||||
case 7:
|
||||
be.transform.localPosition = new Vector3(pos.x, pos.y + 1.25f);
|
||||
sprite.sortingOrder = 39;
|
||||
bde.spriteIndex = 4;
|
||||
break;
|
||||
}
|
||||
bde.Init();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -1,11 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: cb91a911973ab024faefab997af96bd7
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@ -6,7 +6,7 @@ namespace HeavenStudio.Games
|
||||
{
|
||||
public class Minigame : MonoBehaviour
|
||||
{
|
||||
public static float earlyTime = 0.1f, perfectTime = 0.06f, lateTime = 0.06f, endTime = 0.1f;
|
||||
public static float earlyTime = 0.1f, perfectTime = 0.08f, aceEarlyTime = 0.02f, aceLateTime = 0.02f, lateTime = 0.08f, endTime = 0.1f;
|
||||
public List<Minigame.Eligible> EligibleHits = new List<Minigame.Eligible>();
|
||||
|
||||
[System.Serializable]
|
||||
|
@ -101,22 +101,22 @@ namespace HeavenStudio.Games
|
||||
// Forgive me for those input type names
|
||||
return (
|
||||
//General inputs, both down and up
|
||||
(PlayerInput.Pressed() && inputType == InputType.STANDARD_DOWN) ||
|
||||
(PlayerInput.AltPressed() && inputType == InputType.STANDARD_ALT_DOWN) ||
|
||||
(PlayerInput.GetAnyDirectionDown() && inputType == InputType.DIRECTION_DOWN) ||
|
||||
(PlayerInput.PressedUp() && inputType == InputType.STANDARD_UP) ||
|
||||
(PlayerInput.AltPressedUp() && inputType == InputType.STANDARD_ALT_UP) ||
|
||||
(PlayerInput.GetAnyDirectionUp() && inputType == InputType.DIRECTION_UP) ||
|
||||
(PlayerInput.Pressed() && inputType.HasFlag(InputType.STANDARD_DOWN)) ||
|
||||
(PlayerInput.AltPressed() && inputType.HasFlag(InputType.STANDARD_ALT_DOWN)) ||
|
||||
(PlayerInput.GetAnyDirectionDown() && inputType.HasFlag(InputType.DIRECTION_DOWN)) ||
|
||||
(PlayerInput.PressedUp() && inputType.HasFlag(InputType.STANDARD_UP)) ||
|
||||
(PlayerInput.AltPressedUp() && inputType.HasFlag(InputType.STANDARD_ALT_UP)) ||
|
||||
(PlayerInput.GetAnyDirectionUp() && inputType.HasFlag(InputType.DIRECTION_UP)) ||
|
||||
//Specific directional inputs
|
||||
(PlayerInput.GetSpecificDirectionDown(PlayerInput.DOWN) && inputType == InputType.DIRECTION_DOWN_DOWN) ||
|
||||
(PlayerInput.GetSpecificDirectionDown(PlayerInput.UP) && inputType == InputType.DIRECTION_UP_DOWN) ||
|
||||
(PlayerInput.GetSpecificDirectionDown(PlayerInput.LEFT) && inputType == InputType.DIRECTION_LEFT_DOWN) ||
|
||||
(PlayerInput.GetSpecificDirectionDown(PlayerInput.RIGHT) && inputType == InputType.DIRECTION_RIGHT_DOWN) ||
|
||||
(PlayerInput.GetSpecificDirectionDown(PlayerInput.DOWN) && inputType.HasFlag(InputType.DIRECTION_DOWN_DOWN)) ||
|
||||
(PlayerInput.GetSpecificDirectionDown(PlayerInput.UP) && inputType.HasFlag(InputType.DIRECTION_UP_DOWN)) ||
|
||||
(PlayerInput.GetSpecificDirectionDown(PlayerInput.LEFT) && inputType.HasFlag(InputType.DIRECTION_LEFT_DOWN)) ||
|
||||
(PlayerInput.GetSpecificDirectionDown(PlayerInput.RIGHT) && inputType.HasFlag(InputType.DIRECTION_RIGHT_DOWN)) ||
|
||||
|
||||
(PlayerInput.GetSpecificDirectionUp(PlayerInput.DOWN) && inputType == InputType.DIRECTION_DOWN_UP) ||
|
||||
(PlayerInput.GetSpecificDirectionUp(PlayerInput.UP) && inputType == InputType.DIRECTION_UP_UP) ||
|
||||
(PlayerInput.GetSpecificDirectionUp(PlayerInput.LEFT) && inputType == InputType.DIRECTION_LEFT_UP) ||
|
||||
(PlayerInput.GetSpecificDirectionUp(PlayerInput.RIGHT) && inputType == InputType.DIRECTION_RIGHT_UP)
|
||||
(PlayerInput.GetSpecificDirectionUp(PlayerInput.DOWN) && inputType.HasFlag(InputType.DIRECTION_DOWN_UP)) ||
|
||||
(PlayerInput.GetSpecificDirectionUp(PlayerInput.UP) && inputType.HasFlag(InputType.DIRECTION_UP_UP)) ||
|
||||
(PlayerInput.GetSpecificDirectionUp(PlayerInput.LEFT) && inputType.HasFlag(InputType.DIRECTION_LEFT_UP)) ||
|
||||
(PlayerInput.GetSpecificDirectionUp(PlayerInput.RIGHT) && inputType.HasFlag(InputType.DIRECTION_RIGHT_UP))
|
||||
);
|
||||
}
|
||||
|
||||
|
@ -5,30 +5,31 @@ using UnityEngine;
|
||||
|
||||
namespace HeavenStudio
|
||||
{
|
||||
[System.Flags]
|
||||
public enum InputType : int {
|
||||
|
||||
//General
|
||||
//-------
|
||||
//Down
|
||||
STANDARD_DOWN = 0,
|
||||
STANDARD_ALT_DOWN = 1,
|
||||
DIRECTION_DOWN = 2,
|
||||
STANDARD_DOWN = 1<<0,
|
||||
STANDARD_ALT_DOWN = 1<<1,
|
||||
DIRECTION_DOWN = 1<<2,
|
||||
//Up
|
||||
STANDARD_UP = 3,
|
||||
STANDARD_ALT_UP = 4,
|
||||
DIRECTION_UP = 5,
|
||||
STANDARD_UP = 1<<3,
|
||||
STANDARD_ALT_UP = 1<<4,
|
||||
DIRECTION_UP = 1<<5,
|
||||
|
||||
//Specific
|
||||
//--------
|
||||
//Down
|
||||
DIRECTION_DOWN_DOWN = 6,
|
||||
DIRECTION_UP_DOWN = 7,
|
||||
DIRECTION_LEFT_DOWN = 8,
|
||||
DIRECTION_RIGHT_DOWN = 9,
|
||||
DIRECTION_DOWN_DOWN = 1<<6,
|
||||
DIRECTION_UP_DOWN = 1<<7,
|
||||
DIRECTION_LEFT_DOWN = 1<<8,
|
||||
DIRECTION_RIGHT_DOWN = 1<<9,
|
||||
//Up
|
||||
DIRECTION_DOWN_UP = 10,
|
||||
DIRECTION_UP_UP = 11,
|
||||
DIRECTION_LEFT_UP = 12,
|
||||
DIRECTION_RIGHT_UP = 13
|
||||
DIRECTION_DOWN_UP = 1<<10,
|
||||
DIRECTION_UP_UP = 1<<11,
|
||||
DIRECTION_LEFT_UP = 1<<12,
|
||||
DIRECTION_RIGHT_UP = 1<<13
|
||||
}
|
||||
}
|
@ -24,7 +24,7 @@ namespace HeavenStudio.Util
|
||||
{
|
||||
float pos = Conductor.instance.GetPositionFromBeat(startTime, length) * timeScale;
|
||||
anim.Play(animName, animLayer, pos);
|
||||
anim.speed = 0;
|
||||
anim.speed = 1f; //not 0 so these can still play their script events
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@ -37,7 +37,7 @@ namespace HeavenStudio.Util
|
||||
public static void DoNormalizedAnimation(this Animator anim, string animName, float pos = 0f, int animLayer = -1)
|
||||
{
|
||||
anim.Play(animName, animLayer, pos);
|
||||
anim.speed = 0;
|
||||
anim.speed = 1f;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
Reference in New Issue
Block a user