Code Improvement + starting making the balls

This commit is contained in:
Rapandrasmus 2023-01-14 17:07:22 +01:00
parent b972c21928
commit 55335aa799
4 changed files with 75 additions and 29 deletions

View file

@ -1148,6 +1148,36 @@ SpriteRenderer:
m_WasSpriteAssigned: 1
m_MaskInteraction: 0
m_SpriteSortPoint: 0
--- !u!1 &3885336978366137036
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 6649979826100345915}
m_Layer: 0
m_Name: Curves
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!4 &6649979826100345915
Transform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 3885336978366137036}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children: []
m_Father: {fileID: 8664857966238409550}
m_RootOrder: 8
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!1 &4178277750703538361
GameObject:
m_ObjectHideFlags: 0
@ -2168,6 +2198,7 @@ Transform:
- {fileID: 3144963930116768411}
- {fileID: 4612207789681334008}
- {fileID: 2428094795195615793}
- {fileID: 6649979826100345915}
m_Father: {fileID: 0}
m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
@ -2754,16 +2785,16 @@ GameObject:
m_CorrespondingSourceObject: {fileID: 1571991866295846512, guid: 081ed264ff8a94f4081ee6b1dbb4b144, type: 3}
m_PrefabInstance: {fileID: 7873819805929247186}
m_PrefabAsset: {fileID: 0}
--- !u!4 &4612207789681334008 stripped
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!4 &4612207789681334008 stripped
Transform:
m_CorrespondingSourceObject: {fileID: 3261934242483390250, guid: 081ed264ff8a94f4081ee6b1dbb4b144, type: 3}
m_PrefabInstance: {fileID: 7873819805929247186}
m_PrefabAsset: {fileID: 0}
--- !u!1001 &7887385672556259939
PrefabInstance:
m_ObjectHideFlags: 0

View file

@ -0,0 +1,18 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using NaughtyBezierCurves;
using HeavenStudio.Util;
namespace HeavenStudio.Games.Scripts_WorkingDough
{
public class NPCDoughBall : PlayerActionObject
{
private WorkingDough game;
private void Awake()
{
game = WorkingDough.instance;
}
}
}

View file

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: f589a35cd43c5a146b78729182754157
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View file

@ -35,7 +35,7 @@ namespace HeavenStudio.Games.Loaders
namespace HeavenStudio.Games
{
//using Scripts_WorkingDough;
using Scripts_WorkingDough;
public class WorkingDough : Minigame
{
[Header("Components")]
@ -90,30 +90,16 @@ namespace HeavenStudio.Games
public void SpawnBall(float beat, bool isBig)
{
if (isBig)
BeatAction.New(doughDudesNPC, new List<BeatAction.Action>()
{
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); }),
});
}
//Jump and play sound
new BeatAction.Action(beat + 0.5f, delegate { doughDudesNPC.GetComponent<Animator>().Play(isBig ? "BigDoughJump" :"SmallDoughJump", 0, 0); }),
new BeatAction.Action(beat + 0.5f, delegate { Jukebox.PlayOneShotGame(isBig ? "workingDough/NPCBigBall" : "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()