Count In Added
This commit is contained in:
parent
ab1935bc0d
commit
7d96bcfec0
|
|
@ -76,10 +76,10 @@ MonoBehaviour:
|
|||
m_Script: {fileID: 11500000, guid: fc6d77daa4e399f4fbac22c2f7de8777, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
platformRef: {fileID: 1815905863429998752, guid: 73364b4dafdbd914f83c316a1fcf8dd7, type: 3}
|
||||
platformRef: {fileID: 1558448204157038467, guid: 73364b4dafdbd914f83c316a1fcf8dd7, type: 3}
|
||||
defaultYPos: -11.76
|
||||
platformDistance: 3.8
|
||||
platformAmount: 15
|
||||
playerXPos: -6.78
|
||||
--- !u!1 &955264990193298390
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
|
|
@ -679,6 +679,7 @@ MonoBehaviour:
|
|||
EligibleHits: []
|
||||
scheduledInputs: []
|
||||
firstEnable: 0
|
||||
playYan: {fileID: 1314280037714680423}
|
||||
--- !u!1 &4465275889429203320
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
|
|
|
|||
|
|
@ -9,6 +9,7 @@ GameObject:
|
|||
serializedVersion: 6
|
||||
m_Component:
|
||||
- component: {fileID: 9016694733661613840}
|
||||
- component: {fileID: 1558448204157038467}
|
||||
m_Layer: 0
|
||||
m_Name: JumpPlatform
|
||||
m_TagString: Untagged
|
||||
|
|
@ -33,6 +34,18 @@ Transform:
|
|||
m_Father: {fileID: 0}
|
||||
m_RootOrder: 0
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
--- !u!114 &1558448204157038467
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 1815905863429998752}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: 2b6892a770a77394ca687ef93f8935db, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
--- !u!1 &4717417375749839996
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
|
|
|
|||
|
|
@ -2,6 +2,8 @@ using System.Collections;
|
|||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
using HeavenStudio.Util;
|
||||
using Jukebox;
|
||||
using System;
|
||||
|
||||
namespace HeavenStudio.Games.Loaders
|
||||
{
|
||||
|
|
@ -13,7 +15,15 @@ namespace HeavenStudio.Games.Loaders
|
|||
{
|
||||
return new Minigame("nightWalkAgb", "Night Walk (GBA)", "FFFFFF", false, false, new List<GameAction>()
|
||||
{
|
||||
|
||||
new GameAction("countIn", "Count In")
|
||||
{
|
||||
preFunction = delegate { if (!eventCaller.currentEntity["mute"] && AgbNightWalk.IsValidCountIn(eventCaller.currentEntity)) AgbNightWalk.CountInSound(eventCaller.currentEntity.beat); },
|
||||
defaultLength = 8,
|
||||
parameters = new List<Param>()
|
||||
{
|
||||
new Param("mute", false, "Mute Cowbell")
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
@ -21,14 +31,151 @@ namespace HeavenStudio.Games.Loaders
|
|||
|
||||
namespace HeavenStudio.Games
|
||||
{
|
||||
using Scripts_AgbNightWalk;
|
||||
|
||||
public class AgbNightWalk : Minigame
|
||||
{
|
||||
public static AgbNightWalk instance;
|
||||
[SerializeField] private AgbPlayYan playYan;
|
||||
[NonSerialized] public double countInBeat = -1;
|
||||
|
||||
private void Awake()
|
||||
{
|
||||
instance = this;
|
||||
}
|
||||
|
||||
public override void OnGameSwitch(double beat)
|
||||
{
|
||||
SetCountInBeat(beat);
|
||||
}
|
||||
|
||||
public override void OnPlay(double beat)
|
||||
{
|
||||
SetCountInBeat(beat);
|
||||
}
|
||||
|
||||
private void SetCountInBeat(double beat)
|
||||
{
|
||||
List<RiqEntity> countInEvents = EventCaller.GetAllInGameManagerList("nightWalkAgb", new string[] { "countIn" });
|
||||
if (countInEvents.Count > 0)
|
||||
{
|
||||
var allEnds = EventCaller.GetAllInGameManagerList("gameManager", new string[] { "switchGame" });
|
||||
if (allEnds.Count == 0)
|
||||
{
|
||||
countInBeat = countInEvents[0].beat;
|
||||
}
|
||||
else
|
||||
{
|
||||
allEnds.Sort((x, y) => x.beat.CompareTo(y.beat));
|
||||
double nextSwitchBeat = double.MaxValue;
|
||||
foreach (var end in allEnds)
|
||||
{
|
||||
if (end.datamodel.Split(2) == "nightWalkAgb") continue;
|
||||
if (end.beat > beat)
|
||||
{
|
||||
nextSwitchBeat = end.beat;
|
||||
break;
|
||||
}
|
||||
}
|
||||
List<RiqEntity> tempEvents = new();
|
||||
foreach (var countIn in countInEvents)
|
||||
{
|
||||
if (countIn.beat < nextSwitchBeat)
|
||||
{
|
||||
tempEvents.Add(countIn);
|
||||
}
|
||||
}
|
||||
tempEvents.Sort((x, y) => x.beat.CompareTo(y.beat));
|
||||
countInBeat = tempEvents[tempEvents.Count - 1].beat;
|
||||
}
|
||||
}
|
||||
UpdateBalloons(beat);
|
||||
}
|
||||
|
||||
public static bool IsValidCountIn(RiqEntity countInEntity)
|
||||
{
|
||||
List<RiqEntity> countInEvents = EventCaller.GetAllInGameManagerList("nightWalkAgb", new string[] { "countIn" });
|
||||
if (countInEvents.Count > 0)
|
||||
{
|
||||
var allEnds = EventCaller.GetAllInGameManagerList("gameManager", new string[] { "switchGame" });
|
||||
if (allEnds.Count == 0)
|
||||
{
|
||||
return countInEntity == countInEvents[0];
|
||||
}
|
||||
else
|
||||
{
|
||||
allEnds.Sort((x, y) => x.beat.CompareTo(y.beat));
|
||||
List<RiqEntity> tempEnds = new();
|
||||
double beat = -1;
|
||||
for (int i = 0; i < allEnds.Count; i++)
|
||||
{
|
||||
if (allEnds[i].datamodel.Split(2) == "nightWalkAgb")
|
||||
{
|
||||
if (allEnds[i].beat >= countInEntity.beat)
|
||||
{
|
||||
tempEnds.Add(allEnds[i]);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (tempEnds.Count > 0) beat = tempEnds[0].beat;
|
||||
double nextSwitchBeat = double.MaxValue;
|
||||
foreach (var end in allEnds)
|
||||
{
|
||||
if (end.datamodel.Split(2) == "nightWalkAgb") continue;
|
||||
if (end.beat > beat)
|
||||
{
|
||||
nextSwitchBeat = end.beat;
|
||||
break;
|
||||
}
|
||||
}
|
||||
List<RiqEntity> tempEvents = new();
|
||||
foreach (var countIn in countInEvents)
|
||||
{
|
||||
if (countIn.beat < nextSwitchBeat)
|
||||
{
|
||||
tempEvents.Add(countIn);
|
||||
}
|
||||
}
|
||||
tempEvents.Sort((x, y) => x.beat.CompareTo(y.beat));
|
||||
return countInEntity == tempEvents[tempEvents.Count - 1];
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
private void UpdateBalloons(double beat)
|
||||
{
|
||||
if (countInBeat != -1)
|
||||
{
|
||||
BeatAction.New(instance.gameObject, new List<BeatAction.Action>()
|
||||
{
|
||||
new BeatAction.Action(countInBeat, delegate { playYan.PopBalloon(0, beat >= countInBeat); }),
|
||||
new BeatAction.Action(countInBeat + 2, delegate { playYan.PopBalloon(1, beat >= countInBeat + 2); }),
|
||||
new BeatAction.Action(countInBeat + 4, delegate { playYan.PopBalloon(2, beat >= countInBeat + 4); }),
|
||||
new BeatAction.Action(countInBeat + 5, delegate { playYan.PopBalloon(3, beat >= countInBeat + 5); }),
|
||||
new BeatAction.Action(countInBeat + 6, delegate { playYan.PopBalloon(4, beat >= countInBeat + 6); }),
|
||||
new BeatAction.Action(countInBeat + 7, delegate { playYan.PopBalloon(5, beat >= countInBeat + 7); }),
|
||||
new BeatAction.Action(countInBeat + 8, delegate { playYan.PopBalloon(6, beat >= countInBeat + 8); }),
|
||||
});
|
||||
}
|
||||
else
|
||||
{
|
||||
playYan.PopAll();
|
||||
}
|
||||
}
|
||||
|
||||
public static void CountInSound(double beat)
|
||||
{
|
||||
MultiSound.Play(new MultiSound.Sound[]
|
||||
{
|
||||
new MultiSound.Sound("count-ins/cowbell", beat),
|
||||
new MultiSound.Sound("count-ins/cowbell", beat + 2),
|
||||
new MultiSound.Sound("count-ins/cowbell", beat + 4),
|
||||
new MultiSound.Sound("count-ins/cowbell", beat + 5),
|
||||
new MultiSound.Sound("count-ins/cowbell", beat + 6),
|
||||
new MultiSound.Sound("count-ins/cowbell", beat + 7),
|
||||
}, false, true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
13
Assets/Scripts/Games/NightWalkAgb/AgbPlatform.cs
Normal file
13
Assets/Scripts/Games/NightWalkAgb/AgbPlatform.cs
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
namespace HeavenStudio.Games.Scripts_AgbNightWalk
|
||||
{
|
||||
public class AgbPlatform : MonoBehaviour
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
11
Assets/Scripts/Games/NightWalkAgb/AgbPlatform.cs.meta
Normal file
11
Assets/Scripts/Games/NightWalkAgb/AgbPlatform.cs.meta
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 2b6892a770a77394ca687ef93f8935db
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
|
|
@ -7,12 +7,12 @@ namespace HeavenStudio.Games.Scripts_AgbNightWalk
|
|||
public class AgbPlatformHandler : MonoBehaviour
|
||||
{
|
||||
[Header("Properties")]
|
||||
[SerializeField] private GameObject platformRef;
|
||||
[SerializeField] private float defaultYPos = -11.76f;
|
||||
[SerializeField] private float platformDistance = 3.80f;
|
||||
[SerializeField] private float playerXPos = -6.78f;
|
||||
[Range(1, 100)]
|
||||
[SerializeField] private int platformAmount = 15;
|
||||
[SerializeField] private AgbPlatform platformRef;
|
||||
public float defaultYPos = -11.76f;
|
||||
public float platformDistance = 3.80f;
|
||||
public float playerXPos = -6.78f;
|
||||
|
||||
List<AgbPlatform> platforms = new();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,3 +1,5 @@
|
|||
using HeavenStudio.Util;
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
|
@ -17,6 +19,24 @@ namespace HeavenStudio.Games.Scripts_AgbNightWalk
|
|||
balloon.Play("Idle", 0, UnityEngine.Random.Range(0f, 1f));
|
||||
}
|
||||
}
|
||||
|
||||
public void PopBalloon(int index, bool instant)
|
||||
{
|
||||
if (instant)
|
||||
{
|
||||
balloons[index].DoNormalizedAnimation("Pop", 1);
|
||||
return;
|
||||
}
|
||||
balloons[index].DoScaledAnimationAsync("Pop", 0.5f);
|
||||
}
|
||||
|
||||
public void PopAll()
|
||||
{
|
||||
foreach (var balloon in balloons)
|
||||
{
|
||||
balloon.DoNormalizedAnimation("Pop", 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue