HeavenStudioPlus/Assets/Scripts/Games/TapTrial/TapTrial.cs

112 lines
3.8 KiB
C#
Raw Normal View History

2022-02-19 18:51:46 +00:00
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
2022-03-14 14:21:05 +00:00
using HeavenStudio.Util;
2022-02-19 21:03:45 +00:00
namespace HeavenStudio.Games.Loaders
{
using static Minigames;
public static class AgbTapLoader
{
public static Minigame AddGame(EventCaller eventCaller) {
return new Minigame("tapTrial", "Tap Trial \n<color=#eb5454>[WIP don't use]</color>", "93ffb3", false, false, new List<GameAction>()
{
new GameAction("tap", delegate { TapTrial.instance.Tap(eventCaller.currentEntity.beat); }, 2.0f, false),
new GameAction("double tap", delegate { TapTrial.instance.DoubleTap(eventCaller.currentEntity.beat); }, 2.0f, false),
new GameAction("triple tap", delegate { TapTrial.instance.TripleTap(eventCaller.currentEntity.beat); }, 4.0f, false),
new GameAction("jump tap", delegate { TapTrial.instance.JumpTap(eventCaller.currentEntity.beat); }, 2.0f, false),
new GameAction("final jump tap", delegate { TapTrial.instance.FinalJumpTap(eventCaller.currentEntity.beat); }, 2.0f, false),
});
}
}
}
2022-03-14 14:21:05 +00:00
namespace HeavenStudio.Games
2022-02-19 18:51:46 +00:00
{
2022-03-12 04:10:13 +00:00
using Scripts_TapTrial;
2022-02-19 18:51:46 +00:00
public class TapTrial : Minigame
{
2022-02-19 21:03:45 +00:00
[Header("References")]
public TapTrialPlayer player;
public GameObject tap;
2022-02-19 21:03:45 +00:00
public static TapTrial instance { get; set; }
private void Awake()
{
instance = this;
}
// The following is all solely animations for placeholder. This isn't playable
2022-02-19 21:03:45 +00:00
public void Tap(float beat)
{
Jukebox.PlayOneShotGame("tapTrial/ook");
player.anim.Play("TapPrepare", 0, 0);
2022-02-19 21:03:45 +00:00
CreateTap(beat);
2022-02-19 21:03:45 +00:00
}
public void DoubleTap(float beat)
{
MultiSound.Play(new MultiSound.Sound[]
{
new MultiSound.Sound("tapTrial/ookook", beat),
new MultiSound.Sound("tapTrial/ookook", beat + 0.5f)
});
2022-02-19 21:03:45 +00:00
player.anim.Play("DoubleTapPrepare", 0, 0);
GameObject beatAction = new GameObject();
beatAction.transform.SetParent(this.transform);
BeatAction.New(beatAction, new List<BeatAction.Action>()
{
new BeatAction.Action(beat + 0.0f, delegate { CreateTap(beat, 1); }),
new BeatAction.Action(beat + 0.5f, delegate { CreateTap(beat + 0.5f, 1); }),
});
2022-02-19 21:03:45 +00:00
}
public void TripleTap(float beat)
{
MultiSound.Play(new MultiSound.Sound[]
{
new MultiSound.Sound("tapTrial/ooki1", beat),
new MultiSound.Sound("tapTrial/ooki2", beat + 0.5f)
});
2022-02-19 21:03:45 +00:00
player.anim.Play("PosePrepare", 0, 0);
player.tripleOffset = 0;
GameObject beatAction = new GameObject();
beatAction.transform.SetParent(this.transform);
BeatAction.New(beatAction, new List<BeatAction.Action>()
{
new BeatAction.Action(beat + 1.0f, delegate { CreateTap(beat + 1.0f, 2); }),
new BeatAction.Action(beat + 1.5f, delegate { CreateTap(beat + 1.5f, 2); }),
new BeatAction.Action(beat + 2.0f, delegate { CreateTap(beat + 2.0f, 2); }),
});
2022-02-19 21:03:45 +00:00
}
public void JumpTap(float beat)
{
}
public void FinalJumpTap(float beat)
{
}
public void CreateTap(float beat, int type = 0)
{
GameObject _tap = Instantiate(tap);
_tap.transform.parent = tap.transform.parent;
_tap.SetActive(true);
Tap t = _tap.GetComponent<Tap>();
t.startBeat = beat;
t.type = type;
}
2022-02-19 18:51:46 +00:00
}
}