2022-05-16 05:29:26 +00:00
|
|
|
using HeavenStudio.Util;
|
|
|
|
using System.Collections;
|
|
|
|
using System.Collections.Generic;
|
|
|
|
using UnityEngine;
|
2023-01-14 04:53:25 +00:00
|
|
|
using UnityEngine.Rendering;
|
2022-05-16 05:29:26 +00:00
|
|
|
|
|
|
|
using DG.Tweening;
|
|
|
|
using NaughtyBezierCurves;
|
|
|
|
|
|
|
|
namespace HeavenStudio.Games.Loaders
|
|
|
|
{
|
|
|
|
using static Minigames;
|
|
|
|
public static class NtrSamuraiLoader
|
|
|
|
{
|
|
|
|
public static Minigame AddGame(EventCaller eventCaller) {
|
2023-04-02 02:28:23 +00:00
|
|
|
return new Minigame("samuraiSliceNtr", "Samurai Slice (DS)", "b6b5b6", false, false, new List<GameAction>()
|
2022-05-16 05:29:26 +00:00
|
|
|
{
|
2023-03-07 17:22:32 +00:00
|
|
|
new GameAction("bop", "Bop")
|
|
|
|
{
|
|
|
|
function = delegate {var e = eventCaller.currentEntity; SamuraiSliceNtr.instance.Bop(e.beat, e.length, e["whoBops"], e["whoBopsAuto"]); },
|
|
|
|
resizable = true,
|
|
|
|
parameters = new List<Param>()
|
|
|
|
{
|
|
|
|
new Param("whoBops", SamuraiSliceNtr.WhoBops.Both, "Who Bops?", "Who will bop?"),
|
|
|
|
new Param("whoBopsAuto", SamuraiSliceNtr.WhoBops.None, "Who Bops? (Auto)", "Who will automatically begin bopping?")
|
|
|
|
}
|
|
|
|
},
|
2023-02-14 16:31:51 +00:00
|
|
|
new GameAction("melon", "Melon")
|
|
|
|
{
|
|
|
|
function = delegate
|
|
|
|
{
|
|
|
|
SamuraiSliceNtr.instance.ObjectIn(eventCaller.currentEntity.beat, (int)SamuraiSliceNtr.ObjectType.Melon, (int) eventCaller.currentEntity["valA"], eventCaller.currentEntity["2b2t"]);
|
|
|
|
},
|
|
|
|
defaultLength = 5,
|
|
|
|
parameters = new List<Param>()
|
|
|
|
{
|
|
|
|
new Param("2b2t", false, "Melon2B2T", "Should the melon be reskinned as the 2B2T melon?"),
|
|
|
|
new Param("valA", new EntityTypes.Integer(0, 30, 1), "Money", "The amount of coins the melon spills out when sliced"),
|
|
|
|
}
|
|
|
|
},
|
|
|
|
new GameAction("fish", "Fish")
|
|
|
|
{
|
|
|
|
function = delegate
|
|
|
|
{
|
|
|
|
SamuraiSliceNtr.instance.ObjectIn(eventCaller.currentEntity.beat, (int)SamuraiSliceNtr.ObjectType.Fish, (int) eventCaller.currentEntity["valA"]);
|
|
|
|
},
|
|
|
|
defaultLength = 7,
|
|
|
|
parameters = new List<Param>()
|
|
|
|
{
|
|
|
|
new Param("valA", new EntityTypes.Integer(0, 30, 1), "Money", "The amount of coins the fish spills out when sliced"),
|
|
|
|
}
|
|
|
|
},
|
|
|
|
new GameAction("demon", "Demon")
|
|
|
|
{
|
|
|
|
function = delegate
|
|
|
|
{
|
|
|
|
SamuraiSliceNtr.instance.ObjectIn(eventCaller.currentEntity.beat, (int)SamuraiSliceNtr.ObjectType.Demon, (int) eventCaller.currentEntity["valA"]);
|
|
|
|
},
|
|
|
|
defaultLength = 7,
|
|
|
|
parameters = new List<Param>()
|
|
|
|
{
|
|
|
|
new Param("valA", new EntityTypes.Integer(0, 30, 1), "Money", "The amount of coins the demon spills out when sliced"),
|
2022-08-20 23:03:51 +00:00
|
|
|
}
|
|
|
|
},
|
2023-02-14 18:12:08 +00:00
|
|
|
//backwards compatibility
|
|
|
|
new GameAction("spawn object", "Toss Object")
|
|
|
|
{
|
|
|
|
function = delegate
|
|
|
|
{
|
|
|
|
SamuraiSliceNtr.instance.ObjectIn(eventCaller.currentEntity.beat, eventCaller.currentEntity["type"], (int) eventCaller.currentEntity["valA"]);
|
|
|
|
},
|
|
|
|
defaultLength = 8,
|
|
|
|
parameters = new List<Param>()
|
|
|
|
{
|
|
|
|
new Param("type", SamuraiSliceNtr.ObjectType.Melon, "Object", "The object to spawn"),
|
|
|
|
new Param("valA", new EntityTypes.Integer(0, 30, 1), "Money", "The amount of coins the melon spills out when sliced"),
|
|
|
|
},
|
|
|
|
hidden = true
|
|
|
|
},
|
2022-06-12 19:32:00 +00:00
|
|
|
},
|
|
|
|
new List<string>() {"ntr", "normal"},
|
|
|
|
"ntrsamurai", "en",
|
|
|
|
new List<string>() {"en"}
|
|
|
|
);
|
2022-05-16 05:29:26 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
namespace HeavenStudio.Games
|
|
|
|
{
|
|
|
|
using Scripts_NtrSamurai;
|
|
|
|
|
|
|
|
public class SamuraiSliceNtr : Minigame
|
|
|
|
{
|
|
|
|
public enum ObjectType {
|
|
|
|
Melon,
|
|
|
|
Fish,
|
2022-08-18 17:15:50 +00:00
|
|
|
Demon,
|
|
|
|
Melon2B2T,
|
2022-05-16 05:29:26 +00:00
|
|
|
}
|
|
|
|
|
2023-03-07 17:22:32 +00:00
|
|
|
public enum WhoBops
|
|
|
|
{
|
|
|
|
Samurai = 0,
|
|
|
|
Children = 1,
|
|
|
|
Both = 2,
|
|
|
|
None = 3
|
|
|
|
}
|
|
|
|
|
|
|
|
private bool goBopSamurai = true;
|
|
|
|
private bool goBopChild = true;
|
|
|
|
|
2022-05-16 05:29:26 +00:00
|
|
|
[Header("References")]
|
|
|
|
public NtrSamurai player;
|
|
|
|
public GameObject launcher;
|
|
|
|
public GameObject objectPrefab;
|
|
|
|
public GameObject childParent;
|
|
|
|
public Transform objectHolder;
|
|
|
|
|
|
|
|
public BezierCurve3D InCurve;
|
|
|
|
public BezierCurve3D LaunchCurve;
|
|
|
|
public BezierCurve3D LaunchHighCurve;
|
|
|
|
|
|
|
|
public BezierCurve3D NgLaunchCurve;
|
|
|
|
public BezierCurve3D DebrisLeftCurve;
|
|
|
|
public BezierCurve3D DebrisRightCurve;
|
2023-01-14 04:53:25 +00:00
|
|
|
public BezierCurve3D NgDebrisCurve;
|
2022-05-16 05:29:26 +00:00
|
|
|
|
|
|
|
//game scene
|
|
|
|
public static SamuraiSliceNtr instance;
|
|
|
|
|
|
|
|
public GameEvent bop = new GameEvent();
|
|
|
|
|
|
|
|
private void Awake()
|
|
|
|
{
|
|
|
|
instance = this;
|
|
|
|
}
|
|
|
|
|
|
|
|
// Update is called once per frame
|
|
|
|
void Update()
|
|
|
|
{
|
|
|
|
var cond = Conductor.instance;
|
|
|
|
if (cond.ReportBeat(ref bop.lastReportedBeat, bop.startBeat % 1))
|
|
|
|
{
|
2023-03-07 17:22:32 +00:00
|
|
|
if (goBopSamurai) player.Bop();
|
|
|
|
if (goBopChild) childParent.GetComponent<NtrSamuraiChild>().Bop();
|
2022-05-16 05:29:26 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
if (PlayerInput.AltPressed())
|
|
|
|
DoStep();
|
|
|
|
if (PlayerInput.AltPressedUp() && player.isStepping())
|
|
|
|
DoUnStep();
|
|
|
|
if (PlayerInput.Pressed())
|
|
|
|
DoSlice();
|
|
|
|
}
|
|
|
|
|
2023-06-10 19:13:29 +00:00
|
|
|
public void Bop(double beat, float length, int whoBops, int whoBopsAuto)
|
2023-03-07 17:22:32 +00:00
|
|
|
{
|
|
|
|
goBopSamurai = whoBopsAuto == (int)WhoBops.Samurai || whoBopsAuto == (int)WhoBops.Both;
|
|
|
|
goBopChild = whoBopsAuto == (int)WhoBops.Children || whoBopsAuto == (int)WhoBops.Both;
|
|
|
|
for (int i = 0; i < length; i++)
|
|
|
|
{
|
2023-09-11 22:28:04 +00:00
|
|
|
BeatAction.New(instance, new List<BeatAction.Action>()
|
2023-03-07 17:22:32 +00:00
|
|
|
{
|
|
|
|
new BeatAction.Action(beat + i, delegate { BopSingle(whoBops); })
|
|
|
|
});
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void BopSingle(int whoBops)
|
|
|
|
{
|
|
|
|
switch (whoBops)
|
|
|
|
{
|
|
|
|
case (int)WhoBops.Samurai:
|
|
|
|
player.Bop();
|
|
|
|
break;
|
|
|
|
case (int)WhoBops.Children:
|
|
|
|
childParent.GetComponent<NtrSamuraiChild>().Bop();
|
|
|
|
break;
|
|
|
|
case (int)WhoBops.Both:
|
|
|
|
player.Bop();
|
|
|
|
childParent.GetComponent<NtrSamuraiChild>().Bop();
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2022-05-16 05:29:26 +00:00
|
|
|
public void DoStep()
|
|
|
|
{
|
2023-06-10 19:13:29 +00:00
|
|
|
SoundByte.PlayOneShotGame("samuraiSliceNtr/ntrSamurai_launchThrough");
|
2022-05-16 05:29:26 +00:00
|
|
|
player.Step(false);
|
|
|
|
launcher.GetComponent<Animator>().Play("Launch", -1, 0);
|
|
|
|
}
|
|
|
|
|
|
|
|
public void DoUnStep()
|
|
|
|
{
|
|
|
|
player.Step(true);
|
|
|
|
launcher.GetComponent<Animator>().Play("UnStep", -1, 0);
|
|
|
|
}
|
|
|
|
|
|
|
|
public void DoSlice()
|
|
|
|
{
|
|
|
|
if (player.isStepping())
|
|
|
|
{
|
|
|
|
launcher.GetComponent<Animator>().Play("UnStep", -1, 0);
|
|
|
|
}
|
2023-06-10 19:13:29 +00:00
|
|
|
SoundByte.PlayOneShotGame("samuraiSliceNtr/ntrSamurai_through");
|
2022-05-16 05:29:26 +00:00
|
|
|
player.Slash();
|
|
|
|
}
|
|
|
|
|
2023-06-10 19:13:29 +00:00
|
|
|
public void Bop(double beat, float length)
|
2022-05-16 05:29:26 +00:00
|
|
|
{
|
|
|
|
bop.length = length;
|
|
|
|
bop.startBeat = beat;
|
|
|
|
}
|
|
|
|
|
2023-06-10 19:13:29 +00:00
|
|
|
public void ObjectIn(double beat, int type = (int) ObjectType.Melon, int value = 1, bool funnyMinecraft = false)
|
2022-05-16 05:29:26 +00:00
|
|
|
{
|
|
|
|
var mobj = GameObject.Instantiate(objectPrefab, objectHolder);
|
|
|
|
var mobjDat = mobj.GetComponent<NtrSamuraiObject>();
|
|
|
|
mobjDat.startBeat = beat;
|
2023-02-14 16:31:51 +00:00
|
|
|
mobjDat.type = funnyMinecraft ? (int)ObjectType.Melon2B2T : type;
|
2022-05-16 05:29:26 +00:00
|
|
|
mobjDat.holdingCash = value;
|
|
|
|
|
|
|
|
mobj.SetActive(true);
|
|
|
|
|
2023-06-10 19:13:29 +00:00
|
|
|
SoundByte.PlayOneShotGame("samuraiSliceNtr/ntrSamurai_in00");
|
2022-05-16 05:29:26 +00:00
|
|
|
}
|
|
|
|
|
2023-06-10 19:13:29 +00:00
|
|
|
public NtrSamuraiChild CreateChild(double beat)
|
2022-05-16 05:29:26 +00:00
|
|
|
{
|
|
|
|
var mobj = GameObject.Instantiate(childParent, objectHolder);
|
|
|
|
var mobjDat = mobj.GetComponent<NtrSamuraiChild>();
|
|
|
|
mobjDat.startBeat = beat;
|
|
|
|
mobjDat.isMain = false;
|
|
|
|
|
|
|
|
mobjDat.Bop();
|
|
|
|
|
|
|
|
mobj.SetActive(true);
|
2023-01-14 04:53:25 +00:00
|
|
|
mobj.GetComponent<SortingGroup>().sortingOrder = 7;
|
2022-05-16 05:29:26 +00:00
|
|
|
|
|
|
|
return mobjDat;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|