baby done

This commit is contained in:
Rapandrasmus 2024-02-25 12:39:40 +01:00
parent 3958150666
commit f511269769
7 changed files with 253 additions and 14 deletions

View file

@ -74690,6 +74690,7 @@ Transform:
- {fileID: 6412579525062198344}
- {fileID: 6673106021490433943}
- {fileID: 5154023206690165501}
- {fileID: 1070424679674934030}
m_Father: {fileID: 0}
m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
@ -74708,6 +74709,7 @@ MonoBehaviour:
SoundSequences: []
scheduledInputs: []
_bear: {fileID: 7013601655191583099}
_baby: {fileID: 8900425566172759569}
_smallObjectPrefab: {fileID: -5173722026323445984, guid: 3d44370bfd973e34ea21a4b1cfff8ca6, type: 3}
_bigObjectPrefab: {fileID: 3578111811869010179, guid: b18b10a5fd5fd2c4ea91f7c44b775dfa, type: 3}
_hugeObjectPrefab: {fileID: -3577666667379746924, guid: d971a00c5581d884b9658910cac762ad, type: 3}
@ -84563,6 +84565,128 @@ ParticleSystemRenderer:
m_MeshWeighting2: 1
m_MeshWeighting3: 1
m_MaskInteraction: 0
--- !u!1 &3238063023437742363
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 1070424679674934030}
- component: {fileID: 8476038779484891818}
- component: {fileID: 8900425566172759569}
m_Layer: 0
m_Name: babyRef
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 0
--- !u!4 &1070424679674934030
Transform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 3238063023437742363}
m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
m_LocalPosition: {x: -1.93, y: -3.23, z: 0}
m_LocalScale: {x: 0.48952064, y: 0.48952064, z: 1}
m_ConstrainProportionsScale: 0
m_Children: []
m_Father: {fileID: 2298792418077467027}
m_RootOrder: 14
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!212 &8476038779484891818
SpriteRenderer:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 3238063023437742363}
m_Enabled: 1
m_CastShadows: 0
m_ReceiveShadows: 0
m_DynamicOccludee: 1
m_StaticShadowCaster: 0
m_MotionVectors: 1
m_LightProbeUsage: 1
m_ReflectionProbeUsage: 1
m_RayTracingMode: 0
m_RayTraceProcedural: 0
m_RenderingLayerMask: 1
m_RendererPriority: 0
m_Materials:
- {fileID: 10754, guid: 0000000000000000f000000000000000, type: 0}
m_StaticBatchInfo:
firstSubMesh: 0
subMeshCount: 0
m_StaticBatchRoot: {fileID: 0}
m_ProbeAnchor: {fileID: 0}
m_LightProbeVolumeOverride: {fileID: 0}
m_ScaleInLightmap: 1
m_ReceiveGI: 1
m_PreserveUVs: 0
m_IgnoreNormalsForChartDetection: 0
m_ImportantGI: 0
m_StitchLightmapSeams: 1
m_SelectedEditorRenderState: 0
m_MinimumChartSize: 4
m_AutoUVMaxDistance: 0.5
m_AutoUVMaxAngle: 89
m_LightmapParameters: {fileID: 0}
m_SortingLayerID: 0
m_SortingLayer: 0
m_SortingOrder: 100
m_Sprite: {fileID: -1264260882, guid: 8e17e4341f5f44e44b892a9c0cacc5ba, type: 3}
m_Color: {r: 1, g: 1, b: 1, a: 1}
m_FlipX: 0
m_FlipY: 0
m_DrawMode: 0
m_Size: {x: 4.77, y: 5.66}
m_AdaptiveModeThreshold: 0.5
m_SpriteTileMode: 0
m_WasSpriteAssigned: 1
m_MaskInteraction: 0
m_SpriteSortPoint: 0
--- !u!114 &8900425566172759569
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 3238063023437742363}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 174924f647af468498c31429703764fb, type: 3}
m_Name:
m_EditorClassIdentifier:
offset: {x: 0, y: 0, z: 0}
_flySprite: {fileID: 1271663758, guid: 8e17e4341f5f44e44b892a9c0cacc5ba, type: 3}
_standSprite: {fileID: -1264260882, guid: 8e17e4341f5f44e44b892a9c0cacc5ba, type: 3}
_rot: 360
_addedHeight: 2
_addedY: 2
_path:
name:
preview: 0
anchor: {fileID: 0}
positions:
- tag:
pos: {x: 0, y: 0, z: 0}
target: {fileID: 912007196473728721}
height: 7
duration: 2
useLastRealPos: 0
values: []
- tag:
pos: {x: -1.93, y: -3.23, z: 0}
target: {fileID: 0}
height: 0
duration: 0
useLastRealPos: 0
values: []
--- !u!1 &3344472212958924720
GameObject:
m_ObjectHideFlags: 0

