2023-01-14 20:31:50 +00:00
|
|
|
using HeavenStudio.Util;
|
|
|
|
using System;
|
|
|
|
using System.Collections.Generic;
|
|
|
|
using UnityEngine;
|
|
|
|
|
|
|
|
namespace HeavenStudio.Games.Loaders
|
|
|
|
{
|
|
|
|
using static Minigames;
|
|
|
|
public static class CtrTeppanLoader
|
|
|
|
{
|
|
|
|
public static Minigame AddGame(EventCaller eventCaller)
|
|
|
|
{
|
2023-04-02 02:28:23 +00:00
|
|
|
return new Minigame("kitties", "Kitties!", "ffffff", false, false, new List<GameAction>()
|
2023-01-14 20:31:50 +00:00
|
|
|
{
|
|
|
|
new GameAction("clap", "Cat Clap")
|
|
|
|
{
|
2023-01-25 15:29:21 +00:00
|
|
|
function = delegate { Kitties.instance.Clap(eventCaller.currentEntity["toggle"], eventCaller.currentEntity["toggle1"], eventCaller.currentEntity["toggle2"],
|
2023-01-14 20:31:50 +00:00
|
|
|
eventCaller.currentEntity.beat, eventCaller.currentEntity["type"]); },
|
|
|
|
|
2023-01-25 15:29:21 +00:00
|
|
|
defaultLength = 4f,
|
2023-01-14 20:31:50 +00:00
|
|
|
parameters = new List<Param>()
|
|
|
|
{
|
|
|
|
new Param("type", Kitties.SpawnType.Straight, "Spawn", "The way in which the kitties will spawn"),
|
|
|
|
new Param("toggle", false, "Mice", "Replaces kitties as mice"),
|
2023-01-25 15:29:21 +00:00
|
|
|
new Param("toggle1", false, "Invert Direction", "Inverts the direction they clap in"),
|
|
|
|
new Param("toggle2", false, "Keep Cats Spawned", "Sets whether or not cats stay spawned after their cue"),
|
2023-01-14 20:31:50 +00:00
|
|
|
}
|
|
|
|
},
|
|
|
|
|
2023-01-25 15:29:21 +00:00
|
|
|
new GameAction("roll", "Roll")
|
|
|
|
{
|
|
|
|
function = delegate { Kitties.instance.Roll(eventCaller.currentEntity["toggle"], eventCaller.currentEntity.beat); },
|
|
|
|
|
|
|
|
defaultLength = 4f,
|
|
|
|
|
|
|
|
parameters = new List<Param>()
|
|
|
|
{
|
|
|
|
new Param("toggle", false, "Keep Cats spawned", "Sets whether or not cats stay spawned after their cue"),
|
|
|
|
}
|
|
|
|
},
|
|
|
|
|
|
|
|
new GameAction ("fish", "Fish")
|
2023-01-14 20:31:50 +00:00
|
|
|
{
|
2023-01-25 15:29:21 +00:00
|
|
|
function = delegate { Kitties.instance.CatchFish(eventCaller.currentEntity.beat); },
|
|
|
|
defaultLength = 4f,
|
|
|
|
},
|
|
|
|
|
|
|
|
new GameAction("instantSpawn", "Instant Spawn")
|
|
|
|
{
|
|
|
|
function = delegate { Kitties.instance.InstantSpawn(eventCaller.currentEntity["toggle"], eventCaller.currentEntity["toggle1"],
|
|
|
|
eventCaller.currentEntity.beat, eventCaller.currentEntity["type"]); },
|
2023-01-14 20:31:50 +00:00
|
|
|
|
2023-01-25 15:29:21 +00:00
|
|
|
defaultLength = .5f,
|
|
|
|
parameters = new List<Param>()
|
|
|
|
{
|
|
|
|
new Param("type", Kitties.SpawnType.Straight, "Spawn", "The way in which the kitties will spawn"),
|
|
|
|
new Param("toggle", false, "Mice", "Replaces kitties as mice"),
|
|
|
|
new Param("toggle1", false, "Invert Direction", "Inverts the direction they clap in"),
|
|
|
|
new Param("toggle2", false, "Keep Cats Spawned", "Sets whether or not cats stay spawned after their cue"),
|
|
|
|
}
|
2023-01-14 20:31:50 +00:00
|
|
|
},
|
|
|
|
|
2023-01-25 15:29:21 +00:00
|
|
|
new GameAction("bgcolor", "Background Color")
|
|
|
|
{
|
2023-09-11 22:28:04 +00:00
|
|
|
function = delegate
|
2023-08-12 03:30:03 +00:00
|
|
|
{
|
|
|
|
var e = eventCaller.currentEntity;
|
2023-09-11 22:28:04 +00:00
|
|
|
Kitties.instance.BackgroundColor(e.beat, e.length, e["colorStart"], e["colorEnd"], e["ease"]);
|
2023-08-12 03:30:03 +00:00
|
|
|
},
|
|
|
|
defaultLength = 4,
|
|
|
|
resizable = true,
|
2023-01-25 15:29:21 +00:00
|
|
|
parameters = new List<Param>()
|
|
|
|
{
|
2023-08-12 03:30:03 +00:00
|
|
|
new Param("colorStart", Color.white, "Start Color"),
|
|
|
|
new Param("colorEnd", Color.white, "End Color"),
|
|
|
|
new Param("ease", Util.EasingFunction.Ease.Linear, "Ease")
|
2023-01-25 15:29:21 +00:00
|
|
|
}
|
|
|
|
}
|
2023-05-28 17:34:44 +00:00
|
|
|
},
|
2023-09-11 22:28:04 +00:00
|
|
|
new List<string>() { "ctr", "normal" },
|
2023-05-28 17:34:44 +00:00
|
|
|
"ctrteppan", "en",
|
2023-09-11 22:28:04 +00:00
|
|
|
new List<string>() { }
|
2023-05-28 17:34:44 +00:00
|
|
|
);
|
2023-01-14 20:31:50 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
namespace HeavenStudio.Games
|
|
|
|
{
|
2023-01-25 15:29:21 +00:00
|
|
|
using Scripts_Kitties;
|
2023-01-14 20:31:50 +00:00
|
|
|
public class Kitties : Minigame
|
|
|
|
{
|
2023-01-25 15:29:21 +00:00
|
|
|
public CtrTeppanPlayer player;
|
|
|
|
public Animator[] kitties;
|
|
|
|
public GameObject[] Cats;
|
|
|
|
|
|
|
|
public GameObject Fish;
|
|
|
|
public bool isInverted;
|
|
|
|
public SpriteRenderer background;
|
|
|
|
|
|
|
|
public Vector3[] positions;
|
|
|
|
public float[] rotationAngles;
|
|
|
|
|
2023-01-14 20:31:50 +00:00
|
|
|
public enum SpawnType
|
|
|
|
{
|
|
|
|
Straight,
|
2023-01-25 15:29:21 +00:00
|
|
|
DownDiagonal,
|
|
|
|
UpDiagonal,
|
|
|
|
CloseUp
|
2023-01-14 20:31:50 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
public static Kitties instance;
|
|
|
|
|
|
|
|
void Awake()
|
|
|
|
{
|
|
|
|
instance = this;
|
|
|
|
}
|
|
|
|
|
|
|
|
// Update is called once per frame
|
|
|
|
void Update()
|
|
|
|
{
|
2023-08-12 03:30:03 +00:00
|
|
|
BackgroundColorUpdate();
|
2023-01-14 20:31:50 +00:00
|
|
|
}
|
|
|
|
|
2023-06-10 19:13:29 +00:00
|
|
|
public void Clap(bool isMice, bool isInverse, bool keepSpawned, double beat, int type)
|
2023-01-25 15:29:21 +00:00
|
|
|
{
|
|
|
|
player.ScheduleClap(beat, type);
|
|
|
|
MultiSound.Play(new MultiSound.Sound[] {
|
|
|
|
new MultiSound.Sound("kitties/nya1", beat),
|
|
|
|
new MultiSound.Sound("kitties/nya2", beat + .75f),
|
|
|
|
new MultiSound.Sound("kitties/nya3", beat + 1.5f)
|
|
|
|
});
|
|
|
|
|
2023-09-11 22:28:04 +00:00
|
|
|
if (type == 3)
|
2023-01-25 15:29:21 +00:00
|
|
|
{
|
2023-09-11 22:28:04 +00:00
|
|
|
BeatAction.New(instance, new List<BeatAction.Action>()
|
2023-01-25 15:29:21 +00:00
|
|
|
{
|
|
|
|
new BeatAction.Action(beat, delegate { Spawn(type, 0, isMice, isInverse, true, false);}),
|
|
|
|
new BeatAction.Action(beat + 2.5f, delegate { kitties[0].Play("FaceClap", 0, 0);}),
|
|
|
|
new BeatAction.Action(beat + 3f, delegate { kitties[0].Play("FaceClap", 0, 0);}),
|
|
|
|
});
|
|
|
|
|
2023-09-11 22:28:04 +00:00
|
|
|
BeatAction.New(instance, new List<BeatAction.Action>()
|
2023-01-25 15:29:21 +00:00
|
|
|
{
|
|
|
|
new BeatAction.Action(beat + .75f, delegate { Spawn(type, 1, isMice, isInverse, false, false);}),
|
|
|
|
new BeatAction.Action(beat + 2.5f, delegate { kitties[1].Play("FaceClap", 0, 0);}),
|
|
|
|
new BeatAction.Action(beat + 3f, delegate { kitties[1].Play("FaceClap", 0, 0);}),
|
|
|
|
});
|
|
|
|
|
2023-09-11 22:28:04 +00:00
|
|
|
BeatAction.New(instance, new List<BeatAction.Action>()
|
2023-01-25 15:29:21 +00:00
|
|
|
{
|
|
|
|
new BeatAction.Action(beat + 1.5f, delegate { Spawn(type, 2, isMice, isInverse, false, false);}),
|
|
|
|
new BeatAction.Action(beat + 1.5f, delegate { player.canClap = true;}),
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
|
|
|
else if (!isMice)
|
|
|
|
{
|
2023-09-11 22:28:04 +00:00
|
|
|
BeatAction.New(instance, new List<BeatAction.Action>()
|
2023-01-25 15:29:21 +00:00
|
|
|
{
|
|
|
|
new BeatAction.Action(beat, delegate { Spawn(type, 0, isMice, isInverse, true, false);}),
|
|
|
|
new BeatAction.Action(beat + 2.5f, delegate { kitties[0].Play("Clap1", 0, 0);}),
|
|
|
|
new BeatAction.Action(beat + 3f, delegate { kitties[0].Play("Clap2", 0, 0);}),
|
|
|
|
});
|
|
|
|
|
2023-09-11 22:28:04 +00:00
|
|
|
BeatAction.New(instance, new List<BeatAction.Action>()
|
2023-01-25 15:29:21 +00:00
|
|
|
{
|
|
|
|
new BeatAction.Action(beat + .75f, delegate { Spawn(type, 1, isMice, isInverse, false, false);}),
|
|
|
|
new BeatAction.Action(beat + 2.5f, delegate { kitties[1].Play("Clap1", 0, 0);}),
|
|
|
|
new BeatAction.Action(beat + 3f, delegate { kitties[1].Play("Clap2", 0, 0);}),
|
|
|
|
});
|
|
|
|
|
2023-09-11 22:28:04 +00:00
|
|
|
BeatAction.New(instance, new List<BeatAction.Action>()
|
2023-01-25 15:29:21 +00:00
|
|
|
{
|
|
|
|
new BeatAction.Action(beat + 1.5f, delegate { Spawn(type, 2, isMice, isInverse, false, false);}),
|
|
|
|
new BeatAction.Action(beat + 1.5f, delegate { player.canClap = true;}),
|
|
|
|
});
|
|
|
|
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2023-09-11 22:28:04 +00:00
|
|
|
BeatAction.New(instance, new List<BeatAction.Action>()
|
2023-01-25 15:29:21 +00:00
|
|
|
{
|
|
|
|
new BeatAction.Action(beat, delegate { Spawn(type, 0, isMice, isInverse, true, false);}),
|
|
|
|
new BeatAction.Action(beat + 2.5f, delegate { kitties[0].Play("MiceClap1", 0, 0);}),
|
|
|
|
new BeatAction.Action(beat + 3f, delegate { kitties[0].Play("MiceClap2", 0, 0);}),
|
|
|
|
});
|
|
|
|
|
2023-09-11 22:28:04 +00:00
|
|
|
BeatAction.New(instance, new List<BeatAction.Action>()
|
2023-01-25 15:29:21 +00:00
|
|
|
{
|
|
|
|
new BeatAction.Action(beat + .75f, delegate { Spawn(type, 1, isMice, isInverse, false, false);}),
|
|
|
|
new BeatAction.Action(beat + 2.5f, delegate { kitties[1].Play("MiceClap1", 0, 0);}),
|
|
|
|
new BeatAction.Action(beat + 3f, delegate { kitties[1].Play("MiceClap2", 0, 0);}),
|
|
|
|
});
|
|
|
|
|
2023-09-11 22:28:04 +00:00
|
|
|
BeatAction.New(instance, new List<BeatAction.Action>()
|
2023-01-25 15:29:21 +00:00
|
|
|
{
|
|
|
|
new BeatAction.Action(beat + 1.5f, delegate { Spawn(type, 2, isMice, isInverse, false, false);}),
|
|
|
|
new BeatAction.Action(beat + 1.5f, delegate { player.canClap = true;}),
|
|
|
|
});
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!keepSpawned)
|
|
|
|
{
|
2023-09-11 22:28:04 +00:00
|
|
|
BeatAction.New(instance, new List<BeatAction.Action>()
|
2023-01-25 15:29:21 +00:00
|
|
|
{
|
|
|
|
new BeatAction.Action(beat + 3.5f, delegate { RemoveCats(false);})
|
|
|
|
});
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2023-06-10 19:13:29 +00:00
|
|
|
public void Roll(bool keepSpawned, double beat)
|
2023-01-25 15:29:21 +00:00
|
|
|
{
|
|
|
|
if (!player.canClap)
|
|
|
|
return;
|
|
|
|
player.ScheduleRoll(beat);
|
|
|
|
MultiSound.Play(new MultiSound.Sound[] {
|
|
|
|
new MultiSound.Sound("kitties/roll1", beat),
|
|
|
|
new MultiSound.Sound("kitties/roll2", beat + .5f),
|
|
|
|
new MultiSound.Sound("kitties/roll3", beat + 1f),
|
|
|
|
new MultiSound.Sound("kitties/roll4", beat + 1.5f)
|
2023-01-14 20:31:50 +00:00
|
|
|
|
2023-01-25 15:29:21 +00:00
|
|
|
});
|
2023-09-11 22:28:04 +00:00
|
|
|
BeatAction.New(instance, new List<BeatAction.Action>()
|
2023-01-25 15:29:21 +00:00
|
|
|
{
|
|
|
|
new BeatAction.Action(beat, delegate { kitties[0].Play("RollStart", 0, 0); }),
|
|
|
|
new BeatAction.Action(beat + .5f, delegate { kitties[0].Play("RollStart", 0, 0); }),
|
|
|
|
new BeatAction.Action(beat + 1f, delegate { kitties[0].Play("RollStart", 0, 0); }),
|
|
|
|
new BeatAction.Action(beat + 1.5f, delegate { kitties[0].Play("RollStart", 0, 0); }),
|
|
|
|
new BeatAction.Action(beat + 2f, delegate { kitties[0].Play("Rolling", 0, 0); }),
|
|
|
|
new BeatAction.Action(beat + 2.75f, delegate { kitties[0].Play("RollEnd", 0, 0); })
|
|
|
|
});
|
|
|
|
|
2023-09-11 22:28:04 +00:00
|
|
|
BeatAction.New(instance, new List<BeatAction.Action>()
|
2023-01-25 15:29:21 +00:00
|
|
|
{
|
|
|
|
new BeatAction.Action(beat, delegate { kitties[1].Play("RollStart", 0, 0); }),
|
|
|
|
new BeatAction.Action(beat + .5f, delegate { kitties[1].Play("RollStart", 0, 0); }),
|
|
|
|
new BeatAction.Action(beat + 1f, delegate { kitties[1].Play("RollStart", 0, 0); }),
|
|
|
|
new BeatAction.Action(beat + 1.5f, delegate { kitties[1].Play("RollStart", 0, 0); }),
|
|
|
|
new BeatAction.Action(beat + 2f, delegate { kitties[1].Play("Rolling", 0, 0); }),
|
|
|
|
new BeatAction.Action(beat + 2.75f, delegate { kitties[1].Play("RollEnd", 0, 0); })
|
|
|
|
});
|
|
|
|
|
2023-09-11 22:28:04 +00:00
|
|
|
BeatAction.New(instance, new List<BeatAction.Action>()
|
2023-01-25 15:29:21 +00:00
|
|
|
{
|
|
|
|
new BeatAction.Action(beat, delegate { kitties[2].Play("RollStart", 0, 0); }),
|
|
|
|
new BeatAction.Action(beat + .5f, delegate { kitties[2].Play("RollStart", 0, 0); }),
|
|
|
|
new BeatAction.Action(beat + 1f, delegate { kitties[2].Play("RollStart", 0, 0); }),
|
|
|
|
new BeatAction.Action(beat + 1.5f, delegate { kitties[2].Play("RollStart", 0, 0); }),
|
|
|
|
new BeatAction.Action(beat + 2f, delegate { player.ScheduleRollFinish(beat); })
|
|
|
|
});
|
|
|
|
|
|
|
|
if (!keepSpawned)
|
|
|
|
{
|
2023-09-11 22:28:04 +00:00
|
|
|
BeatAction.New(instance, new List<BeatAction.Action>()
|
2023-01-25 15:29:21 +00:00
|
|
|
{
|
|
|
|
new BeatAction.Action(beat + 3.5f, delegate { RemoveCats(false);})
|
|
|
|
});
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2023-06-10 19:13:29 +00:00
|
|
|
public void CatchFish(double beat)
|
2023-01-25 15:29:21 +00:00
|
|
|
{
|
2023-02-21 16:26:20 +00:00
|
|
|
//if (!player.canClap)
|
|
|
|
// return;
|
2023-09-11 22:28:04 +00:00
|
|
|
|
2023-01-25 15:29:21 +00:00
|
|
|
player.ScheduleFish(beat);
|
|
|
|
MultiSound.Play(new MultiSound.Sound[] {
|
|
|
|
new MultiSound.Sound("kitties/fish1", beat + 2f),
|
|
|
|
new MultiSound.Sound("kitties/fish2", beat + 2.25f),
|
|
|
|
new MultiSound.Sound("kitties/fish3", beat + 2.5f),
|
|
|
|
|
|
|
|
});
|
|
|
|
|
2023-09-11 22:28:04 +00:00
|
|
|
BeatAction.New(instance, new List<BeatAction.Action>()
|
2023-01-25 15:29:21 +00:00
|
|
|
{
|
2023-02-21 16:26:20 +00:00
|
|
|
new BeatAction.Action(beat, delegate { if (isInverted)
|
|
|
|
Fish.transform.localScale = new Vector3(-1f, 1f, 1f);
|
|
|
|
else
|
|
|
|
Fish.transform.localScale = new Vector3(1f, 1f, 1f); }),
|
2023-09-11 22:28:04 +00:00
|
|
|
new BeatAction.Action(beat, delegate { Fish.SetActive(true); }),
|
2023-01-25 15:29:21 +00:00
|
|
|
new BeatAction.Action(beat, delegate { Fish.GetComponent<Animator>().DoScaledAnimationAsync("FishDangle", 0.5f); }),
|
|
|
|
new BeatAction.Action(beat + 2f, delegate { kitties[0].Play("FishNotice", 0, 0); }),
|
|
|
|
new BeatAction.Action(beat + 2.25f, delegate { kitties[1].Play("FishNotice2", 0, 0); }),
|
|
|
|
new BeatAction.Action(beat + 2.5f, delegate { kitties[2].Play("FishNotice3", 0, 0); })
|
|
|
|
});
|
|
|
|
|
2023-09-11 22:28:04 +00:00
|
|
|
BeatAction.New(instance, new List<BeatAction.Action>()
|
2023-01-25 15:29:21 +00:00
|
|
|
{
|
|
|
|
new BeatAction.Action(beat + 4f, delegate { Fish.SetActive(false);})
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
public void Spawn(int pos, int catNum, bool isMice, bool isInverse, bool firstSpawn, bool instant)
|
|
|
|
{
|
|
|
|
ResetRotation(catNum);
|
|
|
|
if (firstSpawn)
|
|
|
|
{
|
|
|
|
isInverted = isInverse;
|
|
|
|
switch (pos)
|
|
|
|
{
|
|
|
|
case 0:
|
|
|
|
|
|
|
|
if (!isInverse)
|
|
|
|
{
|
|
|
|
positions[0] = new Vector3(-5.11f, -1.25f, 0f);
|
|
|
|
positions[1] = new Vector3(.32f, -1.25f, 0f);
|
|
|
|
positions[2] = new Vector3(5.75f, -1.25f, 0f);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
positions[0] = new Vector3(5.75f, -1.25f, 0f);
|
|
|
|
positions[1] = new Vector3(.32f, -1.25f, 0f);
|
|
|
|
positions[2] = new Vector3(-5.11f, -1.5f, 0f);
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
|
|
|
case 1:
|
|
|
|
|
|
|
|
if (!isInverse)
|
|
|
|
{
|
|
|
|
positions[0] = new Vector3(-6.61f, 1.75f, 6f);
|
|
|
|
positions[1] = new Vector3(.32f, -.25f, 2f);
|
|
|
|
positions[2] = new Vector3(4.25f, -1.75f, -2f);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
positions[0] = new Vector3(6.61f, 1.75f, 6f);
|
|
|
|
positions[1] = new Vector3(.32f, -.25f, 2f);
|
|
|
|
positions[2] = new Vector3(-4.25f, -1.75f, -2f);
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
|
|
|
case 2:
|
|
|
|
|
|
|
|
if (!isInverse)
|
|
|
|
{
|
|
|
|
positions[0] = new Vector3(4.25f, -1.75f, -2f);
|
|
|
|
positions[1] = new Vector3(.32f, -.25f, 2f);
|
|
|
|
positions[2] = new Vector3(-6.61f, 1.75f, 6f);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
positions[0] = new Vector3(-4.25f, -1.75f, -2f);
|
|
|
|
positions[1] = new Vector3(.32f, -.25f, 2f);
|
|
|
|
positions[2] = new Vector3(6.61f, 1.75f, 6f);
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
|
|
|
case 3:
|
|
|
|
if (firstSpawn)
|
|
|
|
{
|
|
|
|
rotationAngles = new float[] { -135f, 135f, 0f };
|
|
|
|
positions[0] = new Vector3(-8.21f, 3.7f, 0f);
|
|
|
|
positions[1] = new Vector3(7.51f, 4.2f, 0f);
|
|
|
|
positions[2] = new Vector3(.32f, -4.25f, 0f);
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
Cats[catNum].transform.position = positions[catNum];
|
|
|
|
if (pos != 3)
|
|
|
|
{
|
|
|
|
if (!isInverse)
|
|
|
|
Cats[catNum].transform.localScale = new Vector3(1f, 1f, 1f);
|
|
|
|
else
|
|
|
|
Cats[catNum].transform.localScale = new Vector3(-1f, 1f, 1f);
|
|
|
|
}
|
|
|
|
|
|
|
|
else
|
|
|
|
{
|
|
|
|
var rotationVector = Cats[catNum].transform.rotation.eulerAngles;
|
|
|
|
rotationVector.z = rotationAngles[catNum];
|
|
|
|
Cats[catNum].transform.rotation = Quaternion.Euler(rotationVector);
|
|
|
|
Cats[catNum].transform.localScale = new Vector3(-1f, 1f, 1f);
|
|
|
|
}
|
|
|
|
|
|
|
|
Cats[catNum].transform.GetChild(0).gameObject.SetActive(true);
|
|
|
|
|
|
|
|
if (!instant)
|
|
|
|
{
|
|
|
|
if (pos == 3)
|
|
|
|
{
|
|
|
|
kitties[catNum].Play("FacePopIn", 0, 0);
|
|
|
|
}
|
|
|
|
else if (!isMice)
|
|
|
|
kitties[catNum].Play("PopIn", 0, 0);
|
|
|
|
else if (catNum < 2)
|
|
|
|
{
|
|
|
|
kitties[catNum].Play("MicePopIn", 0, 0);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
kitties[catNum].Play("PopIn", 0, 0);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2023-09-11 22:28:04 +00:00
|
|
|
if (pos == 3)
|
2023-01-25 15:29:21 +00:00
|
|
|
kitties[catNum].Play("FaceIdle", 0, 0);
|
|
|
|
else if (!isMice)
|
|
|
|
kitties[catNum].Play("Idle", 0, 0);
|
|
|
|
else if (catNum < 2)
|
|
|
|
kitties[catNum].Play("MiceIdle", 0, 0);
|
|
|
|
else
|
|
|
|
kitties[catNum].Play("Idle", 0, 0);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
public void ResetRotation(int catNum)
|
|
|
|
{
|
|
|
|
var rotationVector = Cats[0].transform.rotation.eulerAngles;
|
|
|
|
rotationVector.z = 0;
|
|
|
|
Cats[catNum].transform.rotation = Quaternion.Euler(rotationVector);
|
|
|
|
}
|
|
|
|
|
|
|
|
public void RemoveCats(bool fishing)
|
|
|
|
{
|
|
|
|
if (!fishing)
|
|
|
|
{
|
|
|
|
for (int x = 0; x < 3; x++)
|
|
|
|
{
|
|
|
|
Cats[x].transform.GetChild(0).gameObject.SetActive(false);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
Fish.SetActive(false);
|
2023-09-11 22:28:04 +00:00
|
|
|
player.canClap = false;
|
2023-01-25 15:29:21 +00:00
|
|
|
}
|
|
|
|
|
2023-06-10 19:13:29 +00:00
|
|
|
public void InstantSpawn(bool isMice, bool isInverse, double beat, int pos)
|
2023-01-25 15:29:21 +00:00
|
|
|
{
|
2023-09-11 22:28:04 +00:00
|
|
|
BeatAction.New(instance, new List<BeatAction.Action>()
|
2023-01-25 15:29:21 +00:00
|
|
|
{
|
|
|
|
new BeatAction.Action(beat, delegate { Spawn(pos, 0, isMice, isInverse, true, true); }),
|
|
|
|
new BeatAction.Action(beat, delegate { Spawn(pos, 1, isMice, isInverse, true, true); }),
|
|
|
|
new BeatAction.Action(beat, delegate { Spawn(pos, 2, isMice, isInverse, true, true); })
|
|
|
|
});
|
|
|
|
player.canClap = true;
|
|
|
|
}
|
|
|
|
|
2023-08-12 03:30:03 +00:00
|
|
|
private double colorStartBeat = -1;
|
|
|
|
private float colorLength = 0f;
|
|
|
|
private Color colorStart = Color.white; //obviously put to the default color of the game
|
|
|
|
private Color colorEnd = Color.white;
|
|
|
|
private Util.EasingFunction.Ease colorEase; //putting Util in case this game is using jukebox
|
|
|
|
|
|
|
|
//call this in update
|
|
|
|
private void BackgroundColorUpdate()
|
|
|
|
{
|
|
|
|
float normalizedBeat = Mathf.Clamp01(Conductor.instance.GetPositionFromBeat(colorStartBeat, colorLength));
|
|
|
|
|
|
|
|
var func = Util.EasingFunction.GetEasingFunction(colorEase);
|
|
|
|
|
|
|
|
float newR = func(colorStart.r, colorEnd.r, normalizedBeat);
|
|
|
|
float newG = func(colorStart.g, colorEnd.g, normalizedBeat);
|
|
|
|
float newB = func(colorStart.b, colorEnd.b, normalizedBeat);
|
|
|
|
|
|
|
|
background.color = new Color(newR, newG, newB);
|
|
|
|
}
|
|
|
|
|
|
|
|
public void BackgroundColor(double beat, float length, Color colorStartSet, Color colorEndSet, int ease)
|
|
|
|
{
|
|
|
|
colorStartBeat = beat;
|
|
|
|
colorLength = length;
|
|
|
|
colorStart = colorStartSet;
|
|
|
|
colorEnd = colorEndSet;
|
|
|
|
colorEase = (Util.EasingFunction.Ease)ease;
|
|
|
|
}
|
|
|
|
|
|
|
|
//call this in OnPlay(double beat) and OnGameSwitch(double beat)
|
|
|
|
private void PersistColor(double beat)
|
|
|
|
{
|
|
|
|
var allEventsBeforeBeat = EventCaller.GetAllInGameManagerList("kitties", new string[] { "bgcolor" }).FindAll(x => x.beat < beat);
|
|
|
|
if (allEventsBeforeBeat.Count > 0)
|
|
|
|
{
|
|
|
|
allEventsBeforeBeat.Sort((x, y) => x.beat.CompareTo(y.beat)); //just in case
|
|
|
|
var lastEvent = allEventsBeforeBeat[^1];
|
|
|
|
BackgroundColor(lastEvent.beat, lastEvent.length, lastEvent["colorStart"], lastEvent["colorEnd"], lastEvent["ease"]);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
public override void OnPlay(double beat)
|
|
|
|
{
|
|
|
|
PersistColor(beat);
|
|
|
|
}
|
|
|
|
|
|
|
|
public override void OnGameSwitch(double beat)
|
2023-01-25 15:29:21 +00:00
|
|
|
{
|
2023-08-12 03:30:03 +00:00
|
|
|
PersistColor(beat);
|
2023-01-25 15:29:21 +00:00
|
|
|
}
|
2023-01-14 20:31:50 +00:00
|
|
|
}
|
|
|
|
}
|