Added Audio and Small and Big Ball events

This commit is contained in:
Rapandrasmus 2023-01-14 16:25:01 +01:00
parent 6bca3ea838
commit b972c21928
4 changed files with 76 additions and 15 deletions

View file

@ -2193,6 +2193,8 @@ MonoBehaviour:
ballTransporterLeftNPC: {fileID: 616834573968593202}
ballTransporterRightPlayer: {fileID: 4037367352976057591}
ballTransporterLeftPlayer: {fileID: 7798029629324958489}
npcImpact: {fileID: 997886481462902296}
playerImpact: {fileID: 7812265005354607313}
intervalStarted: 0
beatInterval: 4
--- !u!1 &7961625227087982507
@ -2675,14 +2677,19 @@ PrefabInstance:
objectReference: {fileID: 0}
m_RemovedComponents: []
m_SourcePrefab: {fileID: 100100000, guid: 081ed264ff8a94f4081ee6b1dbb4b144, type: 3}
--- !u!1 &1812191928769694571 stripped
GameObject:
m_CorrespondingSourceObject: {fileID: 1571991866295846512, guid: 081ed264ff8a94f4081ee6b1dbb4b144, type: 3}
m_PrefabInstance: {fileID: 934185431241313563}
m_PrefabAsset: {fileID: 0}
--- !u!4 &2428094795195615793 stripped
Transform:
m_CorrespondingSourceObject: {fileID: 3261934242483390250, guid: 081ed264ff8a94f4081ee6b1dbb4b144, type: 3}
m_PrefabInstance: {fileID: 934185431241313563}
m_PrefabAsset: {fileID: 0}
--- !u!1 &1812191928769694571 stripped
--- !u!1 &997886481462902296 stripped
GameObject:
m_CorrespondingSourceObject: {fileID: 1571991866295846512, guid: 081ed264ff8a94f4081ee6b1dbb4b144, type: 3}
m_CorrespondingSourceObject: {fileID: 85516462381953795, guid: 081ed264ff8a94f4081ee6b1dbb4b144, type: 3}
m_PrefabInstance: {fileID: 934185431241313563}
m_PrefabAsset: {fileID: 0}
--- !u!1001 &7873819805929247186
@ -2752,6 +2759,11 @@ Transform:
m_CorrespondingSourceObject: {fileID: 3261934242483390250, guid: 081ed264ff8a94f4081ee6b1dbb4b144, type: 3}
m_PrefabInstance: {fileID: 7873819805929247186}
m_PrefabAsset: {fileID: 0}
--- !u!1 &7812265005354607313 stripped
GameObject:
m_CorrespondingSourceObject: {fileID: 85516462381953795, guid: 081ed264ff8a94f4081ee6b1dbb4b144, type: 3}
m_PrefabInstance: {fileID: 7873819805929247186}
m_PrefabAsset: {fileID: 0}
--- !u!1001 &7887385672556259939
PrefabInstance:
m_ObjectHideFlags: 0
@ -2809,16 +2821,16 @@ PrefabInstance:
objectReference: {fileID: 0}
m_RemovedComponents: []
m_SourcePrefab: {fileID: 100100000, guid: f8416695a86cf2f4ba791f8f8f919c6f, type: 3}
--- !u!4 &9151496975992790811 stripped
Transform:
m_CorrespondingSourceObject: {fileID: 1330032459800393080, guid: f8416695a86cf2f4ba791f8f8f919c6f, type: 3}
m_PrefabInstance: {fileID: 7887385672556259939}
m_PrefabAsset: {fileID: 0}
--- !u!1 &7798029629324958489 stripped
GameObject:
m_CorrespondingSourceObject: {fileID: 93931120266719610, guid: f8416695a86cf2f4ba791f8f8f919c6f, type: 3}
m_PrefabInstance: {fileID: 7887385672556259939}
m_PrefabAsset: {fileID: 0}
--- !u!4 &9151496975992790811 stripped
Transform:
m_CorrespondingSourceObject: {fileID: 1330032459800393080, guid: f8416695a86cf2f4ba791f8f8f919c6f, type: 3}
m_PrefabInstance: {fileID: 7887385672556259939}
m_PrefabAsset: {fileID: 0}
--- !u!1001 &8739876439371148614
PrefabInstance:
m_ObjectHideFlags: 0
@ -2876,16 +2888,16 @@ PrefabInstance:
objectReference: {fileID: 0}
m_RemovedComponents: []
m_SourcePrefab: {fileID: 100100000, guid: 70a0fe0884e19d64e90444b2c8ffccbb, type: 3}
--- !u!4 &3116227703445627125 stripped
Transform:
m_CorrespondingSourceObject: {fileID: 5941751787586211251, guid: 70a0fe0884e19d64e90444b2c8ffccbb, type: 3}
m_PrefabInstance: {fileID: 8739876439371148614}
m_PrefabAsset: {fileID: 0}
--- !u!1 &4037367352976057591 stripped
GameObject:
m_CorrespondingSourceObject: {fileID: 4705658423790815665, guid: 70a0fe0884e19d64e90444b2c8ffccbb, type: 3}
m_PrefabInstance: {fileID: 8739876439371148614}
m_PrefabAsset: {fileID: 0}
--- !u!4 &3116227703445627125 stripped
Transform:
m_CorrespondingSourceObject: {fileID: 5941751787586211251, guid: 70a0fe0884e19d64e90444b2c8ffccbb, type: 3}
m_PrefabInstance: {fileID: 8739876439371148614}
m_PrefabAsset: {fileID: 0}
--- !u!1001 &8777656193206751016
PrefabInstance:
m_ObjectHideFlags: 0