View file

@ -903,7 +903,7 @@ TextureImporter:
edges: []
weights: []
- serializedVersion: 2
name: lumbearjackobjects_38
name: baby0
rect:
serializedVersion: 2
x: 2807
@ -924,7 +924,7 @@ TextureImporter:
edges: []
weights: []
- serializedVersion: 2
name: lumbearjackobjects_39
name: baby1
rect:
serializedVersion: 2
x: 3318
@ -1396,6 +1396,8 @@ TextureImporter:
weights: []
secondaryTextures: []
nameFileIdTable:
baby0: 1271663758
baby1: -1264260882
lumbearjackobjects_0: -1523423921
lumbearjackobjects_1: -900160324
lumbearjackobjects_10: -1036669530
@ -1428,8 +1430,6 @@ TextureImporter:
lumbearjackobjects_35: 103870720
lumbearjackobjects_36: 1908930708
lumbearjackobjects_37: -1489110472
lumbearjackobjects_38: 1271663758
lumbearjackobjects_39: -1264260882
lumbearjackobjects_4: -1870457107
lumbearjackobjects_40: 50591991
lumbearjackobjects_41: 1280516190

View file

@ -0,0 +1,62 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using HeavenStudio.Util;
using System;
namespace HeavenStudio.Games.Scripts_LumBEARjack
{
public class LBJBaby : SuperCurveObject
{
[Header("Sprites")]
[SerializeField] private Sprite _flySprite;
[SerializeField] private Sprite _standSprite;
[Header("Properties")]
[SerializeField] private float _rot;
[SerializeField] private float _addedHeight;
[SerializeField] private float _addedY;
[Header("Path")]
[SerializeField] private Path _path;
private SpriteRenderer _sr;
private void Awake()
{
_sr = GetComponent<SpriteRenderer>();
}
public void OnDrawGizmos()
{
DrawEditorGizmo(_path);
}
public void Activate(double beat, float durationMult, int babyIndex)
{
gameObject.SetActive(true);
_path.positions[0].duration *= durationMult;
_path.positions[1].pos.y += _addedY * babyIndex;
_path.positions[1].height += _addedHeight * babyIndex;
_sr.sprite = _flySprite;
_sr.sortingOrder += babyIndex;
StartCoroutine(FlyCo(beat));
}
private IEnumerator FlyCo(double beat)
{
float normalizedBeat = Conductor.instance.GetPositionFromBeat(beat, _path.positions[0].duration, false);
while (normalizedBeat <= 1)
{
normalizedBeat = Conductor.instance.GetPositionFromBeat(beat, _path.positions[0].duration, false);
transform.localPosition = GetPathPositionFromBeat(_path, Math.Clamp(Conductor.instance.songPositionInBeatsAsDouble, beat, beat + _path.positions[0].duration), beat);
transform.localEulerAngles = new Vector3(0, 0, Mathf.Lerp(0, _rot, normalizedBeat));
yield return null;
}
transform.localPosition = GetPathPositionFromBeat(_path, Math.Clamp(Conductor.instance.songPositionInBeatsAsDouble, beat, beat + _path.positions[0].duration), beat);
transform.localEulerAngles = Vector3.zero;
_sr.sprite = _standSprite;
}
}
}

View file

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

View file

