HeavenStudio/Assets/Scripts/Games/FrogPrincess/FrogPrincess.cs
2024-04-06 13:57:11 +09:00

112 lines
3.7 KiB
C#

using System;
using System.Linq;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using HeavenStudio.Util;
using HeavenStudio.InputSystem;
using Jukebox;
namespace HeavenStudio.Games.Loaders
{
using static Minigames;
/// Minigame loaders handle the setup of your minigame.
/// Here, you designate the game prefab, define entities, and mark what AssetBundle to load
/// Names of minigame loaders follow a specific naming convention of `PlatformcodeNameLoader`, where:
/// `Platformcode` is a three-leter platform code with the minigame's origin
/// `Name` is a short internal name
/// `Loader` is the string "Loader"
/// Platform codes are as follows:
/// Agb: Gameboy Advance ("Advance Gameboy")
/// Ntr: Nintendo DS ("Nitro")
/// Rvl: Nintendo Wii ("Revolution")
/// Ctr: Nintendo 3DS ("Centrair")
/// Mob: Mobile
/// Pco: PC / Other
/// Fill in the loader class label, "*prefab name*", and "*Display Name*" with the relevant information
/// For help, feel free to reach out to us on our discord, in the #development channel.
public static class RvlFrogPrincessLoader
{
public static Minigame AddGame(EventCaller eventCaller)
{
return new Minigame("frogPrincess", "Frog Princess", "ffffff", false, false, new List<GameAction>()
{
new GameAction("jump", "Jump")
{
function = delegate {var e = eventCaller.currentEntity; FrogPrincess.instance.Jump(e.beat); },
defaultLength = 4f,
},
},
new List<string>() { "rvl", "keep" },
"rvlfrog", "en",
new List<string>() {},
chronologicalSortKey: 106
);
}
}
}
namespace HeavenStudio.Games
{
public class FrogPrincess : Minigame
{
[SerializeField] Animator frogAnim;
[SerializeField] Animator princessAnim;
[SerializeField] Animator[] LotusAnims;
public static FrogPrincess instance;
public void Awake()
{
instance = this;
}
public void Jump(double beat)
{
MultiSound.Play(new MultiSound.Sound[]
{
new MultiSound.Sound("frogPrincess/ready", beat),
new MultiSound.Sound("frogPrincess/ready", beat + 1),
new MultiSound.Sound("frogPrincess/lean", beat + 2),
new MultiSound.Sound("frogPrincess/jump", beat + 3),
});
BeatAction.New(instance, new List<BeatAction.Action>()
{
new BeatAction.Action(beat, delegate
{
frogAnim.DoScaledAnimationAsync("ready", 0.5f);
princessAnim.DoScaledAnimationAsync("ready", 0.5f);
}),
new BeatAction.Action(beat + 1, delegate
{
frogAnim.DoScaledAnimationAsync("ready", 0.5f);
princessAnim.DoScaledAnimationAsync("ready", 0.5f);
}),
new BeatAction.Action(beat + 2, delegate
{
frogAnim.DoScaledAnimationAsync("prepare", 0.5f);
princessAnim.DoScaledAnimationAsync("prepare", 0.5f);
}),
new BeatAction.Action(beat + 3, delegate
{
frogAnim.DoScaledAnimationAsync("jump", 0.5f);
princessAnim.DoScaledAnimationAsync("jump", 0.5f);
}),
});
// ScheduleInput(beat, 2, InputAction_BasicPress, JustPrepare, MissPrepare, Empty);
}
void JustPrepare(PlayerActionEvent caller, float state)
{
}
}
}