View file

@ -18,6 +18,16 @@ namespace HeavenStudio.Games.Loaders
defaultLength = 4f,
resizable = true
},
new GameAction("small ball", "Small Ball")
{
function = delegate { WorkingDough.instance.SpawnBall(eventCaller.currentEntity.beat, false); },
defaultLength = 1f,
},
new GameAction("big ball", "Big Ball")
{
function = delegate { WorkingDough.instance.SpawnBall(eventCaller.currentEntity.beat, true); },
defaultLength = 1f,
},
});
}
}
@ -35,6 +45,8 @@ namespace HeavenStudio.Games
[SerializeField] GameObject ballTransporterLeftNPC; //Close and open animations
[SerializeField] GameObject ballTransporterRightPlayer; //Close and open animations
[SerializeField] GameObject ballTransporterLeftPlayer; //Close and open animations
[SerializeField] GameObject npcImpact;
[SerializeField] GameObject playerImpact;
[Header("Variables")]
public bool intervalStarted;
@ -58,14 +70,14 @@ namespace HeavenStudio.Games
ballTransporterRightNPC.GetComponent<Animator>().Play("BallTransporterRightOpen", 0, 0);
BeatAction.New(ballTransporterLeftNPC, new List<BeatAction.Action>()
{
//End interval
new BeatAction.Action(beat + interval, delegate { intervalStarted = false; }),
//Close npc transporters
new BeatAction.Action(beat + interval, delegate { ballTransporterLeftNPC.GetComponent<Animator>().Play("BallTransporterLeftClose", 0, 0); }),
new BeatAction.Action(beat + interval, delegate { ballTransporterRightNPC.GetComponent<Animator>().Play("BallTransporterRightClose", 0, 0); }),
//Open player transporters
new BeatAction.Action(beat + interval, delegate { ballTransporterLeftPlayer.GetComponent<Animator>().Play("BallTransporterLeftOpen", 0, 0); }),
new BeatAction.Action(beat + interval, delegate { ballTransporterRightPlayer.GetComponent<Animator>().Play("BallTransporterRightOpen", 0, 0); }),
//End interval
new BeatAction.Action(beat + interval, delegate { intervalStarted = false; }),
//Close player transporters
new BeatAction.Action(beat + interval * 2, delegate { ballTransporterLeftPlayer.GetComponent<Animator>().Play("BallTransporterLeftClose", 0, 0); }),
new BeatAction.Action(beat + interval * 2, delegate { ballTransporterRightPlayer.GetComponent<Animator>().Play("BallTransporterRightClose", 0, 0); }),
@ -76,9 +88,46 @@ namespace HeavenStudio.Games
beatInterval = interval;
}
public void SpawnBall(float beat, bool isBig)
{
if (isBig)
{
BeatAction.New(doughDudesNPC, new List<BeatAction.Action>()
{
//Jump and play sound
new BeatAction.Action(beat + 0.5f, delegate { doughDudesNPC.GetComponent<Animator>().Play("BigDoughJump", 0, 0); }),
new BeatAction.Action(beat + 0.5f, delegate { Jukebox.PlayOneShotGame("workingDough/NPCBigBall"); }),
new BeatAction.Action(beat + 0.5f, delegate { Jukebox.PlayOneShotGame("workingDough/SmallBall"); }),
new BeatAction.Action(beat + 0.5f, delegate { npcImpact.SetActive(true); }),
new BeatAction.Action(beat + 0.6f, delegate { npcImpact.SetActive(false); }),
});
}
else
{
BeatAction.New(doughDudesNPC, new List<BeatAction.Action>()
{
//Jump and play sound
new BeatAction.Action(beat + 0.5f, delegate { doughDudesNPC.GetComponent<Animator>().Play("SmallDoughJump", 0, 0); }),
new BeatAction.Action(beat + 0.5f, delegate { Jukebox.PlayOneShotGame("workingDough/NPCSmallBall"); }),
new BeatAction.Action(beat + 0.5f, delegate { Jukebox.PlayOneShotGame("workingDough/SmallBall"); }),
new BeatAction.Action(beat + 0.5f, delegate { npcImpact.SetActive(true); }),
new BeatAction.Action(beat + 0.6f, delegate { npcImpact.SetActive(false); }),
});
}
}
void Update()
{
if(PlayerInput.Pressed())
{
doughDudesPlayer.GetComponent<Animator>().Play("SmallDoughJump", 0, 0);
Jukebox.PlayOneShotGame("workingDough/PlayerSmallBall");
}
else if (PlayerInput.AltPressed())
{
doughDudesPlayer.GetComponent<Animator>().Play("BigDoughJump", 0, 0);
Jukebox.PlayOneShotGame("workingDough/PlayerBigBall");
}
}
}
}