@ -25,6 +25,7 @@ namespace HeavenStudio.Games.Scripts_LumBEARjack
private LumBEARjack.HugeType _type;
private bool _right = true;
private bool _zoom = true;
private bool _baby = true;
private PlayerActionEvent[] _soundsToDeleteIfMiss = new PlayerActionEvent[3];
@ -38,12 +39,13 @@ namespace HeavenStudio.Games.Scripts_LumBEARjack
_peachSR.gameObject.SetActive(false);
}
public void Init(LBJBear bear, double beat, double length, LumBEARjack.HugeType type, bool right, bool zoom, double startUpBeat = -1)
public void Init(LBJBear bear, double beat, double length, LumBEARjack.HugeType type, bool right, bool zoom, bool baby, double startUpBeat = -1)
{
_bear = bear;
_type = type;
_right = right;
_zoom = zoom;
_baby = baby;
switch (type)
{
@ -171,6 +173,7 @@ namespace HeavenStudio.Games.Scripts_LumBEARjack
SoundByte.PlayOneShotGame("lumbearjack/" + (_type == LumBEARjack.HugeType.peach ? "peachCutVoice" : "hugeLogCutVoice"));
LumBEARjack.instance.DoHugeObjectEffect(_type, false);
if (_type == LumBEARjack.HugeType.peach && _baby) LumBEARjack.instance.ActivateBaby(caller.startBeat + caller.timer, (float)_rotationLength);
string cutSound = _type switch
{

View file

@ -88,15 +88,20 @@ namespace HeavenStudio.Games.Loaders
function = delegate
{
var e = eventCaller.currentEntity;
LumBEARjack.instance.SpawnHugeObject(e.beat, e.length, (LumBEARjack.HugeType)e["type"], (LumBEARjack.CatPutChoice)e["cat"], e["zoom"]);
LumBEARjack.instance.SpawnHugeObject(e.beat, e.length, (LumBEARjack.HugeType)e["type"], (LumBEARjack.CatPutChoice)e["cat"], e["zoom"], e["baby"]);
},
defaultLength = 6,
parameters = new()
{
new("type", LumBEARjack.HugeType.log, "Type"),
new("type", LumBEARjack.HugeType.log, "Type", "", new()
{
new((x, _) => (LumBEARjack.HugeType)x == LumBEARjack.HugeType.peach, new string [] { "baby", "pBaby" })
}),
new("sound", true, "Cue Sound"),
new("cat", LumBEARjack.CatPutChoice.Alternate, "Side"),
new("zoom", true, "Zoom-In")
new("zoom", true, "Zoom-In"),
new("baby", true, "Baby"),
new("pBaby", true, "Persist Baby")
}
},
new("cats", "Cats Presence")
@ -199,15 +204,20 @@ namespace HeavenStudio.Games.Loaders
function = delegate
{
var e = eventCaller.currentEntity;
LumBEARjack.instance.SpawnHugeObject(e.beat, e.length, (LumBEARjack.HugeType)e["type"], (LumBEARjack.CatPutChoice)e["cat"], e["zoom"]);
LumBEARjack.instance.SpawnHugeObject(e.beat, e.length, (LumBEARjack.HugeType)e["type"], (LumBEARjack.CatPutChoice)e["cat"], e["zoom"], e["baby"]);
},
defaultLength = 6,
parameters = new()
{
new("type", LumBEARjack.HugeType.log, "Type"),
new("type", LumBEARjack.HugeType.log, "Type", "", new()
{
new((x, _) => (LumBEARjack.HugeType)x == LumBEARjack.HugeType.peach, new string [] { "baby", "pBaby" })
}),
new("sound", true, "Cue Sound"),
new("cat", LumBEARjack.CatPutChoice.Alternate, "Side"),
new("zoom", true, "Zoom-In")
new("zoom", true, "Zoom-In"),
new("baby", true, "Baby"),
new("pBaby", true, "Persist Baby")
},
resizable = true
},
@ -282,6 +292,7 @@ namespace HeavenStudio.Games
[Header("Components")]
[SerializeField] private LBJBear _bear;
[SerializeField] private LBJBaby _baby;
[SerializeField] private LBJSmallObject _smallObjectPrefab;
[SerializeField] private LBJBigObject _bigObjectPrefab;
[SerializeField] private LBJHugeObject _hugeObjectPrefab;
@ -326,6 +337,8 @@ namespace HeavenStudio.Games
[SerializeField] private double _catAnimationOffsetStart = -0.5;
[SerializeField] private double _catAnimationOffsetEnd = 0.5;
private int _babyIndex = 0;
private List<double> _bearNoBopBeats = new();
private Dictionary<double, CatPutChoice> _catPuts = new();
private Dictionary<double, MainCatChoice> _mainCatPresences = new();
@ -381,14 +394,14 @@ namespace HeavenStudio.Games
});
}
public void SpawnHugeObject(double beat, double length, HugeType type, CatPutChoice cat, bool zoom, double startUpBeat = -1)
public void SpawnHugeObject(double beat, double length, HugeType type, CatPutChoice cat, bool zoom, bool baby, double startUpBeat = -1)
{
BeatAction.New(this, new()
{
new(beat + (length / 6), delegate
{
LBJHugeObject spawnedObject = Instantiate(_hugeObjectPrefab, _cutObjectHolder);
spawnedObject.Init(_bear, beat, length, type, ShouldBeRight(beat, cat), zoom, startUpBeat);
spawnedObject.Init(_bear, beat, length, type, ShouldBeRight(beat, cat), zoom, baby, startUpBeat);
})
});
}
@ -438,6 +451,7 @@ namespace HeavenStudio.Games
HandleBops(beat);
HandleCatAnimation(beat);
HandleSnow(beat);
HandleBaby(beat, false);
}
public override void OnPlay(double beat)
@ -447,6 +461,23 @@ namespace HeavenStudio.Games
HandleBops(beat);
HandleCatAnimation(beat);
HandleSnow(beat);
HandleBaby(beat, true);
}
private void HandleBaby(double beat, bool onPlay)
{
var allBaby = EventCaller.GetAllInGameManagerList("lumbearjack", new string[] { "huge", "hugeS" }).FindAll(x => x["baby"] && (HugeType)x["type"] == HugeType.peach && x.beat + x.length - (x.length / 6) < beat);
var lastGameSwitch = EventCaller.GetAllInGameManagerList("gameManager", new string[] { "switchGame" }).Find(x => x.beat < beat && x.datamodel.Split(2) == "lumbearjack");
double lastGameSwitchBeat = onPlay ? 0 : beat;
if (lastGameSwitch != null) lastGameSwitchBeat = onPlay ? lastGameSwitch.beat : beat;
foreach (var e in allBaby)
{
if (e["pBaby"] || e.beat >= lastGameSwitchBeat)
{
ActivateBaby(e.beat + e.length - (e.length / 6), e.length / 6);
}
}
}
private void HandleSnow(double beat)
@ -577,7 +608,7 @@ namespace HeavenStudio.Games
case "huge":
case "hugeS":
HugeObjectSound(e.beat, e.length, (HugeType)e["type"], beat);
SpawnHugeObject(e.beat, e.length, (HugeType)e["type"], (CatPutChoice)e["cat"], e["zoom"], beat);
SpawnHugeObject(e.beat, e.length, (HugeType)e["type"], (CatPutChoice)e["cat"], e["zoom"], e["baby"], beat);
break;
}
}
@ -1016,6 +1047,13 @@ namespace HeavenStudio.Games
#region Particles and Effects
public void ActivateBaby(double beat, float durationMult)
{
LBJBaby newBaby = Instantiate(_baby, transform);
newBaby.Activate(beat, durationMult, _babyIndex);
_babyIndex++;
}
public void SetSnow(bool isOn, bool instant, float windStrength, float particleStrength)
{
_snowParticle.gameObject.SetActive(isOn);

View file

@ -295,5 +295,6 @@ MonoBehaviour:
- Assets/Scripts/Games/LumBEARjack/LBJCatMove.cs
- Assets/Scripts/Util/ParticleSystemHelpers.cs
- Assets/Scripts/Games/LumBEARjack/LBJBGCat.cs
- Assets/Scripts/Games/LumBEARjack/LBJBaby.cs
PathsToSkipImportEvent: []
PathsToIgnoreOverwriteSettingOnAttribute: []