Merge branch 'LumberPerson' of https://github.com/iloveoatmeal2022/HeavenStudio into LumberPerson

This commit is contained in:
ev 2024-02-03 16:46:23 -05:00
commit 4d90d8872d
18 changed files with 698 additions and 2 deletions

View file

@ -875,6 +875,10 @@ MonoBehaviour:
m_EditorClassIdentifier:
SoundSequences: []
scheduledInputs: []
_bear: {fileID: 7013601655191583099}
_smallObjectPrefab: {fileID: -5173722026323445984, guid: 3d44370bfd973e34ea21a4b1cfff8ca6, type: 3}
_bigObjectPrefab: {fileID: 3578111811869010179, guid: b18b10a5fd5fd2c4ea91f7c44b775dfa, type: 3}
_hugeObjectPrefab: {fileID: -3577666667379746924, guid: d971a00c5581d884b9658910cac762ad, type: 3}
--- !u!1 &3527631078867808426
GameObject:
m_ObjectHideFlags: 0
@ -1641,6 +1645,7 @@ GameObject:
serializedVersion: 6
m_Component:
- component: {fileID: 5426823713711891276}
- component: {fileID: 7013601655191583099}
m_Layer: 0
m_Name: Beast
m_TagString: Untagged
@ -1669,6 +1674,19 @@ Transform:
m_Father: {fileID: 2298792418077467027}
m_RootOrder: 2
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!114 &7013601655191583099
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 5655511689993903157}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 32640a26a175a5d4baa5ba61b5446e33, type: 3}
m_Name:
m_EditorClassIdentifier:
_anim: {fileID: 0}
--- !u!1 &7392174160003629766
GameObject:
m_ObjectHideFlags: 0

View file

@ -0,0 +1,46 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!1 &2626744427758038457
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 6707971432346881136}
- component: {fileID: 3578111811869010179}
m_Layer: 0
m_Name: BigObject
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!4 &6707971432346881136
Transform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 2626744427758038457}
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_ConstrainProportionsScale: 0
m_Children: []
m_Father: {fileID: 0}
m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!114 &3578111811869010179
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 2626744427758038457}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 2402aaa1d4e67df479cc626100110795, type: 3}
m_Name:
m_EditorClassIdentifier:

View file

@ -0,0 +1,7 @@
fileFormatVersion: 2
guid: b18b10a5fd5fd2c4ea91f7c44b775dfa
PrefabImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View file

@ -0,0 +1,46 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!1 &7090769993121559202
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 1592825473973314041}
- component: {fileID: -3577666667379746924}
m_Layer: 0
m_Name: HugeObject
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!4 &1592825473973314041
Transform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 7090769993121559202}
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_ConstrainProportionsScale: 0
m_Children: []
m_Father: {fileID: 0}
m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!114 &-3577666667379746924
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 7090769993121559202}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: c24e5872094ce204ababcbfdc6db7b9d, type: 3}
m_Name:
m_EditorClassIdentifier:

View file

@ -0,0 +1,7 @@
fileFormatVersion: 2
guid: d971a00c5581d884b9658910cac762ad
PrefabImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View file

@ -0,0 +1,46 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!1 &6310831636379568479
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 7609283403775189878}
- component: {fileID: -5173722026323445984}
m_Layer: 0
m_Name: SmallObject
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!4 &7609283403775189878
Transform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 6310831636379568479}
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_ConstrainProportionsScale: 0
m_Children: []
m_Father: {fileID: 0}
m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!114 &-5173722026323445984
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 6310831636379568479}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: a375355ce9643dd40a371b496e3fc9ee, type: 3}
m_Name:
m_EditorClassIdentifier:

View file

@ -0,0 +1,7 @@
fileFormatVersion: 2
guid: 3d44370bfd973e34ea21a4b1cfff8ca6
PrefabImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View file

@ -0,0 +1,19 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using HeavenStudio.Util;
namespace HeavenStudio.Games.Scripts_LumBEARjack
{
public class LBJBear : MonoBehaviour
{
[Header("Components")]
[SerializeField] private Animator _anim;
public void SwingWhiff()
{
SoundByte.PlayOneShotGame("lumbearjack/swing", -1, SoundByte.GetPitchFromCents(Random.Range(-200, 201), false));
}
}
}

View file

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

View file

