mirror of
https://github.com/RHeavenStudio/HeavenStudio.git
synced 2025-06-12 08:47:37 +02:00
Space soccer polish and editor preview button
This commit is contained in:
@ -51,13 +51,13 @@ namespace RhythmHeavenMania
|
||||
|
||||
public void Init()
|
||||
{
|
||||
this.transform.localScale = new Vector3(3000, 3000);
|
||||
this.transform.localScale = new Vector3(30000000, 30000000);
|
||||
SpriteRenderer sp = this.gameObject.AddComponent<SpriteRenderer>();
|
||||
sp.enabled = false;
|
||||
sp.color = Color.black;
|
||||
sp.sprite = Resources.Load<Sprite>("Sprites/GeneralPurpose/Square");
|
||||
sp.sortingOrder = 30000;
|
||||
this.gameObject.layer = 3;
|
||||
// this.gameObject.layer = 3;
|
||||
|
||||
if (txt != null)
|
||||
{
|
||||
|
@ -27,14 +27,15 @@ namespace RhythmHeavenMania.Games
|
||||
autoPlayEnabledOnStart = GameManager.instance.autoplay;
|
||||
}
|
||||
|
||||
private void CheckForAce(float normalizedBeat)
|
||||
private void CheckForAce(float normalizedBeat, bool autoPlay = false)
|
||||
{
|
||||
if (aceTimes == 0)
|
||||
{
|
||||
if (GameManager.instance.autoplay && normalizedBeat > 0.99f)
|
||||
if (GameManager.instance.autoplay && normalizedBeat > 0.99f || autoPlay && normalizedBeat > 0.99f)
|
||||
{
|
||||
OnAce();
|
||||
AceVisuals();
|
||||
if (!autoPlay)
|
||||
AceVisuals();
|
||||
// aceTimes++;
|
||||
}
|
||||
}
|
||||
@ -52,9 +53,9 @@ namespace RhythmHeavenMania.Games
|
||||
}
|
||||
|
||||
// could possibly add support for custom early, perfect, and end times if needed.
|
||||
public void StateCheck(float normalizedBeat)
|
||||
public void StateCheck(float normalizedBeat, bool autoPlay = false)
|
||||
{
|
||||
CheckForAce(normalizedBeat);
|
||||
CheckForAce(normalizedBeat, autoPlay);
|
||||
if (normalizedBeat > Minigame.EarlyTime() && normalizedBeat < Minigame.PerfectTime() && lastState == 0)
|
||||
{
|
||||
MakeEligible(true, false, false);
|
||||
|
@ -10,9 +10,10 @@ namespace RhythmHeavenMania.Games.SpaceSoccer
|
||||
public class Ball : MonoBehaviour
|
||||
{
|
||||
[Header("Components")]
|
||||
[SerializeField] private Kicker kicker;
|
||||
[HideInInspector] public Kicker kicker;
|
||||
[SerializeField] private GameObject holder;
|
||||
[SerializeField] private GameObject spriteHolder;
|
||||
[SerializeField] private GameObject kickFX;
|
||||
[Space(10)]
|
||||
[SerializeField] private BezierCurve3D dispenseCurve;
|
||||
[SerializeField] private BezierCurve3D kickCurve;
|
||||
@ -30,8 +31,13 @@ namespace RhythmHeavenMania.Games.SpaceSoccer
|
||||
public GameEvent toe = new GameEvent();
|
||||
private bool lastKickLeft;
|
||||
|
||||
public void Kick()
|
||||
private void Start()
|
||||
{
|
||||
}
|
||||
|
||||
public void Kick(bool player)
|
||||
{
|
||||
if (player)
|
||||
Jukebox.PlayOneShotGame("spaceSoccer/ballHit");
|
||||
|
||||
lastSpriteRot = spriteHolder.transform.eulerAngles.z;
|
||||
@ -54,6 +60,8 @@ namespace RhythmHeavenMania.Games.SpaceSoccer
|
||||
kickCurve.transform.localScale = new Vector3(1, 1);
|
||||
}
|
||||
kickCurve.KeyPoints[0].transform.position = holder.transform.position;
|
||||
|
||||
HitFX();
|
||||
}
|
||||
|
||||
public void HighKick()
|
||||
@ -68,6 +76,9 @@ namespace RhythmHeavenMania.Games.SpaceSoccer
|
||||
highKicked.startBeat = Conductor.instance.songPositionInBeats;
|
||||
|
||||
highKickCurve.KeyPoints[0].transform.position = holder.transform.position;
|
||||
|
||||
|
||||
HitFX();
|
||||
}
|
||||
|
||||
public void Toe()
|
||||
@ -81,7 +92,7 @@ namespace RhythmHeavenMania.Games.SpaceSoccer
|
||||
|
||||
toe.enabled = true;
|
||||
toe.startBeat = Conductor.instance.songPositionInBeats;
|
||||
|
||||
|
||||
toeCurve.KeyPoints[0].transform.position = holder.transform.position;
|
||||
if (lastKickLeft)
|
||||
{
|
||||
@ -91,6 +102,9 @@ namespace RhythmHeavenMania.Games.SpaceSoccer
|
||||
{
|
||||
toeCurve.KeyPoints[1].transform.localPosition = new Vector3(6.49f, 0);
|
||||
}
|
||||
|
||||
|
||||
HitFX();
|
||||
}
|
||||
|
||||
private void Update()
|
||||
@ -98,6 +112,10 @@ namespace RhythmHeavenMania.Games.SpaceSoccer
|
||||
if (dispensing)
|
||||
{
|
||||
float normalizedBeatAnim = Conductor.instance.GetLoopPositionFromBeat(dispensedBeat, 2.35f);
|
||||
|
||||
dispenseCurve.KeyPoints[0].transform.position = new Vector3(kicker.transform.position.x - 6f, kicker.transform.position.y - 6f);
|
||||
dispenseCurve.KeyPoints[1].transform.position = new Vector3(kicker.transform.position.x - 1f, kicker.transform.position.y - 6f);
|
||||
|
||||
holder.transform.localPosition = dispenseCurve.GetPoint(normalizedBeatAnim);
|
||||
spriteHolder.transform.eulerAngles = new Vector3(0, 0, Mathf.Lerp(0f, -1440f, normalizedBeatAnim));
|
||||
|
||||
@ -112,16 +130,20 @@ namespace RhythmHeavenMania.Games.SpaceSoccer
|
||||
else if (kicked.enabled)
|
||||
{
|
||||
float normalizedBeatAnim = Conductor.instance.GetLoopPositionFromBeat(kicked.startBeat, 1.5f);
|
||||
holder.transform.localPosition = kickCurve.GetPoint(normalizedBeatAnim);
|
||||
|
||||
if (!lastKickLeft)
|
||||
{
|
||||
kickCurve.KeyPoints[1].transform.position = new Vector3(kicker.transform.position.x + 0.5f, kicker.transform.position.y - 6f);
|
||||
spriteHolder.transform.eulerAngles = new Vector3(0, 0, Mathf.Lerp(lastSpriteRot, lastSpriteRot - 360f, normalizedBeatAnim));
|
||||
}
|
||||
else
|
||||
{
|
||||
kickCurve.KeyPoints[1].transform.position = new Vector3(kicker.transform.position.x - 2.5f, kicker.transform.position.y - 6f);
|
||||
spriteHolder.transform.eulerAngles = new Vector3(0, 0, Mathf.Lerp(lastSpriteRot, lastSpriteRot + 360f, normalizedBeatAnim));
|
||||
}
|
||||
|
||||
holder.transform.localPosition = kickCurve.GetPoint(normalizedBeatAnim);
|
||||
|
||||
/*if (PlayerInput.Pressed())
|
||||
{
|
||||
if (state.perfect)
|
||||
@ -141,6 +163,9 @@ namespace RhythmHeavenMania.Games.SpaceSoccer
|
||||
else if (highKicked.enabled)
|
||||
{
|
||||
float normalizedBeatAnim = Conductor.instance.GetLoopPositionFromBeat(highKicked.startBeat, 1.8f);
|
||||
|
||||
highKickCurve.KeyPoints[1].transform.position = new Vector3(kicker.transform.position.x - 3.5f, kicker.transform.position.y - 6f);
|
||||
|
||||
holder.transform.localPosition = highKickCurve.GetPoint(normalizedBeatAnim);
|
||||
spriteHolder.transform.eulerAngles = new Vector3(0, 0, Mathf.Lerp(lastSpriteRot, lastSpriteRot + 360f, normalizedBeatAnim));
|
||||
|
||||
@ -165,9 +190,28 @@ namespace RhythmHeavenMania.Games.SpaceSoccer
|
||||
else if (toe.enabled)
|
||||
{
|
||||
float normalizedBeatAnim = Conductor.instance.GetLoopPositionFromBeat(toe.startBeat, 1.85f);
|
||||
|
||||
if (!lastKickLeft)
|
||||
{
|
||||
toeCurve.KeyPoints[1].transform.position = new Vector3(kicker.transform.position.x + 0.5f, kicker.transform.position.y - 6f);
|
||||
}
|
||||
else
|
||||
{
|
||||
toeCurve.KeyPoints[1].transform.position = new Vector3(kicker.transform.position.x - 0.7f, kicker.transform.position.y - 6f);
|
||||
}
|
||||
|
||||
holder.transform.localPosition = toeCurve.GetPoint(normalizedBeatAnim);
|
||||
spriteHolder.transform.eulerAngles = new Vector3(0, 0, Mathf.Lerp(lastSpriteRot, -860f, normalizedBeatAnim));
|
||||
}
|
||||
|
||||
holder.transform.position = new Vector3(holder.transform.position.x, holder.transform.position.y, kicker.transform.localPosition.z);
|
||||
}
|
||||
|
||||
private void HitFX()
|
||||
{
|
||||
GameObject kickfx = Instantiate(kickFX.gameObject, SpaceSoccer.instance.transform);
|
||||
kickfx.SetActive(true);
|
||||
kickfx.transform.position = holder.transform.position;
|
||||
}
|
||||
}
|
||||
}
|
@ -15,14 +15,27 @@ namespace RhythmHeavenMania.Games.SpaceSoccer
|
||||
public bool kickLeft;
|
||||
public float dispenserBeat;
|
||||
public int kickTimes = 0;
|
||||
public bool player;
|
||||
|
||||
[Header("Components")]
|
||||
private Animator anim;
|
||||
public Ball ball;
|
||||
public Transform rightLeg;
|
||||
public Transform leftLeg;
|
||||
|
||||
private void Start()
|
||||
{
|
||||
anim = GetComponent<Animator>();
|
||||
GameObject rightLeg = new GameObject();
|
||||
rightLeg.transform.SetParent(this.transform);
|
||||
rightLeg.transform.position = new Vector3(-0.67f, -1.48f);
|
||||
|
||||
GameObject leftLeg = new GameObject("leftLeg");
|
||||
leftLeg.transform.SetParent(this.transform);
|
||||
leftLeg.transform.position = new Vector3(0f, -1.48f);
|
||||
|
||||
this.rightLeg = rightLeg.transform;
|
||||
this.leftLeg = leftLeg.transform;
|
||||
}
|
||||
|
||||
public override void OnAce()
|
||||
@ -56,7 +69,8 @@ namespace RhythmHeavenMania.Games.SpaceSoccer
|
||||
kickTimes++;
|
||||
aceTimes = 0;
|
||||
|
||||
Jukebox.PlayOneShotGame("spaceSoccer/kick");
|
||||
if (player)
|
||||
Jukebox.PlayOneShotGame("spaceSoccer/kick");
|
||||
|
||||
if (highKick)
|
||||
{
|
||||
@ -86,7 +100,7 @@ namespace RhythmHeavenMania.Games.SpaceSoccer
|
||||
if (highKick == false)
|
||||
{
|
||||
if (ball != null && hit)
|
||||
ball.Kick();
|
||||
ball.Kick(player);
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -109,14 +123,17 @@ namespace RhythmHeavenMania.Games.SpaceSoccer
|
||||
anim.Play("HighKickRight_0", 0, 0);
|
||||
}
|
||||
|
||||
if (ball && hit)
|
||||
if (hit && ball)
|
||||
{
|
||||
Jukebox.PlayOneShotGame("spaceSoccer/highkicktoe1_hit");
|
||||
ball.HighKick();
|
||||
|
||||
if (player)
|
||||
Jukebox.PlayOneShotGame("spaceSoccer/highkicktoe1_hit");
|
||||
}
|
||||
else
|
||||
{
|
||||
Jukebox.PlayOneShotGame("spaceSoccer/highkicktoe1");
|
||||
if (player)
|
||||
Jukebox.PlayOneShotGame("spaceSoccer/highkicktoe1");
|
||||
}
|
||||
|
||||
ResetState();
|
||||
@ -133,15 +150,20 @@ namespace RhythmHeavenMania.Games.SpaceSoccer
|
||||
anim.Play("ToeRight", 0, 0);
|
||||
}
|
||||
|
||||
if (player)
|
||||
{
|
||||
if (hit && ball)
|
||||
{
|
||||
Jukebox.PlayOneShotGame("spaceSoccer/highkicktoe3_hit");
|
||||
}
|
||||
else
|
||||
{
|
||||
Jukebox.PlayOneShotGame("spaceSoccer/highkicktoe3");
|
||||
}
|
||||
}
|
||||
|
||||
if (hit && ball)
|
||||
{
|
||||
Jukebox.PlayOneShotGame("spaceSoccer/highkicktoe3_hit");
|
||||
ball.Toe();
|
||||
}
|
||||
else
|
||||
{
|
||||
Jukebox.PlayOneShotGame("spaceSoccer/highkicktoe3");
|
||||
}
|
||||
|
||||
kickPrepare = false;
|
||||
ResetState();
|
||||
@ -149,7 +171,6 @@ namespace RhythmHeavenMania.Games.SpaceSoccer
|
||||
|
||||
private void Update()
|
||||
{
|
||||
|
||||
if (kickTimes % 2 == 0)
|
||||
{
|
||||
kickLeft = false;
|
||||
@ -193,36 +214,42 @@ namespace RhythmHeavenMania.Games.SpaceSoccer
|
||||
if (ball.dispensing)
|
||||
{
|
||||
float normalizedBeat = Conductor.instance.GetLoopPositionFromBeat(ball.dispensedBeat, 2f);
|
||||
StateCheck(normalizedBeat);
|
||||
StateCheck(normalizedBeat, !player);
|
||||
CheckIfFall(normalizedBeat);
|
||||
|
||||
if (PlayerInput.Pressed())
|
||||
if (player)
|
||||
{
|
||||
if (state.perfect)
|
||||
if (PlayerInput.Pressed())
|
||||
{
|
||||
KickCheck(true);
|
||||
}
|
||||
else
|
||||
{
|
||||
KickCheck(false, true);
|
||||
if (state.perfect)
|
||||
{
|
||||
KickCheck(true);
|
||||
}
|
||||
else
|
||||
{
|
||||
KickCheck(false, true);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (ball.kicked.enabled)
|
||||
{
|
||||
float normalizedBeat = Conductor.instance.GetLoopPositionFromBeat(ball.kicked.startBeat, 1f);
|
||||
StateCheck(normalizedBeat);
|
||||
StateCheck(normalizedBeat, !player);
|
||||
CheckIfFall(normalizedBeat);
|
||||
|
||||
if (PlayerInput.Pressed())
|
||||
if (player)
|
||||
{
|
||||
if (state.perfect)
|
||||
if (PlayerInput.Pressed())
|
||||
{
|
||||
KickCheck(true);
|
||||
}
|
||||
else
|
||||
{
|
||||
KickCheck(false, true);
|
||||
if (state.perfect)
|
||||
{
|
||||
KickCheck(true);
|
||||
}
|
||||
else
|
||||
{
|
||||
KickCheck(false, true);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -232,28 +259,34 @@ namespace RhythmHeavenMania.Games.SpaceSoccer
|
||||
if (!kickPrepare)
|
||||
{
|
||||
float normalizedBeatPrepare = Conductor.instance.GetLoopPositionFromBeat(ball.highKicked.startBeat, 1f);
|
||||
StateCheck(normalizedBeatPrepare);
|
||||
StateCheck(normalizedBeatPrepare, !player);
|
||||
CheckIfFall(normalizedBeat);
|
||||
|
||||
if (PlayerInput.AltPressed())
|
||||
if (player)
|
||||
{
|
||||
Kick(false, true);
|
||||
if (PlayerInput.AltPressed())
|
||||
{
|
||||
Kick(false, true);
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
StateCheck(normalizedBeat);
|
||||
StateCheck(normalizedBeat, !player);
|
||||
CheckIfFall(normalizedBeat);
|
||||
|
||||
if (PlayerInput.AltPressedUp())
|
||||
if (player)
|
||||
{
|
||||
if (state.perfect)
|
||||
if (PlayerInput.AltPressedUp())
|
||||
{
|
||||
Toe(true);
|
||||
}
|
||||
else
|
||||
{
|
||||
Toe(false);
|
||||
if (state.perfect)
|
||||
{
|
||||
Toe(true);
|
||||
}
|
||||
else
|
||||
{
|
||||
Toe(false);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -261,27 +294,33 @@ namespace RhythmHeavenMania.Games.SpaceSoccer
|
||||
else if (ball.toe.enabled)
|
||||
{
|
||||
float normalizedBeat = Conductor.instance.GetLoopPositionFromBeat(ball.toe.startBeat, 1.5f);
|
||||
StateCheck(normalizedBeat);
|
||||
StateCheck(normalizedBeat, !player);
|
||||
CheckIfFall(normalizedBeat);
|
||||
|
||||
if (PlayerInput.Pressed())
|
||||
if (player)
|
||||
{
|
||||
if (state.perfect)
|
||||
if (PlayerInput.Pressed())
|
||||
{
|
||||
KickCheck(true);
|
||||
}
|
||||
else
|
||||
{
|
||||
KickCheck(false, true);
|
||||
if (state.perfect)
|
||||
{
|
||||
KickCheck(true);
|
||||
}
|
||||
else
|
||||
{
|
||||
KickCheck(false, true);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (PlayerInput.Pressed())
|
||||
if (player)
|
||||
{
|
||||
KickCheck(false, true);
|
||||
if (PlayerInput.Pressed())
|
||||
{
|
||||
KickCheck(false, true);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -10,7 +10,7 @@ namespace RhythmHeavenMania.Games.SpaceSoccer
|
||||
{
|
||||
[Header("Components")]
|
||||
[SerializeField] private GameObject ballRef;
|
||||
[SerializeField] private Kicker kicker;
|
||||
[SerializeField] private List<Kicker> kickers;
|
||||
[SerializeField] private GameObject Background;
|
||||
[SerializeField] private Sprite[] backgroundSprite;
|
||||
|
||||
@ -26,7 +26,7 @@ namespace RhythmHeavenMania.Games.SpaceSoccer
|
||||
|
||||
private void Start()
|
||||
{
|
||||
for (int x = 0; x < Random.Range(9, 12); x++)
|
||||
/*for (int x = 0; x < Random.Range(9, 12); x++)
|
||||
{
|
||||
for (int y = 0; y < Random.Range(6, 9); y++)
|
||||
{
|
||||
@ -37,30 +37,35 @@ namespace RhythmHeavenMania.Games.SpaceSoccer
|
||||
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()
|
||||
{
|
||||
if (ballDispensed)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
public void Dispense(float beat)
|
||||
{
|
||||
if (kicker.ball != null) return;
|
||||
ballDispensed = true;
|
||||
for (int i = 0; i < kickers.Count; i++)
|
||||
{
|
||||
Kicker kicker = kickers[i];
|
||||
if (i == 0) kicker.player = true;
|
||||
|
||||
GameObject ball = Instantiate(ballRef, this.transform);
|
||||
Ball ball_ = ball.GetComponent<Ball>();
|
||||
ball_.dispensedBeat = beat;
|
||||
ball_.dispensing = true;
|
||||
kicker.ball = ball_;
|
||||
kicker.dispenserBeat = beat;
|
||||
kicker.kickTimes = 0;
|
||||
if (kicker.ball != null) return;
|
||||
ballDispensed = true;
|
||||
|
||||
GameObject ball = Instantiate(ballRef, transform);
|
||||
Ball ball_ = ball.GetComponent<Ball>();
|
||||
ball_.kicker = kicker;
|
||||
ball_.dispensedBeat = beat;
|
||||
ball_.dispensing = true;
|
||||
kicker.ball = ball_;
|
||||
kicker.dispenserBeat = beat;
|
||||
kicker.kickTimes = 0;
|
||||
}
|
||||
|
||||
MultiSound.Play(new MultiSound.Sound[]
|
||||
{
|
||||
|
@ -46,11 +46,13 @@ namespace RhythmHeavenMania.Editor
|
||||
[SerializeField] private Button MusicSelectBTN;
|
||||
[SerializeField] private Button EditorSettingsBTN;
|
||||
[SerializeField] private Button EditorThemeBTN;
|
||||
[SerializeField] private Button FullScreenBTN;
|
||||
|
||||
[Header("Properties")]
|
||||
private bool changedMusic = false;
|
||||
private string currentRemixPath = "";
|
||||
private int lastEditorObjectsCount = 0;
|
||||
private bool fullscreen;
|
||||
|
||||
public static Editor instance { get; private set; }
|
||||
|
||||
@ -85,6 +87,7 @@ namespace RhythmHeavenMania.Editor
|
||||
Tooltip.AddTooltip(MusicSelectBTN.gameObject, "Music Select");
|
||||
Tooltip.AddTooltip(EditorSettingsBTN.gameObject, "Editor Settings <color=#adadad>[Ctrl+Shift+O]</color>");
|
||||
Tooltip.AddTooltip(EditorThemeBTN.gameObject, "Editor Theme");
|
||||
Tooltip.AddTooltip(FullScreenBTN.gameObject, "Preview <color=#adadad>[Tab]</color>");
|
||||
|
||||
UpdateEditorStatus(true);
|
||||
}
|
||||
@ -105,6 +108,11 @@ namespace RhythmHeavenMania.Editor
|
||||
GetComponent<BoxSelection>().enabled = true;
|
||||
}*/
|
||||
|
||||
if (Input.GetKeyDown(KeyCode.Tab))
|
||||
{
|
||||
Fullscreen();
|
||||
}
|
||||
|
||||
if (Input.GetKeyDown(KeyCode.Delete))
|
||||
{
|
||||
List<TimelineEventObj> ev = new List<TimelineEventObj>();
|
||||
@ -368,6 +376,25 @@ namespace RhythmHeavenMania.Editor
|
||||
|
||||
#endregion
|
||||
|
||||
public void Fullscreen()
|
||||
{
|
||||
if (fullscreen == false)
|
||||
{
|
||||
MainCanvas.enabled = false;
|
||||
EditorCamera.enabled = false;
|
||||
GameManager.instance.GameCamera.targetTexture = null;
|
||||
// GameManager.instance.GameCamera.transform.parent.GetChild(1).GetComponent<Camera>().enabled = false;
|
||||
fullscreen = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
MainCanvas.enabled = true;
|
||||
EditorCamera.enabled = true;
|
||||
GameManager.instance.GameCamera.targetTexture = ScreenRenderTexture;
|
||||
// GameManager.instance.GameCamera.transform.parent.GetChild(1).GetComponent<Camera>().enabled = true;
|
||||
fullscreen = false;
|
||||
}
|
||||
}
|
||||
|
||||
private void UpdateEditorStatus(bool updateTime)
|
||||
{
|
||||
|
Reference in New Issue
Block a user