2024-03-04 05:58:22 +00:00
|
|
|
using HeavenStudio.Util;
|
|
|
|
using HeavenStudio.InputSystem;
|
|
|
|
using Jukebox;
|
|
|
|
using System;
|
|
|
|
using System.Collections.Generic;
|
|
|
|
using UnityEngine;
|
|
|
|
|
|
|
|
namespace HeavenStudio.Games.Loaders
|
|
|
|
{
|
|
|
|
using static Minigames;
|
|
|
|
public static class PcoNailLoader
|
|
|
|
{
|
|
|
|
public static Minigame AddGame(EventCaller eventCaller)
|
|
|
|
{
|
|
|
|
return new Minigame("nailCarpenter", "Nail Carpenter", "fab96e", false, false, new List<GameAction>()
|
|
|
|
{
|
|
|
|
new GameAction("puddingNail", "Pudding Nail")
|
|
|
|
{
|
2024-03-15 19:18:21 +00:00
|
|
|
defaultLength = 8f,
|
2024-03-04 05:58:22 +00:00
|
|
|
resizable = true
|
|
|
|
},
|
|
|
|
new GameAction("cherryNail", "Cherry Nail")
|
|
|
|
{
|
2024-03-15 19:18:21 +00:00
|
|
|
defaultLength = 4f,
|
2024-03-04 05:58:22 +00:00
|
|
|
resizable = true
|
|
|
|
},
|
|
|
|
new GameAction("cakeNail", "Cake Nail")
|
|
|
|
{
|
2024-03-15 19:18:21 +00:00
|
|
|
defaultLength = 4f,
|
2024-03-04 05:58:22 +00:00
|
|
|
resizable = true
|
|
|
|
},
|
|
|
|
new GameAction("cakeLongNail", "Cake Long Nail")
|
|
|
|
{
|
2024-03-15 19:18:21 +00:00
|
|
|
defaultLength = 4f,
|
2024-03-04 05:58:22 +00:00
|
|
|
resizable = true
|
|
|
|
},
|
2024-03-15 19:18:21 +00:00
|
|
|
new GameAction("slideFusuma", "Slide Shoji")
|
2024-03-04 05:58:22 +00:00
|
|
|
{
|
|
|
|
function = delegate {
|
2024-03-15 19:18:21 +00:00
|
|
|
var e = eventCaller.currentEntity;
|
|
|
|
NailCarpenter.instance.SlideShoji(e.beat, e.length, e["fillRatio"], e["ease"], e["mute"]);
|
2024-03-04 05:58:22 +00:00
|
|
|
},
|
2024-03-15 19:18:21 +00:00
|
|
|
defaultLength = 1f,
|
2024-03-04 05:58:22 +00:00
|
|
|
resizable = true,
|
|
|
|
parameters = new List<Param>()
|
|
|
|
{
|
2024-03-15 19:18:21 +00:00
|
|
|
new Param("fillRatio", new EntityTypes.Float(0f, 1f, 0.3f), "Ratio", "Set how much of the screen the shoji covers."),
|
2024-03-04 05:58:22 +00:00
|
|
|
new Param("ease", Util.EasingFunction.Ease.Linear, "Ease", "Set the easing of the action."),
|
|
|
|
new Param("mute", false, "Mute", "Toggle if the cue should be muted.")
|
|
|
|
}
|
|
|
|
},
|
2024-03-15 19:18:21 +00:00
|
|
|
|
2024-03-04 05:58:22 +00:00
|
|
|
},
|
|
|
|
new List<string>() { "pco", "normal" },
|
|
|
|
"pconail", "en",
|
2024-03-29 02:35:07 +00:00
|
|
|
new List<string>() { },
|
|
|
|
chronologicalSortKey: 20121009
|
2024-03-04 05:58:22 +00:00
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
namespace HeavenStudio.Games
|
|
|
|
{
|
|
|
|
using Scripts_NailCarpenter;
|
|
|
|
|
|
|
|
public class NailCarpenter : Minigame
|
|
|
|
{
|
2024-03-15 19:18:21 +00:00
|
|
|
const double PATTERN_SEEK_TIME = 8.0;
|
|
|
|
|
|
|
|
[Serializable]
|
|
|
|
public struct ObjectPatternItem
|
|
|
|
{
|
|
|
|
public double beat;
|
|
|
|
public ObjectType type;
|
|
|
|
}
|
|
|
|
|
|
|
|
public enum ObjectType
|
|
|
|
{
|
|
|
|
Nail,
|
|
|
|
LongNail,
|
|
|
|
Sweet,
|
|
|
|
ForceCherry,
|
|
|
|
ForcePudding,
|
|
|
|
ForceCherryPudding,
|
|
|
|
ForceShortCake,
|
|
|
|
ForceLayerCake,
|
|
|
|
None,
|
|
|
|
LongCharge
|
|
|
|
}
|
|
|
|
|
|
|
|
struct ScheduledPattern
|
|
|
|
{
|
|
|
|
public double beat;
|
|
|
|
public double length;
|
|
|
|
public PatternType type;
|
|
|
|
}
|
|
|
|
|
|
|
|
enum PatternType
|
|
|
|
{
|
|
|
|
Pudding,
|
|
|
|
Cherry,
|
|
|
|
Cake,
|
|
|
|
CakeLong,
|
|
|
|
None
|
|
|
|
}
|
|
|
|
|
|
|
|
[SerializeField] ObjectPatternItem[] puddingPattern;
|
|
|
|
[SerializeField] ObjectPatternItem[] cherryPattern;
|
|
|
|
[SerializeField] ObjectPatternItem[] cakePattern;
|
|
|
|
[SerializeField] ObjectPatternItem[] cakeLongPattern;
|
|
|
|
[SerializeField] float scrollMetresPerBeat = 4f;
|
|
|
|
[SerializeField] float boardWidth = 19.2f;
|
|
|
|
|
2024-03-04 05:58:22 +00:00
|
|
|
public GameObject baseNail;
|
|
|
|
public GameObject baseLongNail;
|
|
|
|
public GameObject baseSweet;
|
|
|
|
public Animator Carpenter;
|
|
|
|
public Animator EffectExclamRed;
|
|
|
|
public Animator EffectExclamBlue;
|
|
|
|
|
|
|
|
public Transform scrollingHolder;
|
|
|
|
public Transform nailHolder;
|
|
|
|
public Transform boardTrans;
|
2024-03-15 19:18:21 +00:00
|
|
|
public Transform shojiTrans;
|
2024-03-04 05:58:22 +00:00
|
|
|
|
|
|
|
private bool missed;
|
2024-04-07 21:25:54 +00:00
|
|
|
//private bool hasSlurped; Unused value - Marc
|
2024-03-04 05:58:22 +00:00
|
|
|
|
|
|
|
const int IAAltDownCat = IAMAXCAT;
|
2024-03-15 19:18:21 +00:00
|
|
|
const int IASweetsCat = IAMAXCAT + 1;
|
2024-03-04 05:58:22 +00:00
|
|
|
|
|
|
|
protected static bool IA_PadAltPress(out double dt)
|
|
|
|
{
|
|
|
|
return PlayerInput.GetPadDown(InputController.ActionsPad.South, out dt);
|
|
|
|
}
|
|
|
|
protected static bool IA_BatonAltPress(out double dt)
|
|
|
|
{
|
|
|
|
return PlayerInput.GetSqueezeDown(out dt);
|
|
|
|
}
|
2024-03-15 19:18:21 +00:00
|
|
|
|
|
|
|
protected static bool IA_TouchRegularPress(out double dt)
|
|
|
|
{
|
|
|
|
return PlayerInput.GetTouchDown(InputController.ActionsTouch.Tap, out dt)
|
|
|
|
&& !instance.IsExpectingInputNow(InputAction_AltPress);
|
|
|
|
}
|
2024-03-04 05:58:22 +00:00
|
|
|
protected static bool IA_TouchAltPress(out double dt)
|
|
|
|
{
|
|
|
|
return PlayerInput.GetTouchDown(InputController.ActionsTouch.Tap, out dt)
|
2024-03-15 19:18:21 +00:00
|
|
|
&& instance.IsExpectingInputNow(InputAction_AltPress)
|
|
|
|
&& !instance.IsExpectingInputNow(InputAction_RegPress);
|
2024-03-04 05:58:22 +00:00
|
|
|
}
|
|
|
|
|
2024-03-15 19:18:21 +00:00
|
|
|
protected static bool IA_PadSweetsCheck(out double dt)
|
2024-03-04 05:58:22 +00:00
|
|
|
{
|
2024-03-15 19:18:21 +00:00
|
|
|
return (PlayerInput.GetPadDown(InputController.ActionsPad.South, out dt)
|
|
|
|
|| PlayerInput.GetPadDown(InputController.ActionsPad.East, out dt))
|
|
|
|
&& !(instance.IsExpectingInputNow(InputAction_RegPress) || instance.IsExpectingInputNow(InputAction_AltPress));
|
2024-03-04 05:58:22 +00:00
|
|
|
}
|
2024-03-15 19:18:21 +00:00
|
|
|
protected static bool IA_BatonSweetsCheck(out double dt)
|
2024-03-04 05:58:22 +00:00
|
|
|
{
|
2024-03-15 19:18:21 +00:00
|
|
|
return (PlayerInput.GetBatonDown(InputController.ActionsBaton.Face, out dt)
|
|
|
|
|| PlayerInput.GetSqueezeDown(out dt))
|
|
|
|
&& !(instance.IsExpectingInputNow(InputAction_RegPress) || instance.IsExpectingInputNow(InputAction_AltPress));
|
|
|
|
}
|
|
|
|
protected static bool IA_TouchSweetsCheck(out double dt)
|
|
|
|
{
|
|
|
|
return PlayerInput.GetTouchDown(InputController.ActionsTouch.Tap, out dt)
|
|
|
|
&& !(instance.IsExpectingInputNow(InputAction_RegPress) || instance.IsExpectingInputNow(InputAction_AltPress));
|
2024-03-04 05:58:22 +00:00
|
|
|
}
|
|
|
|
|
2024-03-15 19:18:21 +00:00
|
|
|
public static PlayerInput.InputAction InputAction_RegPress =
|
|
|
|
new("PcoNailRegStart", new int[] { IAPressCat, IAPressCat, IAPressCat },
|
|
|
|
IA_PadBasicPress, IA_TouchRegularPress, IA_BatonBasicPress);
|
|
|
|
public static PlayerInput.InputAction InputAction_AltPress =
|
2024-03-04 05:58:22 +00:00
|
|
|
new("PcoNailAltStart", new int[] { IAAltDownCat, IAAltDownCat, IAAltDownCat },
|
|
|
|
IA_PadAltPress, IA_TouchAltPress, IA_BatonAltPress);
|
2024-03-15 19:18:21 +00:00
|
|
|
public static PlayerInput.InputAction InputAction_SweetsHit =
|
|
|
|
new("PcoNailSweetsHit", new int[] { IASweetsCat, IASweetsCat, IASweetsCat },
|
|
|
|
IA_PadSweetsCheck, IA_TouchSweetsCheck, IA_BatonSweetsCheck);
|
2024-03-04 05:58:22 +00:00
|
|
|
|
|
|
|
public static NailCarpenter instance;
|
|
|
|
|
|
|
|
// Start is called before the first frame update
|
|
|
|
void Awake()
|
|
|
|
{
|
|
|
|
instance = this;
|
|
|
|
}
|
|
|
|
|
2024-03-15 19:18:21 +00:00
|
|
|
List<ScheduledPattern> scheduledPatterns = new List<ScheduledPattern>();
|
|
|
|
double patternStartBeat, gameStartBeat;
|
|
|
|
PatternType patternType, lastPatternType;
|
|
|
|
int patternIndex, lastPatternIndex = -1;
|
|
|
|
|
2024-03-04 05:58:22 +00:00
|
|
|
double slideBeat = double.MaxValue;
|
|
|
|
double slideLength;
|
2024-03-15 19:18:21 +00:00
|
|
|
double cachedPatternLengthPudding, cachedPatternLengthCherry, cachedPatternLengthCake, cachedPatternLengthCakeLong;
|
2024-03-04 05:58:22 +00:00
|
|
|
Util.EasingFunction.Ease slideEase;
|
|
|
|
float slideRatioLast = 0, slideRatioNext = 0;
|
|
|
|
|
2024-03-15 19:18:21 +00:00
|
|
|
void Start()
|
|
|
|
{
|
|
|
|
if (!conductor.isPlaying) return;
|
|
|
|
UpdatePatterns();
|
|
|
|
}
|
|
|
|
|
|
|
|
public override void OnBeatPulse(double beat)
|
2024-03-04 05:58:22 +00:00
|
|
|
{
|
2024-03-15 19:18:21 +00:00
|
|
|
if (!IsExpectingInputNow(InputAction_AltPress) && UnityEngine.Random.value < 0.1f)
|
|
|
|
{
|
|
|
|
Carpenter.Play("eyeBlinkFast", 1, 0);
|
|
|
|
}
|
|
|
|
}
|
2024-03-04 05:58:22 +00:00
|
|
|
|
2024-03-15 19:18:21 +00:00
|
|
|
void Update()
|
|
|
|
{
|
2024-04-07 04:56:37 +00:00
|
|
|
double currentBeat = conductor.unswungSongPositionInBeatsAsDouble;
|
2024-03-04 05:58:22 +00:00
|
|
|
|
2024-03-15 19:18:21 +00:00
|
|
|
if (!conductor.isPlaying) return;
|
2024-03-04 05:58:22 +00:00
|
|
|
|
2024-03-15 19:18:21 +00:00
|
|
|
if (PlayerInput.GetIsAction(InputAction_RegPress) && !IsExpectingInputNow(InputAction_RegPress))
|
2024-03-04 05:58:22 +00:00
|
|
|
{
|
2024-03-15 19:18:21 +00:00
|
|
|
ScoreMiss();
|
2024-03-04 05:58:22 +00:00
|
|
|
SoundByte.PlayOneShot("miss");
|
2024-03-15 19:18:21 +00:00
|
|
|
Carpenter.DoScaledAnimationAsync("carpenterHit", 0.25f);
|
2024-04-07 21:25:54 +00:00
|
|
|
//hasSlurped = false; Unused value - Marc
|
2024-03-04 05:58:22 +00:00
|
|
|
}
|
2024-03-15 19:18:21 +00:00
|
|
|
if (PlayerInput.GetIsAction(InputAction_AltPress) && !IsExpectingInputNow(InputAction_AltPress))
|
2024-03-04 05:58:22 +00:00
|
|
|
{
|
2024-03-15 19:18:21 +00:00
|
|
|
ScoreMiss();
|
2024-03-04 05:58:22 +00:00
|
|
|
SoundByte.PlayOneShot("miss");
|
2024-03-15 19:18:21 +00:00
|
|
|
Carpenter.DoScaledAnimationAsync("carpenterHit", 0.25f);
|
2024-04-07 21:25:54 +00:00
|
|
|
//hasSlurped = false; Unused value - Marc
|
2024-03-04 05:58:22 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// Board scroll.
|
2024-04-07 04:56:37 +00:00
|
|
|
Vector3 boardPos = boardTrans.localPosition;
|
|
|
|
double newBoardX = currentBeat * scrollMetresPerBeat;
|
2024-03-04 05:58:22 +00:00
|
|
|
newBoardX %= boardWidth;
|
2024-03-15 19:18:21 +00:00
|
|
|
boardTrans.localPosition = new Vector3((float)newBoardX, boardPos.y, boardPos.z);
|
2024-03-04 05:58:22 +00:00
|
|
|
|
2024-03-15 19:18:21 +00:00
|
|
|
UpdatePatterns();
|
|
|
|
UpdateShoji(currentBeat);
|
2024-03-04 05:58:22 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
public override void OnGameSwitch(double beat)
|
|
|
|
{
|
2024-03-15 19:18:21 +00:00
|
|
|
cachedPatternLengthPudding = puddingPattern[^1].beat;
|
|
|
|
cachedPatternLengthCherry = cherryPattern[^1].beat;
|
|
|
|
cachedPatternLengthCake = cakePattern[^1].beat;
|
|
|
|
cachedPatternLengthCakeLong = cakeLongPattern[^1].beat;
|
|
|
|
|
2024-03-04 05:58:22 +00:00
|
|
|
double endBeat = double.MaxValue;
|
2024-03-15 19:18:21 +00:00
|
|
|
var entities = gameManager.Beatmap.Entities;
|
2024-03-04 05:58:22 +00:00
|
|
|
|
2024-03-15 19:18:21 +00:00
|
|
|
gameStartBeat = beat;
|
|
|
|
patternStartBeat = gameStartBeat;
|
2024-03-04 05:58:22 +00:00
|
|
|
// find out when the next game switch (or remix end) happens
|
2024-03-15 19:18:21 +00:00
|
|
|
RiqEntity firstEnd = entities.Find(c => (c.datamodel.StartsWith("gameManager/switchGame") || c.datamodel.Equals("gameManager/end")) && c.beat > gameStartBeat);
|
|
|
|
endBeat = firstEnd?.beat ?? endBeat;
|
2024-03-04 05:58:22 +00:00
|
|
|
|
2024-03-15 19:18:21 +00:00
|
|
|
List<RiqEntity> events = entities.FindAll(v => (v.datamodel is "nailCarpenter/puddingNail" or "nailCarpenter/cherryNail" or "nailCarpenter/cakeNail" or "nailCarpenter/cakeLongNail") && v.beat >= gameStartBeat && v.beat < endBeat);
|
|
|
|
scheduledPatterns.Clear();
|
|
|
|
patternIndex = 0;
|
|
|
|
foreach (var evt in events)
|
|
|
|
{
|
|
|
|
if (evt.length == 0) continue;
|
|
|
|
int patternDivisions = (int)Math.Ceiling(evt.length / PATTERN_SEEK_TIME);
|
|
|
|
PatternType patternType = evt.datamodel switch
|
|
|
|
{
|
|
|
|
"nailCarpenter/puddingNail" => PatternType.Pudding,
|
|
|
|
"nailCarpenter/cherryNail" => PatternType.Cherry,
|
|
|
|
"nailCarpenter/cakeNail" => PatternType.Cake,
|
|
|
|
"nailCarpenter/cakeLongNail" => PatternType.CakeLong,
|
|
|
|
_ => throw new NotImplementedException()
|
|
|
|
};
|
|
|
|
for (int i = 0; i < patternDivisions; i++)
|
|
|
|
{
|
|
|
|
var pattern = new ScheduledPattern
|
2024-03-04 05:58:22 +00:00
|
|
|
{
|
2024-03-15 19:18:21 +00:00
|
|
|
beat = evt.beat + (PATTERN_SEEK_TIME * i),
|
|
|
|
length = Math.Min(evt.length - (PATTERN_SEEK_TIME * i), PATTERN_SEEK_TIME),
|
|
|
|
type = patternType
|
|
|
|
};
|
|
|
|
scheduledPatterns.Add(pattern);
|
2024-03-04 05:58:22 +00:00
|
|
|
}
|
|
|
|
}
|
2024-03-15 19:18:21 +00:00
|
|
|
}
|
2024-03-04 05:58:22 +00:00
|
|
|
|
2024-03-15 19:18:21 +00:00
|
|
|
public override void OnPlay(double beat)
|
|
|
|
{
|
|
|
|
OnGameSwitch(beat);
|
|
|
|
}
|
2024-03-04 05:58:22 +00:00
|
|
|
|
2024-03-15 19:18:21 +00:00
|
|
|
void UpdatePatterns()
|
|
|
|
{
|
|
|
|
double beat = conductor.songPositionInBeatsAsDouble;
|
|
|
|
while (patternStartBeat < beat + PATTERN_SEEK_TIME)
|
|
|
|
{
|
|
|
|
if (patternIndex < scheduledPatterns.Count)
|
|
|
|
{
|
|
|
|
var pattern = scheduledPatterns[patternIndex];
|
|
|
|
if (pattern.type == PatternType.None)
|
2024-03-04 05:58:22 +00:00
|
|
|
{
|
2024-03-15 19:18:21 +00:00
|
|
|
patternIndex++;
|
|
|
|
continue;
|
2024-03-04 05:58:22 +00:00
|
|
|
}
|
2024-03-15 19:18:21 +00:00
|
|
|
if (pattern.beat + pattern.length < patternStartBeat)
|
2024-03-04 05:58:22 +00:00
|
|
|
{
|
2024-03-15 19:18:21 +00:00
|
|
|
patternIndex++;
|
|
|
|
continue;
|
2024-03-04 05:58:22 +00:00
|
|
|
}
|
2024-03-15 19:18:21 +00:00
|
|
|
SpawnPattern(pattern.beat, pattern.length, pattern.type);
|
|
|
|
patternStartBeat = pattern.beat + pattern.length;
|
|
|
|
lastPatternIndex = patternIndex;
|
|
|
|
patternIndex++;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
break;
|
2024-03-04 05:58:22 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2024-03-15 19:18:21 +00:00
|
|
|
public void SlideShoji(double beat, double length, float fillRatio, int ease, bool mute)
|
2024-03-04 05:58:22 +00:00
|
|
|
{
|
2024-03-15 19:18:21 +00:00
|
|
|
if (!mute) SoundByte.PlayOneShotGame("nailCarpenter/open", beat, forcePlay: true);
|
2024-03-04 05:58:22 +00:00
|
|
|
slideBeat = beat;
|
|
|
|
slideLength = length;
|
|
|
|
slideEase = (Util.EasingFunction.Ease)ease;
|
|
|
|
slideRatioLast = slideRatioNext;
|
|
|
|
slideRatioNext = fillRatio;
|
|
|
|
}
|
2024-03-15 19:18:21 +00:00
|
|
|
|
|
|
|
void UpdateShoji(double beat)
|
2024-03-04 05:58:22 +00:00
|
|
|
{
|
|
|
|
if (beat >= slideBeat)
|
|
|
|
{
|
2024-03-15 19:18:21 +00:00
|
|
|
float slideLast = 17.8f * (1 - slideRatioLast);
|
|
|
|
float slideNext = 17.8f * (1 - slideRatioNext);
|
2024-03-04 05:58:22 +00:00
|
|
|
Util.EasingFunction.Function func = Util.EasingFunction.GetEasingFunction(slideEase);
|
|
|
|
float slideProg = Conductor.instance.GetPositionFromBeat(slideBeat, slideLength, true);
|
|
|
|
slideProg = Mathf.Clamp01(slideProg);
|
|
|
|
float slide = func(slideLast, slideNext, slideProg);
|
2024-03-15 19:18:21 +00:00
|
|
|
shojiTrans.localPosition = new Vector3(slide, 0, 0);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
private void SpawnPattern(double beat, double length, PatternType pattern)
|
|
|
|
{
|
|
|
|
if (pattern == PatternType.None) return;
|
|
|
|
double patternLength = pattern switch
|
|
|
|
{
|
|
|
|
PatternType.Pudding => cachedPatternLengthPudding,
|
|
|
|
PatternType.Cherry => cachedPatternLengthCherry,
|
|
|
|
PatternType.Cake => cachedPatternLengthCake,
|
|
|
|
PatternType.CakeLong => cachedPatternLengthCakeLong,
|
|
|
|
_ => throw new NotImplementedException()
|
|
|
|
};
|
|
|
|
patternType = pattern;
|
|
|
|
int patternIterations = (int)Math.Ceiling(length / patternLength);
|
|
|
|
for (int i = 0; i < patternIterations; i++)
|
|
|
|
{
|
|
|
|
SpawnPatternSegment(beat + (patternLength * i), gameStartBeat, pattern switch
|
|
|
|
{
|
|
|
|
PatternType.Pudding => puddingPattern,
|
|
|
|
PatternType.Cherry => cherryPattern,
|
|
|
|
PatternType.Cake => cakePattern,
|
|
|
|
PatternType.CakeLong => cakeLongPattern,
|
|
|
|
_ => throw new NotImplementedException()
|
|
|
|
});
|
|
|
|
lastPatternType = patternType;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
private void SpawnPatternSegment(double beat, double startbeat, ObjectPatternItem[] pattern)
|
|
|
|
{
|
|
|
|
foreach (var item in pattern)
|
|
|
|
{
|
|
|
|
double itemBeat = beat + item.beat;
|
|
|
|
switch (item.type)
|
|
|
|
{
|
|
|
|
case ObjectType.LongCharge:
|
|
|
|
SoundByte.PlayOneShotGame("nailCarpenter/signal2", itemBeat, forcePlay: true);
|
|
|
|
BeatAction.New(instance, new List<BeatAction.Action>()
|
|
|
|
{
|
|
|
|
new BeatAction.Action(itemBeat, delegate
|
|
|
|
{
|
|
|
|
Carpenter.DoScaledAnimationAsync("carpenterArmUp", 0.25f);
|
|
|
|
}),
|
|
|
|
});
|
|
|
|
break;
|
|
|
|
case ObjectType.Nail:
|
|
|
|
SpawnNail(itemBeat, startbeat);
|
|
|
|
break;
|
|
|
|
case ObjectType.LongNail:
|
|
|
|
SpawnLongNail(itemBeat, startbeat);
|
|
|
|
break;
|
|
|
|
case ObjectType.Sweet:
|
|
|
|
// dynamically determine sweet based on pattern and last pattern
|
|
|
|
Sweet.sweetsType sweetType = Sweet.sweetsType.None;
|
|
|
|
switch (patternType)
|
|
|
|
{
|
|
|
|
case PatternType.Pudding:
|
|
|
|
SoundByte.PlayOneShotGame("nailCarpenter/one", itemBeat, forcePlay: true);
|
|
|
|
sweetType = Sweet.sweetsType.Pudding;
|
|
|
|
break;
|
|
|
|
case PatternType.Cherry:
|
|
|
|
SoundByte.PlayOneShotGame("nailCarpenter/three", itemBeat, forcePlay: true);
|
|
|
|
sweetType = Sweet.sweetsType.CherryPudding;
|
|
|
|
break;
|
|
|
|
case PatternType.Cake:
|
|
|
|
SoundByte.PlayOneShotGame("nailCarpenter/alarm", itemBeat, forcePlay: true);
|
|
|
|
sweetType = Sweet.sweetsType.ShortCake;
|
|
|
|
BeatAction.New(instance, new List<BeatAction.Action>()
|
|
|
|
{
|
|
|
|
new BeatAction.Action(itemBeat, delegate
|
|
|
|
{
|
|
|
|
EffectExclamRed.DoScaledAnimationAsync("exclamAppear", 0.25f);
|
|
|
|
})
|
|
|
|
});
|
|
|
|
break;
|
|
|
|
case PatternType.CakeLong:
|
|
|
|
SoundByte.PlayOneShotGame("nailCarpenter/signal1", itemBeat, forcePlay: true);
|
|
|
|
sweetType = Sweet.sweetsType.LayerCake;
|
|
|
|
BeatAction.New(instance, new List<BeatAction.Action>()
|
|
|
|
{
|
|
|
|
new BeatAction.Action(itemBeat, delegate
|
|
|
|
{
|
|
|
|
EffectExclamBlue.DoScaledAnimationAsync("exclamAppear", 0.25f);
|
|
|
|
}),
|
|
|
|
});
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
if (lastPatternType == PatternType.Cake)
|
|
|
|
{
|
|
|
|
SpawnSweet(itemBeat, startbeat, Sweet.sweetsType.Cherry);
|
|
|
|
}
|
|
|
|
else if (sweetType != Sweet.sweetsType.None)
|
|
|
|
{
|
|
|
|
SpawnSweet(itemBeat, startbeat, sweetType);
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case ObjectType.ForceCherry:
|
|
|
|
SpawnSweet(itemBeat, startbeat, Sweet.sweetsType.Cherry);
|
|
|
|
break;
|
|
|
|
case ObjectType.ForcePudding:
|
|
|
|
SoundByte.PlayOneShotGame("nailCarpenter/one", itemBeat);
|
|
|
|
SpawnSweet(itemBeat, startbeat, Sweet.sweetsType.Pudding);
|
|
|
|
break;
|
|
|
|
case ObjectType.ForceCherryPudding:
|
|
|
|
SoundByte.PlayOneShotGame("nailCarpenter/three", itemBeat, forcePlay: true);
|
|
|
|
SpawnSweet(itemBeat, startbeat, Sweet.sweetsType.CherryPudding);
|
|
|
|
break;
|
|
|
|
case ObjectType.ForceShortCake:
|
|
|
|
SoundByte.PlayOneShotGame("nailCarpenter/alarm", itemBeat, forcePlay: true);
|
|
|
|
BeatAction.New(instance, new List<BeatAction.Action>()
|
|
|
|
{
|
|
|
|
new BeatAction.Action(itemBeat, delegate
|
|
|
|
{
|
|
|
|
EffectExclamRed.DoScaledAnimationAsync("exclamAppear", 0.25f);
|
|
|
|
})
|
|
|
|
});
|
|
|
|
SpawnSweet(itemBeat, startbeat, Sweet.sweetsType.ShortCake);
|
|
|
|
break;
|
|
|
|
case ObjectType.ForceLayerCake:
|
|
|
|
SoundByte.PlayOneShotGame("nailCarpenter/signal1", itemBeat, forcePlay: true);
|
|
|
|
BeatAction.New(instance, new List<BeatAction.Action>()
|
|
|
|
{
|
|
|
|
new BeatAction.Action(itemBeat, delegate
|
|
|
|
{
|
|
|
|
EffectExclamBlue.DoScaledAnimationAsync("exclamAppear", 0.25f);
|
|
|
|
}),
|
|
|
|
});
|
|
|
|
SpawnSweet(itemBeat, startbeat, Sweet.sweetsType.LayerCake);
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
2024-03-04 05:58:22 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
private void SpawnNail(double beat, double startBeat)
|
|
|
|
{
|
|
|
|
var newNail = Instantiate(baseNail, nailHolder).GetComponent<Nail>();
|
|
|
|
|
|
|
|
newNail.targetBeat = beat;
|
2024-03-15 19:18:21 +00:00
|
|
|
newNail.targetX = nailHolder.position.x;
|
|
|
|
newNail.metresPerSecond = scrollMetresPerBeat;
|
2024-03-04 05:58:22 +00:00
|
|
|
|
|
|
|
newNail.Init();
|
|
|
|
newNail.gameObject.SetActive(true);
|
|
|
|
}
|
|
|
|
private void SpawnLongNail(double beat, double startBeat)
|
|
|
|
{
|
|
|
|
var newNail = Instantiate(baseLongNail, nailHolder).GetComponent<LongNail>();
|
|
|
|
|
|
|
|
newNail.targetBeat = beat;
|
2024-03-15 19:18:21 +00:00
|
|
|
newNail.targetX = nailHolder.position.x;
|
|
|
|
newNail.metresPerSecond = scrollMetresPerBeat;
|
2024-03-04 05:58:22 +00:00
|
|
|
|
|
|
|
newNail.Init();
|
|
|
|
newNail.gameObject.SetActive(true);
|
|
|
|
}
|
|
|
|
private void SpawnSweet(double beat, double startBeat, Sweet.sweetsType sweetType)
|
|
|
|
{
|
|
|
|
var newSweet = Instantiate(baseSweet, nailHolder).GetComponent<Sweet>();
|
|
|
|
|
|
|
|
newSweet.targetBeat = beat;
|
|
|
|
newSweet.sweetType = sweetType;
|
2024-03-15 19:18:21 +00:00
|
|
|
newSweet.targetX = nailHolder.position.x;
|
|
|
|
newSweet.metresPerSecond = scrollMetresPerBeat;
|
2024-03-04 05:58:22 +00:00
|
|
|
|
|
|
|
newSweet.gameObject.SetActive(true);
|
|
|
|
newSweet.Init();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|