@ -0,0 +1,75 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using HeavenStudio.Util;
namespace HeavenStudio.Games.Scripts_LumBEARjack
{
public class LBJBigObject : MonoBehaviour
{
private LBJBear _bear;
private LumBEARjack.BigType _type;
private PlayerActionEvent _cutActionEvent;
public void Init(LBJBear bear, double beat, double length, LumBEARjack.BigType type)
{
_bear = bear;
_type = type;
LumBEARjack.instance.ScheduleInput(beat, length / 4 * 2, Minigame.InputAction_BasicPress, JustHit, Miss, Blank);
_cutActionEvent = LumBEARjack.instance.ScheduleInput(beat, length / 4 * 3, Minigame.InputAction_BasicPress, JustCut, Miss, Blank);
}
private void JustHit(PlayerActionEvent caller, float state)
{
if (state >= 1f || state <= -1f)
{
// Barely
return;
}
SoundByte.PlayOneShotGame("lumbearjack/hitVoice" + (Random.Range(1, 3) == 1 ? "A" : "B"));
SoundByte.PlayOneShotGame("lumbearjack/baseHit");
string hitSound = _type switch
{
LumBEARjack.BigType.log => "bigLogHit",
_ => throw new System.NotImplementedException(),
};
SoundByte.PlayOneShotGame("lumbearjack/" + hitSound);
}
private void JustCut(PlayerActionEvent caller, float state)
{
if (state >= 1f || state <= -1f)
{
// Barely
return;
}
SoundByte.PlayOneShotGame("lumbearjack/bigLogCutVoice");
string cutSound = _type switch
{
LumBEARjack.BigType.log => "bigLogCut",
_ => throw new System.NotImplementedException(),
};
SoundByte.PlayOneShotGame("lumbearjack/" + cutSound);
Destroy(gameObject);
}
private void Miss(PlayerActionEvent caller)
{
SoundByte.PlayOneShot("miss");
if (_cutActionEvent != null)
{
_cutActionEvent.Disable();
_cutActionEvent.QueueDeletion();
}
Destroy(gameObject);
}
private void Blank(PlayerActionEvent caller) { }
}
}

View file

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

View file

@ -0,0 +1,97 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using HeavenStudio.Util;
namespace HeavenStudio.Games.Scripts_LumBEARjack
{
public class LBJHugeObject : MonoBehaviour
{
private LBJBear _bear;
private LumBEARjack.HugeType _type;
private PlayerActionEvent[] _soundsToDeleteIfMiss = new PlayerActionEvent[3];
public void Init(LBJBear bear, double beat, double length, LumBEARjack.HugeType type)
{
_bear = bear;
_type = type;
LumBEARjack.instance.ScheduleInput(beat, length / 6 * 2, Minigame.InputAction_BasicPress, JustHit1, Miss, Blank);
_soundsToDeleteIfMiss[0] = LumBEARjack.instance.ScheduleInput(beat, length / 6 * 3, Minigame.InputAction_BasicPress, JustHit2, Miss, Blank);
_soundsToDeleteIfMiss[1] = LumBEARjack.instance.ScheduleInput(beat, length / 6 * 4, Minigame.InputAction_BasicPress, JustHit3, Miss, Blank);
_soundsToDeleteIfMiss[2] = LumBEARjack.instance.ScheduleInput(beat, length / 6 * 5, Minigame.InputAction_BasicPress, JustCut, Miss, Blank);
}
private void JustHit1(PlayerActionEvent caller, float state)
{
JustHit(caller, state, 1);
}
private void JustHit2(PlayerActionEvent caller, float state)
{
JustHit(caller, state, 2);
}
private void JustHit3(PlayerActionEvent caller, float state)
{
JustHit(caller, state, 3);
}
private void JustHit(PlayerActionEvent caller, float state, int step)
{
if (state >= 1f || state <= -1f)
{
// Barely
return;
}
SoundByte.PlayOneShotGame("lumbearjack/" + (_type == LumBEARjack.HugeType.peach ? "peach" : "hit") + "Voice" + (Random.Range(1, 3) == 1 ? "A" : "B"));
SoundByte.PlayOneShotGame("lumbearjack/baseHit");
string hitSound = _type switch
{
LumBEARjack.HugeType.log => $"hugeLogHit{step}",
LumBEARjack.HugeType.freezer => $"freezerHit{step}",
LumBEARjack.HugeType.peach => $"peachHit{step}",
_ => throw new System.NotImplementedException(),
};
SoundByte.PlayOneShotGame("lumbearjack/" + hitSound);
}
private void JustCut(PlayerActionEvent caller, float state)
{
if (state >= 1f || state <= -1f)
{
// Barely
return;
}
SoundByte.PlayOneShotGame("lumbearjack/" + (_type == LumBEARjack.HugeType.peach ? "peachCutVoice" : "hugeLogCutVoice"));
string cutSound = _type switch
{
LumBEARjack.HugeType.log => "hugeLogCut",
LumBEARjack.HugeType.freezer => "freezerCut",
LumBEARjack.HugeType.peach => "peachCut",
_ => throw new System.NotImplementedException(),
};
SoundByte.PlayOneShotGame("lumbearjack/" + cutSound);
Destroy(gameObject);
}
private void Miss(PlayerActionEvent caller)
{
SoundByte.PlayOneShot("miss");
foreach (var s in _soundsToDeleteIfMiss)
{
if (s == null) continue;
s.Disable();
s.QueueDeletion();
}
Destroy(gameObject);
}
private void Blank(PlayerActionEvent caller) { }
}
}

