bg open / close

This commit is contained in:
minenice55 2023-12-26 21:37:45 -05:00
parent 6de6462c17
commit 39106906db
5 changed files with 5475 additions and 144 deletions

File diff suppressed because it is too large Load diff

View file

@ -26,6 +26,32 @@ AnimatorState:
m_MirrorParameter:
m_CycleOffsetParameter:
m_TimeParameter:
--- !u!1102 &-6994252768423587492
AnimatorState:
serializedVersion: 6
m_ObjectHideFlags: 1
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_Name: SlideClose
m_Speed: -1
m_CycleOffset: 1
m_Transitions: []
m_StateMachineBehaviours: []
m_Position: {x: 50, y: 50, z: 0}
m_IKOnFeet: 0
m_WriteDefaultValues: 1
m_Mirror: 0
m_SpeedParameterActive: 0
m_MirrorParameterActive: 0
m_CycleOffsetParameterActive: 0
m_TimeParameterActive: 0
m_Motion: {fileID: 7400000, guid: ae6ea55007552ff4fb8f9e46a07a0b28, type: 2}
m_Tag:
m_SpeedParameter:
m_MirrorParameter:
m_CycleOffsetParameter:
m_TimeParameter:
--- !u!1102 &-2889309577850128088
AnimatorState:
serializedVersion: 6
@ -88,7 +114,10 @@ AnimatorStateMachine:
m_Position: {x: 200, y: 0, z: 0}
- serializedVersion: 1
m_State: {fileID: -7351194649355570482}
m_Position: {x: 235, y: 65, z: 0}
m_Position: {x: 290, y: 70, z: 0}
- serializedVersion: 1
m_State: {fileID: -6994252768423587492}
m_Position: {x: 340, y: 130, z: 0}
m_ChildStateMachines: []
m_AnyStateTransitions: []
m_EntryTransitions: []

View file

@ -120,7 +120,7 @@ AnimationClip:
m_Curve:
- serializedVersion: 3
time: 0
value: {x: -18, y: 5.5, z: 0}
value: {x: -26.6, y: 5.5, z: 0}
inSlope: {x: 0, y: 0, z: 0}
outSlope: {x: 0, y: 0, z: 0}
tangentMode: 0
@ -129,7 +129,7 @@ AnimationClip:
outWeight: {x: 0.33333334, y: 0.33333334, z: 0.33333334}
- serializedVersion: 3
time: 1
value: {x: -36.5, y: 5.5, z: 0}
value: {x: -45, y: 5.5, z: 0}
inSlope: {x: 0, y: 0, z: 0}
outSlope: {x: 0, y: 0, z: 0}
tangentMode: 0
@ -145,7 +145,7 @@ AnimationClip:
m_Curve:
- serializedVersion: 3
time: 0
value: {x: 18.6, y: 5.5, z: 0}
value: {x: 26.6, y: 5.5, z: 0}
inSlope: {x: 0, y: 0, z: 0}
outSlope: {x: 0, y: 0, z: 0}
tangentMode: 0
@ -154,7 +154,7 @@ AnimationClip:
outWeight: {x: 0.33333334, y: 0.33333334, z: 0.33333334}
- serializedVersion: 3
time: 1
value: {x: 36.5, y: 5.5, z: 0}
value: {x: 45, y: 5.5, z: 0}
inSlope: {x: 0, y: 0, z: 0}
outSlope: {x: 0, y: 0, z: 0}
tangentMode: 0
@ -404,7 +404,7 @@ AnimationClip:
m_Curve:
- serializedVersion: 3
time: 0
value: -18
value: -26.6
inSlope: 0
outSlope: 0
tangentMode: 136
@ -413,7 +413,7 @@ AnimationClip:
outWeight: 0.33333334
- serializedVersion: 3
time: 1
value: -36.5
value: -45
inSlope: 0
outSlope: 0
tangentMode: 136
@ -488,7 +488,7 @@ AnimationClip:
m_Curve:
- serializedVersion: 3
time: 0
value: 18.6
value: 26.6
inSlope: 0
outSlope: 0
tangentMode: 136
@ -497,7 +497,7 @@ AnimationClip:
outWeight: 0.33333334
- serializedVersion: 3
time: 1
value: 36.5
value: 45
inSlope: 0
outSlope: 0
tangentMode: 136

