HeavenStudioPlus/Assets/Scripts/Games/KarateMan/KarateMan.cs

59 lines
1.5 KiB
C#
Raw Normal View History

2021-12-29 06:52:48 +00:00
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using RhythmHeavenMania.Util;
namespace RhythmHeavenMania.Games.KarateMan
{
public class KarateMan : Minigame
{
public GameObject Pot;
2021-12-30 08:26:18 +00:00
public KarateJoe KarateJoe;
2021-12-29 06:52:48 +00:00
public static KarateMan instance { get; set; }
2021-12-30 08:26:18 +00:00
public Sprite[] ObjectSprites;
2021-12-29 06:52:48 +00:00
private void Awake()
{
instance = this;
}
2021-12-30 08:26:18 +00:00
public void Shoot(float beat, int type)
2021-12-29 06:52:48 +00:00
{
GameObject pot = Instantiate(Pot);
pot.transform.parent = Pot.transform.parent;
2021-12-30 08:26:18 +00:00
Pot p = pot.GetComponent<Pot>();
2021-12-29 06:52:48 +00:00
pot.SetActive(true);
2021-12-30 08:26:18 +00:00
p.startBeat = beat;
p.createBeat = beat;
p.isThrown = true;
p.type = type;
p.Sprite.GetComponent<SpriteRenderer>().sprite = ObjectSprites[type];
2021-12-29 06:52:48 +00:00
2021-12-30 08:26:18 +00:00
switch (type)
{
case 0:
Jukebox.PlayOneShotGame("karateman/objectOut");
p.hitSnd = "karateman/potHit";
break;
case 1:
Jukebox.PlayOneShotGame("karateman/lightbulbOut");
p.hitSnd = "karateman/lightbulbHit";
break;
case 2:
Jukebox.PlayOneShotGame("karateman/objectOut");
p.hitSnd = "karateman/rockHit";
break;
}
}
public void Bop()
{
KarateJoe.anim.Play("Bop", 0, 0);
2021-12-29 06:52:48 +00:00
}
}
}