View file

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

View file

@ -0,0 +1,54 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using HeavenStudio.Util;
namespace HeavenStudio.Games.Scripts_LumBEARjack
{
public class LBJSmallObject : MonoBehaviour
{
private LBJBear _bear;
private LumBEARjack.SmallType _type;
public void Init(LBJBear bear, double beat, double length, LumBEARjack.SmallType type)
{
_bear = bear;
_type = type;
LumBEARjack.instance.ScheduleInput(beat, length / 3 * 2, Minigame.InputAction_BasicPress, Just, Miss, Blank);
}
private void Just(PlayerActionEvent caller, float state)
{
if (state >= 1f || state <= -1f)
{
// Barely
return;
}
SoundByte.PlayOneShotGame("lumbearjack/cutVoice" + (Random.Range(1, 3) == 1 ? "A" : "B"));
string cutSound = _type switch
{
LumBEARjack.SmallType.log => "smallLogCut",
LumBEARjack.SmallType.can => "canCut",
LumBEARjack.SmallType.bat => "batCut",
LumBEARjack.SmallType.broom => "broomCut",
_ => throw new System.NotImplementedException()
};
SoundByte.PlayOneShotGame("lumbearjack/" + cutSound);
if (_type != LumBEARjack.SmallType.log) SoundByte.PlayOneShotGame("lumbearjack/huh", caller.startBeat + caller.timer + 1);
Destroy(gameObject);
}
private void Miss(PlayerActionEvent caller)
{
SoundByte.PlayOneShot("miss");
Destroy(gameObject);
}
private void Blank(PlayerActionEvent caller) { }
}
}

View file

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

View file