View file

@ -288,10 +288,10 @@ TextureImporter:
name: pillow_half_half_4
rect:
serializedVersion: 2
x: 78
y: 3891
width: 1982
height: 252
x: 111
y: 3885
width: 1979
height: 253
alignment: 0
pivot: {x: 0.5, y: 0.5}
border: {x: 0, y: 0, z: 0, w: 0}
@ -603,10 +603,10 @@ TextureImporter:
name: pillow_half_half_22
rect:
serializedVersion: 2
x: 26.855469
y: 639.64844
width: 1645.5078
height: 1862.793
x: 54
y: 657
width: 1591
height: 1833
alignment: 0
pivot: {x: 0.5, y: 0.5}
border: {x: 0, y: 0, z: 0, w: 0}

View file

@ -12,7 +12,8 @@ namespace HeavenStudio.Games.Loaders
using static Minigames;
public static class CtrPillowLoader
{
public static Minigame AddGame(EventCaller eventCaller) {
public static Minigame AddGame(EventCaller eventCaller)
{
return new Minigame("pajamaParty", "Pajama Party", "fc9ac3", false, false, new List<GameAction>()
{
new GameAction("bop", "Bop")
@ -52,9 +53,22 @@ namespace HeavenStudio.Games.Loaders
},
new GameAction("throw", "Throw Pillows")
{
function = delegate { PajamaParty.instance.DoThrowSequence(eventCaller.currentEntity.beat); },
function = delegate { var e = eventCaller.currentEntity; PajamaParty.instance.DoThrowSequence(e.beat, high: e["high"]); },
defaultLength = 8f,
inactiveFunction = delegate { PajamaParty.WarnThrowSequence(eventCaller.currentEntity.beat); }
inactiveFunction = delegate { var e = eventCaller.currentEntity; PajamaParty.WarnThrowSequence(e.beat, e["high"]); },
parameters = new List<Param>()
{
new Param("high", false, "Change Costumes", "Change character costumes"),
},
},
new GameAction("open background", "Open / Close Background")
{
function = delegate { var e = eventCaller.currentEntity; PajamaParty.instance.OpenBackground(e.beat, e.length, e["instant"]); },
defaultLength = 4f,
parameters = new List<Param>()
{
new Param("instant", false, "Instant", "Instantly open / close the background"),
},
},
new GameAction("instant slumber", "Instant Slumber")
{
@ -72,9 +86,9 @@ namespace HeavenStudio.Games.Loaders
// background stuff
// do shit with mako's face? (talking?)
},
new List<string>() {"ctr", "normal"},
"ctrpillow", "jp",
new List<string>() {"en", "jp", "ko"}
new List<string>() { "ctr", "normal" }
// "ctrpillow", "jp",
// new List<string>() {"en", "jp", "ko"}
);
}
}
@ -86,28 +100,35 @@ namespace HeavenStudio.Games
public class PajamaParty : Minigame
{
[Header("Objects")]
public CtrPillowPlayer Mako;
public GameObject Bed;
public GameObject MonkeyPrefab;
[SerializeField] CtrPillowPlayer Mako;
[SerializeField] GameObject Bed;
[SerializeField] GameObject MonkeyPrefab;
[SerializeField] GameObject Castle;
[SerializeField] Animator BgAnimator;
[Header("Positions")]
public Transform SpawnRoot;
[SerializeField] Transform SpawnRoot;
[SerializeField] float HighCameraHeight;
//game scene
public static PajamaParty instance;
CtrPillowMonkey[,] monkeys;
double cameraHighStart = double.MaxValue;
bool bgState, highState;
//cues while unoaded
static double WantThreeJump = double.MinValue;
static double WantFiveJump = double.MinValue;
static double WantThrowSequence = double.MinValue;
static bool WantThrowHigh = false;
static double WantSleepSequence = double.MinValue;
static double WantInstantSleep = double.MinValue;
static bool WantSleepType = false;
static int WantSleepAction = (int) PajamaParty.SleepType.Normal;
static int WantInstantSleepAction = (int) PajamaParty.SleepType.Normal;
static int WantSleepAction = (int)PajamaParty.SleepType.Normal;
static int WantInstantSleepAction = (int)PajamaParty.SleepType.Normal;
public enum SleepType {
public enum SleepType
{
Normal,
NoAwake,
}
@ -159,18 +180,18 @@ namespace HeavenStudio.Games
// m m m m m
// m m m m m
// m m P m m
monkeys = new CtrPillowMonkey[5,5];
monkeys = new CtrPillowMonkey[5, 5];
float RADIUS = 2.75f;
float scale = 1.0f;
int sorting = 10;
//set our start position (at Mako + 2*radius to the right)
Vector3 spawnPos = SpawnRoot.position + new Vector3(-RADIUS*3, 0);
Vector3 spawnPos = SpawnRoot.position + new Vector3(-RADIUS * 3, 0);
for (int y = 0; y < 5; y++)
{
for (int x = 0; x < 5; x++)
{
//on x-axis we go left to right
spawnPos += new Vector3(RADIUS*scale, 0);
spawnPos += new Vector3(RADIUS * scale, 0);
if (!(y == 0 && x == 2)) //don't spawn at the player's position
{
GameObject mobj = Instantiate(MonkeyPrefab, SpawnRoot.parent);
@ -185,11 +206,30 @@ namespace HeavenStudio.Games
}
// on the y-axis we go front to back (player to the rear)
scale -= 0.1f;
spawnPos = SpawnRoot.position - new Vector3(RADIUS*3*scale, -RADIUS/3.75f*(y+1), -RADIUS/5f*(y+1));
spawnPos = SpawnRoot.position - new Vector3(RADIUS * 3 * scale, -RADIUS / 3.75f * (y + 1), -RADIUS / 5f * (y + 1));
sorting--;
}
}
void Start()
{
Castle.SetActive(false);
}
void Update()
{
var cond = Conductor.instance;
Vector3 additional = Vector3.zero;
if (cond.songPositionInBeatsAsDouble >= cameraHighStart && cond.songPositionInBeatsAsDouble < cameraHighStart + 4)
{
float prog = cond.GetPositionFromBeat(cameraHighStart, 4, true);
float yMul = prog * 2f - 1f;
float yWeight = -(yMul * yMul) + 1f;
additional.y = yWeight * HighCameraHeight;
}
GameCamera.AdditionalPosition = additional;
}
public override void OnGameSwitch(double beat)
{
if (WantThreeJump != double.MinValue)
@ -222,20 +262,26 @@ namespace HeavenStudio.Games
public void Bop(double beat, double length, bool doesBop, bool autoBop)
{
Mako.shouldBop = autoBop;
for (int y = 0; y < 5; y++) {
for (int x = 0; x < 5; x++) {
for (int y = 0; y < 5; y++)
{
for (int x = 0; x < 5; x++)
{
if (!(y == 0 && x == 2)) monkeys[x, y].shouldBop = autoBop;
}
}
if (doesBop) {
if (doesBop)
{
var actions = new List<BeatAction.Action>();
for (int i = 0; i < length; i++)
{
actions.Add(new BeatAction.Action(beat + i, delegate {
actions.Add(new BeatAction.Action(beat + i, delegate
{
Mako.anim.DoScaledAnimationAsync("MakoBeat", 0.5f);
for (int y = 0; y < 5; y++) {
for (int x = 0; x < 5; x++) {
for (int y = 0; y < 5; y++)
{
for (int x = 0; x < 5; x++)
{
if (!(y == 0 && x == 2)) monkeys[x, y].anim.DoScaledAnimationAsync("MonkeyBeat", 0.5f);
}
}
@ -251,8 +297,8 @@ namespace HeavenStudio.Games
if (doSound)
MultiSound.Play(new MultiSound.Sound[] {
new MultiSound.Sound("pajamaParty/three1", beat),
new MultiSound.Sound("pajamaParty/three2", beat + 1f),
new MultiSound.Sound("pajamaParty/three3", beat + 2f),
new MultiSound.Sound("pajamaParty/three2", beat + 1),
new MultiSound.Sound("pajamaParty/three3", beat + 2),
});
BeatAction.New(instance, new List<BeatAction.Action>()
@ -284,9 +330,9 @@ namespace HeavenStudio.Games
{
MultiSound.Play(new MultiSound.Sound[] {
new MultiSound.Sound("pajamaParty/three1", beat),
new MultiSound.Sound("pajamaParty/three2", beat + 1f),
new MultiSound.Sound("pajamaParty/three3", beat + 2f),
}, forcePlay:true);
new MultiSound.Sound("pajamaParty/three2", beat + 1),
new MultiSound.Sound("pajamaParty/three3", beat + 2),
}, forcePlay: true);
WantThreeJump = beat;
}
@ -296,19 +342,19 @@ namespace HeavenStudio.Games
if (doSound)
MultiSound.Play(new MultiSound.Sound[] {
new MultiSound.Sound("pajamaParty/five1", beat),
new MultiSound.Sound("pajamaParty/five2", beat + 0.5f),
new MultiSound.Sound("pajamaParty/five3", beat + 1f),
new MultiSound.Sound("pajamaParty/five4", beat + 1.5f),
new MultiSound.Sound("pajamaParty/five5", beat + 2f)
new MultiSound.Sound("pajamaParty/five2", beat + 0.5),
new MultiSound.Sound("pajamaParty/five3", beat + 1),
new MultiSound.Sound("pajamaParty/five4", beat + 1.5),
new MultiSound.Sound("pajamaParty/five5", beat + 2)
});
BeatAction.New(instance, new List<BeatAction.Action>()
{
new BeatAction.Action( beat, delegate { JumpRow(4, beat); }),
new BeatAction.Action( beat + 0.5f, delegate { JumpRow(3, beat + 0.5f, 2); }),
new BeatAction.Action( beat + 1f, delegate { JumpRow(2, beat + 1f); }),
new BeatAction.Action( beat + 1.5f, delegate { JumpRow(1, beat + 1.5f, 2); }),
new BeatAction.Action( beat + 2f, delegate { JumpRow(0, beat + 2f); }),
new BeatAction.Action( beat + 0.5, delegate { JumpRow(3, beat + 0.5, 2); }),
new BeatAction.Action( beat + 1, delegate { JumpRow(2, beat + 1); }),
new BeatAction.Action( beat + 1.5, delegate { JumpRow(1, beat + 1.5, 2); }),
new BeatAction.Action( beat + 2, delegate { JumpRow(0, beat + 2); }),
});
}
@ -316,69 +362,75 @@ namespace HeavenStudio.Games
{
MultiSound.Play(new MultiSound.Sound[] {
new MultiSound.Sound("pajamaParty/five1", beat),
new MultiSound.Sound("pajamaParty/five2", beat + 0.5f),
new MultiSound.Sound("pajamaParty/five3", beat + 1f),
new MultiSound.Sound("pajamaParty/five4", beat + 1.5f),
new MultiSound.Sound("pajamaParty/five5", beat + 2f)
}, forcePlay:true);
new MultiSound.Sound("pajamaParty/five2", beat + 0.5),
new MultiSound.Sound("pajamaParty/five3", beat + 1),
new MultiSound.Sound("pajamaParty/five4", beat + 1.5),
new MultiSound.Sound("pajamaParty/five5", beat + 2)
}, forcePlay: true);
WantFiveJump = beat;
}
public void DoThrowSequence(double beat, bool doSound = true)
public void DoThrowSequence(double beat, bool doSound = true, bool high = false)
{
Mako.ScheduleThrow(beat);
if (doSound)
PlayThrowSequenceSound(beat);
if (high)
{
cameraHighStart = beat + 3;
}
BeatAction.New(Mako, new List<BeatAction.Action>()
{
new BeatAction.Action(beat + 2f, delegate { MonkeyCharge(beat + 2f); } ),
new BeatAction.Action(beat + 3f, delegate { MonkeyThrow(beat + 3f); } ),
new BeatAction.Action(beat + 2, delegate { MonkeyCharge(beat + 2); } ),
new BeatAction.Action(beat + 3, delegate { MonkeyThrow(beat + 3); } ),
});
}
public static void WarnThrowSequence(double beat)
public static void WarnThrowSequence(double beat, bool high = false)
{
PlayThrowSequenceSound(beat, true);
WantThrowSequence = beat;
WantThrowHigh = high;
}
public static void PlayThrowSequenceSound(double beat, bool force = false)
{
MultiSound.Play(new MultiSound.Sound[] {
new MultiSound.Sound("pajamaParty/throw1", beat),
new MultiSound.Sound("pajamaParty/throw2", beat + 0.5f),
new MultiSound.Sound("pajamaParty/throw3", beat + 1f),
new MultiSound.Sound("pajamaParty/throw2", beat + 0.5),
new MultiSound.Sound("pajamaParty/throw3", beat + 1),
//TODO: change when locales are a thing
new MultiSound.Sound("pajamaParty/throw4a", beat + 1.5f),
new MultiSound.Sound("pajamaParty/throw4a", beat + 1.5),
new MultiSound.Sound("pajamaParty/charge", beat + 2f),
new MultiSound.Sound("pajamaParty/charge", beat + 2),
}, forcePlay: force);
}
public void DoSleepSequence(double beat, bool alt = false, int action = (int) PajamaParty.SleepType.Normal, bool doSound = true)
public void DoSleepSequence(double beat, bool alt = false, int action = (int)PajamaParty.SleepType.Normal, bool doSound = true)
{
Mako.StartSleepSequence(beat, alt, action);
MonkeySleep(beat, action);
if (doSound)
MultiSound.Play(new MultiSound.Sound[] {
new MultiSound.Sound("pajamaParty/siesta1", beat),
new MultiSound.Sound("pajamaParty/siesta2", beat + 0.5f),
new MultiSound.Sound("pajamaParty/siesta3", beat + 1f),
new MultiSound.Sound("pajamaParty/siesta3", beat + 2.5f),
new MultiSound.Sound("pajamaParty/siesta3", beat + 4f)
new MultiSound.Sound("pajamaParty/siesta2", beat + 0.5),
new MultiSound.Sound("pajamaParty/siesta3", beat + 1),
new MultiSound.Sound("pajamaParty/siesta3", beat + 2.5),
new MultiSound.Sound("pajamaParty/siesta3", beat + 4)
});
}
public static void WarnSleepSequence(double beat, bool alt = false, int action = (int) PajamaParty.SleepType.Normal)
public static void WarnSleepSequence(double beat, bool alt = false, int action = (int)PajamaParty.SleepType.Normal)
{
MultiSound.Play(new MultiSound.Sound[] {
new MultiSound.Sound("pajamaParty/siesta1", beat),
new MultiSound.Sound("pajamaParty/siesta2", beat + 0.5f),
new MultiSound.Sound("pajamaParty/siesta3", beat + 1f),
new MultiSound.Sound("pajamaParty/siesta3", beat + 2.5f),
new MultiSound.Sound("pajamaParty/siesta3", beat + 4f)
new MultiSound.Sound("pajamaParty/siesta2", beat + 0.5),
new MultiSound.Sound("pajamaParty/siesta3", beat + 1),
new MultiSound.Sound("pajamaParty/siesta3", beat + 2.5),
new MultiSound.Sound("pajamaParty/siesta3", beat + 4)
}, forcePlay: true);
WantSleepSequence = beat;
WantSleepType = alt;
@ -388,8 +440,10 @@ namespace HeavenStudio.Games
public void DoInstantSleep(double deslumber, int action)
{
Mako.anim.Play("MakoSleepJust", -1, 1);
for (int y = 0; y < 5; y++) {
for (int x = 0; x < 5; x++) {
for (int y = 0; y < 5; y++)
{
for (int x = 0; x < 5; x++)
{
if (!(y == 0 && x == 2)) monkeys[x, y].anim.Play("MonkeySleep02", -1, 1);
}
}
@ -481,5 +535,19 @@ namespace HeavenStudio.Games
}
}
}
public void OpenBackground(double beat, double length, bool instant = false)
{
bgState = !bgState;
if (instant)
{
BgAnimator.Play(bgState ? "SlideOpen" : "SlideClose", -1, 1);
BgAnimator.speed = 0;
}
else
{
BgAnimator.DoScaledAnimationAsync(bgState ? "SlideOpen" : "SlideClose", (float)(1.0 / length));
}
}
}
}