mirror of
https://github.com/RHeavenStudio/HeavenStudio.git
synced 2025-06-12 17:57:39 +02:00
Merge pull request #33 from CarsonKompon/karate-man-new-hits
Added Cooking Pot, Alien, and Pot hit stars to Karate Man
This commit is contained in:
53
Assets/Scripts/Games/KarateMan/CookingPotDestroyEffect.cs
Normal file
53
Assets/Scripts/Games/KarateMan/CookingPotDestroyEffect.cs
Normal file
@ -0,0 +1,53 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
using DG.Tweening;
|
||||
|
||||
namespace RhythmHeavenMania.Games.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 Start()
|
||||
{
|
||||
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);
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 523d89bc8ebbac84dbe347ffa8fb0c04
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@ -12,8 +12,6 @@ namespace RhythmHeavenMania.Games.KarateMan
|
||||
[Header("Components")]
|
||||
public Animator anim;
|
||||
public GameObject HitEffect;
|
||||
public ParticleSystem HitParticle;
|
||||
public ParticleSystem RockParticle;
|
||||
public GameObject BulbHit;
|
||||
[SerializeField] private SpriteRenderer head;
|
||||
[SerializeField] private Sprite[] heads;
|
||||
@ -268,7 +266,7 @@ namespace RhythmHeavenMania.Games.KarateMan
|
||||
}
|
||||
else
|
||||
{
|
||||
if (p.type == 2 || p.type == 3 || p.type == 4 || p.type == 6)
|
||||
if (p.type == 2 || p.type == 3 || p.type == 4 || p.type == 6 || p.type == 999)
|
||||
{
|
||||
punchLeft = false;
|
||||
}
|
||||
|
@ -14,7 +14,10 @@ namespace RhythmHeavenMania.Games.KarateMan
|
||||
Pot = 0,
|
||||
Rock = 2,
|
||||
Ball = 3,
|
||||
TacoBell = 6
|
||||
CookingPot = 6,
|
||||
Alien = 7,
|
||||
|
||||
TacoBell = 999
|
||||
}
|
||||
|
||||
public enum LightBulbType
|
||||
@ -65,6 +68,8 @@ namespace RhythmHeavenMania.Games.KarateMan
|
||||
|
||||
public Sprite[] ObjectSprites;
|
||||
public Sprite[] BarrelSprites;
|
||||
public Sprite[] CookingPotSprites;
|
||||
public Sprite[] OtherSprites;
|
||||
|
||||
public List<BGSpriteC> BGSprites;
|
||||
public SpriteRenderer BGSprite;
|
||||
@ -84,6 +89,8 @@ namespace RhythmHeavenMania.Games.KarateMan
|
||||
|
||||
private float bgBeat;
|
||||
|
||||
public ParticleSystem potHitEffect;
|
||||
|
||||
public GameObject comboRef;
|
||||
|
||||
public GameObject HIT3Ref;
|
||||
@ -150,7 +157,9 @@ namespace RhythmHeavenMania.Games.KarateMan
|
||||
p.createBeat = beat;
|
||||
p.isThrown = true;
|
||||
p.type = type;
|
||||
p.Sprite.GetComponent<SpriteRenderer>().sprite = ObjectSprites[type];
|
||||
|
||||
if(type <= ObjectSprites.Length)
|
||||
p.Sprite.GetComponent<SpriteRenderer>().sprite = ObjectSprites[type];
|
||||
|
||||
if (combo)
|
||||
{
|
||||
@ -210,7 +219,25 @@ namespace RhythmHeavenMania.Games.KarateMan
|
||||
});
|
||||
break;
|
||||
case 6:
|
||||
outSnd = "karateman/objectOut";
|
||||
if (Starpelly.Mathp.GetDecimalFromFloat(beat) == 0f)
|
||||
outSnd = "karateman/objectOut";
|
||||
else
|
||||
outSnd = "karateman/offbeatObjectOut";
|
||||
p.hitSnd = "karateman/cookingPot";
|
||||
break;
|
||||
case 7:
|
||||
if (Starpelly.Mathp.GetDecimalFromFloat(beat) == 0f)
|
||||
outSnd = "karateman/objectOut";
|
||||
else
|
||||
outSnd = "karateman/offbeatObjectOut";
|
||||
p.hitSnd = "karateman/alienHit";
|
||||
break;
|
||||
case 999:
|
||||
p.Sprite.GetComponent<SpriteRenderer>().sprite = OtherSprites[0];
|
||||
if (Starpelly.Mathp.GetDecimalFromFloat(beat) == 0f)
|
||||
outSnd = "karateman/objectOut";
|
||||
else
|
||||
outSnd = "karateman/offbeatObjectOut";
|
||||
p.hitSnd = "karateman/tacobell";
|
||||
break;
|
||||
}
|
||||
|
@ -16,6 +16,7 @@ namespace RhythmHeavenMania.Games.KarateMan
|
||||
private GameObject newHolder;
|
||||
public GameObject Sprite;
|
||||
public GameObject BulbLightSprite;
|
||||
public GameObject CookingPotLid;
|
||||
private SpriteRenderer spriteComp;
|
||||
public GameObject Shadow;
|
||||
private SpriteRenderer shadowSpriteComp;
|
||||
@ -70,6 +71,9 @@ namespace RhythmHeavenMania.Games.KarateMan
|
||||
else
|
||||
hitLength = 14f;
|
||||
|
||||
if (type == 6)
|
||||
CookingPotLid.SetActive(true);
|
||||
|
||||
/*if (combo)
|
||||
{
|
||||
if (comboIndex == 0)
|
||||
@ -266,7 +270,7 @@ namespace RhythmHeavenMania.Games.KarateMan
|
||||
switch (type)
|
||||
{
|
||||
case 0:
|
||||
// HitParticle.Play();
|
||||
KarateMan.instance.potHitEffect.Play();
|
||||
break;
|
||||
case 1:
|
||||
GameObject bulbHit = Instantiate(KarateJoe.instance.BulbHit);
|
||||
@ -275,11 +279,19 @@ namespace RhythmHeavenMania.Games.KarateMan
|
||||
Destroy(bulbHit, 0.7f);
|
||||
break;
|
||||
case 2:
|
||||
// RockParticle.Play();
|
||||
// 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)
|
||||
@ -327,6 +339,17 @@ namespace RhythmHeavenMania.Games.KarateMan
|
||||
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++)
|
||||
|
Reference in New Issue
Block a user