@ -9,6 +9,7 @@ using HeavenStudio.InputSystem;
using Jukebox;
namespace HeavenStudio.Games.Loaders
{
using static Minigames;
@ -19,7 +20,60 @@ namespace HeavenStudio.Games.Loaders
{
return new Minigame("lumbearjack", "LumBEARjack", "ffffff", false, false, new List<GameAction>()
{
new("small", "Small Object")
{
preFunction = delegate
{
var e = eventCaller.currentEntity;
LumBEARjack.SmallObjectSound(e.beat, e.length, (LumBEARjack.SmallType)e["type"]);
},
function = delegate
{
var e = eventCaller.currentEntity;
LumBEARjack.instance.SpawnSmallObject(e.beat, e.length, (LumBEARjack.SmallType)e["type"]);
},
defaultLength = 3,
parameters = new()
{
new("type", LumBEARjack.SmallType.log, "Type")
}
},
new("big", "Big Object")
{
preFunction = delegate
{
var e = eventCaller.currentEntity;
LumBEARjack.BigObjectSound(e.beat, e.length, (LumBEARjack.BigType)e["type"]);
},
function = delegate
{
var e = eventCaller.currentEntity;
LumBEARjack.instance.SpawnBigObject(e.beat, e.length, (LumBEARjack.BigType)e["type"]);
},
defaultLength = 4,
parameters = new()
{
new("type", LumBEARjack.BigType.log, "Type")
}
},
new("huge", "Huge Object")
{
preFunction = delegate
{
var e = eventCaller.currentEntity;
LumBEARjack.HugeObjectSound(e.beat, e.length, (LumBEARjack.HugeType)e["type"]);
},
function = delegate
{
var e = eventCaller.currentEntity;
LumBEARjack.instance.SpawnHugeObject(e.beat, e.length, (LumBEARjack.HugeType)e["type"]);
},
defaultLength = 6,
parameters = new()
{
new("type", LumBEARjack.HugeType.log, "Type")
}
}
}
);
}
@ -28,8 +82,174 @@ namespace HeavenStudio.Games.Loaders
namespace HeavenStudio.Games
{
using HeavenStudio.Games.Scripts_LumBEARjack;
public class LumBEARjack : Minigame
{
public enum SmallType
{
log,
can,
bat,
broom
}
public enum BigType
{
log
}
public enum HugeType
{
log,
freezer,
peach
}
[Header("Components")]
[SerializeField] private LBJBear _bear;
[SerializeField] private LBJSmallObject _smallObjectPrefab;
[SerializeField] private LBJBigObject _bigObjectPrefab;
[SerializeField] private LBJHugeObject _hugeObjectPrefab;
public static LumBEARjack instance;
private void Awake()
{
instance = this;
}
#region Update
private void Update()
{
if (PlayerInput.GetIsAction(InputAction_BasicPress) && !IsExpectingInputNow(InputAction_BasicPress))
{
_bear.SwingWhiff();
}
}
#endregion
#region Spawn Objects
public void SpawnSmallObject(double beat, double length, SmallType type)
{
BeatAction.New(this, new()
{
new(beat + (length / 3), delegate
{
LBJSmallObject spawnedObject = Instantiate(_smallObjectPrefab, transform);
spawnedObject.Init(_bear, beat, length, type);
})
});
}
public void SpawnBigObject(double beat, double length, BigType type)
{
BeatAction.New(this, new()
{
new(beat + (length / 4), delegate
{
LBJBigObject spawnedObject = Instantiate(_bigObjectPrefab, transform);
spawnedObject.Init(_bear, beat, length, type);
})
});
}
public void SpawnHugeObject(double beat, double length, HugeType type)
{
BeatAction.New(this, new()
{
new(beat + (length / 6), delegate
{
LBJHugeObject spawnedObject = Instantiate(_hugeObjectPrefab, transform);
spawnedObject.Init(_bear, beat, length, type);
})
});
}
#endregion
#region PreSounds
public static void SmallObjectSound(double beat, float length, SmallType type)
{
switch (type)
{
case SmallType.bat:
case SmallType.log:
MultiSound.Play(new MultiSound.Sound[]
{
new("lumbearjack/readyVoice", beat),
new("lumbearjack/smallLogPut", beat + (length / 3))
}, true, true);
break;
case SmallType.can:
MultiSound.Play(new MultiSound.Sound[]
{
new("lumbearjack/readyVoice", beat),
new("lumbearjack/canPut", beat + (length / 3))
}, true, true);
break;
case SmallType.broom:
MultiSound.Play(new MultiSound.Sound[]
{
new("lumbearjack/readyVoice", beat),
new("lumbearjack/broomPut", beat + (length / 3))
}, true, true);
break;
default:
break;
}
}
public static void BigObjectSound(double beat, float length, BigType type)
{
switch (type)
{
case BigType.log:
MultiSound.Play(new MultiSound.Sound[]
{
new("lumbearjack/readyVoice", beat),
new("lumbearjack/bigLogPut", beat + (length / 4))
}, true, true);
break;
default:
break;
}
}
public static void HugeObjectSound(double beat, float length, HugeType type)
{
switch (type)
{
case HugeType.log:
MultiSound.Play(new MultiSound.Sound[]
{
new("lumbearjack/readyVoice", beat),
new("lumbearjack/hugeLogPut", beat + (length / 6))
}, true, true);
break;
case HugeType.freezer:
MultiSound.Play(new MultiSound.Sound[]
{
new("lumbearjack/readyVoice", beat),
new("lumbearjack/freezerPut", beat + (length / 6))
}, true, true);
break;
case HugeType.peach:
MultiSound.Play(new MultiSound.Sound[]
{
new("lumbearjack/readyVoice", beat),
new("lumbearjack/peachPut", beat + (length / 6))
}, true, true);
break;
default:
break;
}
}
#endregion
}
}

View file

@ -640,6 +640,16 @@ namespace HeavenStudio
Debug.LogWarning("Game loader RvlWorkingDoughLoader failed!");
}
Debug.Log("Running game loader CtrLumBEARjackLoader");
game = CtrLumBEARjackLoader.AddGame(eventCaller);
if (game != null)
{
eventCaller.minigames.Add(game.name, game);
}
else
{
Debug.LogWarning("Game loader CtrLumBEARjackLoader failed!");
}
}
}

View file

@ -17,6 +17,6 @@ MonoBehaviour:
DenseViewWidthThreshold: 512
_disableAutoReloadInBackground: 0
ImportedScriptPaths:
- Assets/Scripts/Games/LumBEARjack/LumBEARjack.cs
- Assets/Scripts/Games/LumBEARjack/LBJHugeObject.cs
PathsToSkipImportEvent: []
PathsToIgnoreOverwriteSettingOnAttribute: []