mirror of
https://github.com/RHeavenStudioPlus/HeavenStudioPlus.git
synced 2024-11-27 12:03:00 +00:00
66 lines
No EOL
2 KiB
C#
66 lines
No EOL
2 KiB
C#
using System.Collections;
|
|
using System.Collections.Generic;
|
|
using UnityEngine;
|
|
|
|
using RhythmHeavenMania.Util;
|
|
|
|
namespace RhythmHeavenMania.Games.SpaceSoccer
|
|
{
|
|
public class SpaceSoccer : Minigame
|
|
{
|
|
[Header("Components")]
|
|
[SerializeField] private GameObject ballRef;
|
|
[SerializeField] private List<Kicker> kickers;
|
|
[SerializeField] private GameObject Background;
|
|
[SerializeField] private Sprite[] backgroundSprite;
|
|
|
|
[Header("Properties")]
|
|
[SerializeField] private bool ballDispensed; //unused
|
|
|
|
public static SpaceSoccer instance { get; private set; }
|
|
|
|
private void Awake()
|
|
{
|
|
instance = this;
|
|
}
|
|
|
|
private void Start()
|
|
{
|
|
/*for (int x = 0; x < Random.Range(9, 12); x++)
|
|
{
|
|
for (int y = 0; y < Random.Range(6, 9); y++)
|
|
{
|
|
GameObject test = new GameObject("test");
|
|
test.transform.parent = Background.transform;
|
|
test.AddComponent<SpriteRenderer>().sprite = backgroundSprite[Random.Range(0, 2)];
|
|
test.GetComponent<SpriteRenderer>().sortingOrder = -50;
|
|
test.transform.localPosition = new Vector3(Random.Range(-15f, 15f), Random.Range(-15f, 15f));
|
|
test.transform.localScale = new Vector3(0.52f, 0.52f);
|
|
}
|
|
}*/
|
|
}
|
|
|
|
private void Update()
|
|
{
|
|
|
|
}
|
|
|
|
public void Dispense(float beat)
|
|
{
|
|
for (int i = 0; i < kickers.Count; i++)
|
|
{
|
|
Kicker kicker = kickers[i];
|
|
if (i == 0) kicker.player = true;
|
|
|
|
if (kicker.ball != null) return;
|
|
ballDispensed = true;
|
|
|
|
GameObject ball = Instantiate(ballRef, transform);
|
|
ball.SetActive(true);
|
|
Ball ball_ = ball.GetComponent<Ball>();
|
|
ball_.Init(kicker, beat);
|
|
}
|
|
}
|
|
}
|
|
|
|
} |