1525 lines
58 KiB
C#
1525 lines
58 KiB
C#
using System.Collections;
|
|
using System.Collections.Generic;
|
|
using UnityEngine;
|
|
|
|
using HeavenStudio.Util;
|
|
using HeavenStudio.InputSystem;
|
|
using UnityEngine.Sprites;
|
|
|
|
namespace HeavenStudio.Games.Loaders
|
|
{
|
|
using static Minigames;
|
|
|
|
public static class NtrLabLoader
|
|
{
|
|
public static Minigame AddGame(EventCaller e)
|
|
{
|
|
return new Minigame("loveLab", "Love Lab", "b5ffff", false, false, new List<GameAction>()
|
|
{
|
|
new GameAction("bop", "Bop")
|
|
{
|
|
function = delegate { LoveLab.instance.Bop(e.currentEntity.beat, e.currentEntity.length,
|
|
e.currentEntity["toggle"], e.currentEntity["toggle2"]); },
|
|
resizable = true,
|
|
parameters = new List<Param>()
|
|
{
|
|
new Param("toggle", true, "Bop", "Whether both will bop to the beat or not"),
|
|
new Param("toggle2", false, "Bop (Auto)", "Whether both will bop automatically to the beat or not")
|
|
}
|
|
},
|
|
|
|
new GameAction("boxGuy", "Box Guy")
|
|
{
|
|
function = delegate { LoveLab.instance.mainBoxGuy(e.currentEntity.beat, e.currentEntity["type"]); },
|
|
defaultLength = 2f,
|
|
parameters = new List<Param>()
|
|
{
|
|
new Param("type", LoveLab.boxGuyAction.takeAway, "Action", "Box Guy's Actions")
|
|
}
|
|
},
|
|
|
|
new GameAction("set object colors", "Object Colors")
|
|
{
|
|
function = delegate {
|
|
LoveLab.instance.UpdateMaterialColor(e.currentEntity["colorA"], e.currentEntity["colorB"], e.currentEntity["colorC"]);
|
|
},
|
|
defaultLength = 0.5f,
|
|
parameters = new List<Param>()
|
|
{
|
|
new Param("colorA", new Color(0.02909997f, 0.4054601f, 0.97f), "1st Flask Color", "1st Flask Color to show"),
|
|
new Param("colorB", new Color(0.81f, 0.2984211f, 0f), "2nd Flask Color", "2nd Flask Color to show"),
|
|
new Param("colorC", new Color(0.8313726f, 0.2039216f, 0.5058824f), "3rd Flask Color", "3rd Flask Color to show")
|
|
},
|
|
priority = 2
|
|
},
|
|
|
|
new GameAction("set time of day", "Time of Day")
|
|
{
|
|
function = delegate
|
|
{
|
|
LoveLab.instance.setTimeOfDay(e.currentEntity["type"]);
|
|
},
|
|
defaultLength = .5f,
|
|
parameters = new List<Param>()
|
|
{
|
|
new Param("type", LoveLab.timeOfDay.sunset, "Time", "Set the time of day")
|
|
}
|
|
},
|
|
|
|
new GameAction("spotlight", "Spotlight")
|
|
{
|
|
function = delegate { LoveLab.instance.spotlight(e.currentEntity["toggle"], e.currentEntity["spotType"], e.currentEntity["posType"]); },
|
|
defaultLength = .5f,
|
|
parameters = new List<Param>()
|
|
{
|
|
new Param("toggle", false, "Spotlight", "Activate Spotlight?"),
|
|
new Param("spotType", LoveLab.spotlightType.normal, "Spotlight Type", "Normal or Coned?"),
|
|
new Param("posType", LoveLab.spotlightPos.boy, "Spotlight Position", "(For cone) under the Boy or the Girl?")
|
|
},
|
|
priority = 1
|
|
},
|
|
|
|
new GameAction("beat intervals", "Start Interval")
|
|
{
|
|
function = delegate { LoveLab.PreInterval(e.currentEntity.beat, e.currentEntity.length, e.currentEntity["auto"]); },
|
|
parameters = new List<Param>()
|
|
{
|
|
new Param("auto", true, "Auto Pass Turn", "Toggle if the turn should be passed automatically at the end of the start interval.")
|
|
},
|
|
defaultLength = 4f,
|
|
resizable = true,
|
|
priority = 2,
|
|
},
|
|
new GameAction("boy shakes", "Boy Shakes")
|
|
{
|
|
parameters = new List<Param>()
|
|
{
|
|
new Param("speed", LoveLab.throwFlaskSpeedType.fastFlask, "Flask Speed", "How fast should the boy throw the flasks to the girl?")
|
|
},
|
|
defaultLength = .5f,
|
|
resizable = true,
|
|
priority = 1
|
|
},
|
|
|
|
new GameAction("1Heart", "1 Heart")
|
|
{
|
|
preFunction = delegate { LoveLab.queueFlask(e.currentEntity.beat, LoveLab.flaskHeart.oneHeart); },
|
|
preFunctionLength = 1f,
|
|
defaultLength = 4f
|
|
},
|
|
|
|
new GameAction("1HeartOffbeat", "1 Heart Offbeat")
|
|
{
|
|
preFunction = delegate { LoveLab.queueFlask(e.currentEntity.beat, LoveLab.flaskHeart.oneOffHeart); },
|
|
preFunctionLength = 1f,
|
|
defaultLength = 4f
|
|
},
|
|
|
|
new GameAction("2Heart", "2 Heart")
|
|
{
|
|
preFunction = delegate { LoveLab.queueFlask(e.currentEntity.beat, LoveLab.flaskHeart.twoHeart); },
|
|
preFunctionLength = 1f,
|
|
defaultLength = 4f
|
|
},
|
|
|
|
new GameAction("3Heart", "3 Heart")
|
|
{
|
|
preFunction = delegate { LoveLab.queueFlask(e.currentEntity.beat, LoveLab.flaskHeart.threeHeart); },
|
|
preFunctionLength = 1f,
|
|
defaultLength = 10f
|
|
},
|
|
|
|
new GameAction("5Heart", "5 Heart")
|
|
{
|
|
preFunction = delegate { LoveLab.queueFlask(e.currentEntity.beat, LoveLab.flaskHeart.fiveHeart); },
|
|
preFunctionLength = 1f,
|
|
defaultLength = 10f
|
|
}
|
|
}
|
|
//new List<string>() { "ntr", "normal" },
|
|
//"ntrlab", "en",
|
|
//new List<string>() { "en" }
|
|
);
|
|
}
|
|
}
|
|
}
|
|
|
|
namespace HeavenStudio.Games
|
|
{
|
|
using Jukebox;
|
|
using Scripts_LoveLab;
|
|
|
|
public class LoveLab : Minigame
|
|
{
|
|
public static LoveLab instance { get; set; }
|
|
|
|
[Header("Lab Guy")]
|
|
[SerializeField] private GameObject labGuy;
|
|
public Animator labGuyHead;
|
|
public GameObject labGuyArm;
|
|
|
|
[Header("Lab Girl")]
|
|
[SerializeField] private GameObject labGirl;
|
|
public Animator labGirlHead;
|
|
public GameObject labGirlArm;
|
|
|
|
[Header("Lab Weird")]
|
|
[SerializeField] private GameObject labAssistant;
|
|
[SerializeField] private Animator labAssistantHead;
|
|
public GameObject labAssistantArm;
|
|
|
|
[Header("Flask")]
|
|
public GameObject flask;
|
|
[SerializeField] private GameObject labFlaskObj;
|
|
public GameObject labGirlFlaskObj;
|
|
public ParticleSystem boyFlaskBreak;
|
|
public ParticleSystem girlFlaskBreak;
|
|
public Material flaskMatForBoy;
|
|
public Material flaskMatForGirl;
|
|
public Material flaskMatForWeird;
|
|
public Color boyLiquidColor = new Color(0.02909997f, 0.4054601f, 0.97f); //216, 97, 97 0868F8
|
|
public Color girlLiquidColor = new Color(0.81f, 0.2984211f, 0f); //22, 100, 81 CF4C00
|
|
public Color weirdLiquidColor = new Color(0.8313726f, 0.2039216f, 0.5058824f); //331, 75, 83 D43481
|
|
public SpriteRenderer flaskSpriteRend;
|
|
public SpriteRenderer girlFlaskSpriteRend;
|
|
public SpriteRenderer weirdFlaskSpriteRend;
|
|
|
|
[Header("Hearts")]
|
|
public List<heartDetails> reqHeartsContainer = new List<heartDetails>();
|
|
|
|
[Header("Misc")]
|
|
[SerializeField] GameObject heartBox;
|
|
[SerializeField] GameObject spotlightShader;
|
|
[SerializeField] GameObject spotlightShaderCone;
|
|
[SerializeField] GameObject spotlightCone;
|
|
[SerializeField] private GameObject labHeartBox;
|
|
[SerializeField] private Animator boxPerson;
|
|
[SerializeField] private Animator boxPersonDay;
|
|
[SerializeField] private GameObject heartContainer;
|
|
[SerializeField] GameObject labGuyFlask;
|
|
[SerializeField] GameObject labGirlFlask;
|
|
public static List<QueuedFlask> queuedFlask = new List<QueuedFlask>();
|
|
//public List<GameObject> boyInstantiatedFlask = new List<GameObject>(); //blank to boy
|
|
public List<LoveLabForGirlFlask> girlInstantiatedFlask = new List<LoveLabForGirlFlask>(); //boy to girl
|
|
public List<LoveLabForGirlFlask> weirdInstantiatedFlask = new List<LoveLabForGirlFlask>(); //girl to weird
|
|
|
|
[Header("Variables")]
|
|
public bool hasMissed = false;
|
|
private bool canBop = false;
|
|
public bool bopRight = false;
|
|
public bool isHoldingWhiff = false;
|
|
bool isHoldingWhiffAlt = false;
|
|
bool isHoldingWhiffPressed = false;
|
|
public bool canCallForFlask = true;
|
|
bool isDay = false;
|
|
bool hasStartedInterval;
|
|
bool isHolding;
|
|
int counter;
|
|
|
|
|
|
[Header("Clouds")]
|
|
[SerializeField] GameObject clouds;
|
|
public float cloudSpeed;
|
|
public float cloudDistance;
|
|
|
|
[Header("Time Of Day")]
|
|
[SerializeField] GameObject sunsetBG;
|
|
[SerializeField] GameObject dayBG;
|
|
[SerializeField] Material girlShader;
|
|
[SerializeField] GameObject girlHeaderShader;
|
|
[SerializeField] Material boyShader;
|
|
[SerializeField] GameObject boyHeaderShader;
|
|
[SerializeField] Material weirdShader;
|
|
[SerializeField] GameObject weirdHeaderShader;
|
|
|
|
//[Header("Hearts")]
|
|
//public List<Sprite> warningSprites = new List<Sprite>();
|
|
|
|
|
|
#region time of day
|
|
public enum timeOfDay
|
|
{
|
|
sunset,
|
|
day
|
|
}
|
|
|
|
public void defaultShaders()
|
|
{
|
|
sunsetBG.SetActive(true);
|
|
dayBG.SetActive(false);
|
|
|
|
//girl
|
|
girlShader.SetColor("_ColorAlpha", new Color(1f, 0.937255f, 0.3529412f)); // FFEF5A
|
|
girlShader.SetColor("_ColorBravo", new Color(0.01176471f, 0.7686275f, 0.2431373f)); // 03C43E
|
|
girlShader.SetColor("_ColorDelta", new Color(0.9960785f, 0.6588235f, 0.5176471f)); // FEA884
|
|
|
|
girlHeaderShader.SetActive(true);
|
|
|
|
//boy
|
|
boyShader.SetColor("_ColorAlpha", new Color(1f, 0.8392158f, 0.4196079f)); // FFD66B
|
|
boyShader.SetColor("_ColorBravo", new Color(0.6862745f, 0.4078432f, 0.4196079f)); // AF686B
|
|
boyShader.SetColor("_ColorDelta", new Color(0.8901961f, 0.4627451f, 0.2039216f)); // E37634
|
|
|
|
boyHeaderShader.SetActive(true);
|
|
|
|
//weird
|
|
weirdShader.SetColor("_ColorAlpha", new Color(0.9725491f, 0.7843138f, 0.4078432f)); // F8C868
|
|
weirdShader.SetColor("_ColorBravo", new Color(0.972549f, 0.7529412f, 0.03137255f)); // F8C008
|
|
weirdShader.SetColor("_ColorDelta", new Color(0.8941177f, 0.1882353f, 0f)); // E43000
|
|
|
|
weirdHeaderShader.SetActive(true);
|
|
|
|
isDay = false;
|
|
}
|
|
|
|
public void setTimeOfDay(int tod)
|
|
{
|
|
if(tod == (int)timeOfDay.sunset)
|
|
{
|
|
defaultShaders();
|
|
}
|
|
else
|
|
{
|
|
sunsetBG.SetActive(false);
|
|
dayBG.SetActive(true);
|
|
|
|
girlShader.SetColor("_ColorAlpha", new Color(0.8470589f, 0.9725491f, 0.8784314f)); //D8F8E0
|
|
girlShader.SetColor("_ColorBravo", new Color(0.01176471f, 0.7686275f, 0.2431373f)); //03C43E
|
|
girlShader.SetColor("_ColorDelta", new Color(0.9686275f, 0.7529413f, 0.654902f)); //F7C0A7
|
|
|
|
girlHeaderShader.SetActive(false);
|
|
|
|
boyShader.SetColor("_ColorAlpha", new Color(1f, 1f, 1f)); // FFFFFF
|
|
boyShader.SetColor("_ColorBravo", new Color(0.3921569f, 0.4039216f, 0.3921569f)); // 646764
|
|
boyShader.SetColor("_ColorDelta", new Color(0.9686275f, 0.7254902f, 0.5686275f)); // F7B991
|
|
|
|
boyHeaderShader.SetActive(false);
|
|
|
|
weirdShader.SetColor("_ColorAlpha", new Color(1f, 1f, 1f)); // FFFFFF
|
|
weirdShader.SetColor("_ColorBravo", new Color(0.754717f, 0.5786163f, 0f)); // C19400
|
|
weirdShader.SetColor("_ColorDelta", new Color(0.9686275f, 0.3803922f, 0.03137255f)); // F76108
|
|
|
|
weirdHeaderShader.SetActive(false);
|
|
|
|
isDay = true;
|
|
}
|
|
}
|
|
#endregion
|
|
|
|
#region intervals
|
|
public enum throwFlaskSpeedType
|
|
{
|
|
fastFlask,
|
|
slowFlask,
|
|
midSlowFlask
|
|
}
|
|
private struct queuedInterval
|
|
{
|
|
public double beat;
|
|
public float interval;
|
|
public bool autoPassTurn;
|
|
}
|
|
private static List<queuedInterval> queuedIntervals = new List<queuedInterval>();
|
|
|
|
public static void PreInterval(double beat, float interval, bool autoPassTurn)
|
|
{
|
|
if (GameManager.instance.currentGame == "loveLab")
|
|
{
|
|
instance.SetIntervalStart(beat, interval, beat, autoPassTurn);
|
|
}
|
|
else
|
|
{
|
|
queuedIntervals.Add(new queuedInterval
|
|
{
|
|
beat = beat,
|
|
interval = interval,
|
|
autoPassTurn = autoPassTurn
|
|
});
|
|
}
|
|
}
|
|
|
|
private void SetIntervalStart(double beat, float interval, double gameSwitchBeat, bool autoPassTurn)
|
|
{
|
|
List<RiqEntity> reqShakeEvents = GetAllSpeaksInBetweenBeat(beat, beat + interval);
|
|
reqShakeEvents.Sort((x, y) => x.beat.CompareTo(y.beat));
|
|
List<BeatAction.Action> queuedFlasks = new()
|
|
{
|
|
new BeatAction.Action(beat, delegate
|
|
{
|
|
//initial shakes
|
|
|
|
if (autoPassTurn)
|
|
{
|
|
//pass to girl
|
|
BoyPassToGirl(beat + interval, beat, beat + interval, 1, reqShakeEvents.Count);
|
|
}
|
|
})
|
|
};
|
|
for (int i = 0; i < reqShakeEvents.Count; i++)
|
|
{
|
|
RiqEntity shakeEventToCheck = reqShakeEvents[i];
|
|
if (shakeEventToCheck.beat >= gameSwitchBeat)
|
|
{
|
|
queuedFlasks.Add(new BeatAction.Action(shakeEventToCheck.beat, delegate
|
|
{
|
|
//lab boy shake
|
|
boyShake(shakeEventToCheck.beat, shakeEventToCheck.length, beat, beat + interval, shakeEventToCheck["speed"]);
|
|
}));
|
|
}
|
|
}
|
|
BeatAction.New(this, queuedFlasks);
|
|
}
|
|
|
|
private List<RiqEntity> GetAllSpeaksInBetweenBeat(double beat, double endBeat)
|
|
{
|
|
List<RiqEntity> speakEvents = EventCaller.GetAllInGameManagerList("loveLab", new string[] { "boy shakes" });
|
|
List<RiqEntity> tempEvents = new();
|
|
|
|
foreach (var entity in speakEvents)
|
|
{
|
|
if (entity.beat >= beat && entity.beat < endBeat)
|
|
{
|
|
tempEvents.Add(entity);
|
|
}
|
|
}
|
|
return tempEvents;
|
|
}
|
|
|
|
private void boyShake(double beat, double length, double firstBeatOfInterval, double lastBeatOfInterval, int speedType)
|
|
{
|
|
//debug stuff
|
|
//Debug.LogWarning("Beat: " + beat);
|
|
//Debug.LogWarning("Length: " + (beat + length));
|
|
//Debug.LogWarning("First Beat: " + firstBeatOfInterval);
|
|
//Debug.LogWarning("Last Beat: " + lastBeatOfInterval);
|
|
//Debug.LogWarning("Speed Type: " + speedType);
|
|
|
|
BeatAction.New(instance, new List<BeatAction.Action>()
|
|
{
|
|
new BeatAction.Action(beat, delegate {
|
|
|
|
labGuyHead.DoScaledAnimationAsync("GuyRightFace");
|
|
BeatAction.New(instance, new List<BeatAction.Action>()
|
|
{
|
|
new BeatAction.Action(beat + .5f, delegate
|
|
{
|
|
labGirlHead.Play("GirlLeftFace");
|
|
})
|
|
});
|
|
if (!hasStartedInterval)
|
|
{
|
|
SoundByte.PlayOneShotGame("loveLab/LeftCatch", beat, forcePlay: true);
|
|
labGuyArm.GetComponent<Animator>().Play("GrabFlask");
|
|
hasStartedInterval = true;
|
|
spawnCustomFlask(beat);
|
|
}
|
|
else if(beat > firstBeatOfInterval)
|
|
{
|
|
SoundByte.PlayOneShotGame("loveLab/shakeDown");
|
|
labGuyArm.GetComponent<Animator>().Play("ShakeFlaskDown");
|
|
}
|
|
}),
|
|
|
|
new BeatAction.Action(beat + length, delegate {
|
|
if(lastBeatOfInterval > beat + length)
|
|
{
|
|
SoundByte.PlayOneShotGame("loveLab/shakeUp");
|
|
labGuyArm.GetComponent<Animator>().Play("ShakeFlaskUp");
|
|
}
|
|
else
|
|
{
|
|
SoundByte.PlayOneShotGame("loveLab/leftThrow");
|
|
labGuyArm.GetComponent<Animator>().Play("ThrowFlask");
|
|
spawnFlaskForGirlCustom((beat + length) + 1f, speedType);
|
|
}
|
|
}),
|
|
|
|
|
|
});
|
|
}
|
|
|
|
private void BoyPassToGirl(double beat, double intervalBeat, double endBeat, float length, int counter)
|
|
{
|
|
var inputs = GetAllSpeaksInBetweenBeat(intervalBeat, endBeat);
|
|
inputs.Sort((x, y) => x.beat.CompareTo(y.beat));
|
|
this.counter = counter;
|
|
for (int i = 0; i < inputs.Count; i++)
|
|
{
|
|
var input = inputs[i];
|
|
double relativeBeat = input.beat - intervalBeat;
|
|
double testBeat = (input.beat + input.length) - intervalBeat;
|
|
if(i == 0)
|
|
{
|
|
inputs[0]["speed"] = inputs[inputs.Count - 1]["speed"];
|
|
|
|
if(inputs[i]["speed"] == 0)
|
|
{
|
|
ScheduleInput(beat, length + relativeBeat, InputAction_Nrm, onCatch, onMiss, onEmpty);
|
|
}
|
|
else
|
|
{
|
|
ScheduleInput(beat, (length + relativeBeat) + 1f, InputAction_Nrm, onCatch, onMiss, onEmpty);
|
|
}
|
|
}
|
|
else
|
|
{
|
|
ScheduleInput(beat, length + relativeBeat, InputAction_Nrm, onCatch, onMiss, onEmpty);
|
|
}
|
|
|
|
if ((inputs[i].beat + inputs[i].length) == endBeat)
|
|
{
|
|
ScheduleInput(beat, (length + testBeat), InputAction_DPad, onRelease, onMiss, onEmpty);
|
|
}
|
|
else
|
|
{
|
|
ScheduleAutoplayInput(beat, (length + testBeat), InputAction_DPad, onUpAuto, onMiss, onEmpty);
|
|
}
|
|
|
|
}
|
|
BeatAction.New(this, new List<BeatAction.Action>()
|
|
{
|
|
new BeatAction.Action(beat, delegate
|
|
{
|
|
hasMissed = false;
|
|
|
|
}),
|
|
new BeatAction.Action(endBeat + 1f, delegate
|
|
{
|
|
labGuyHead.Play("GuyFaceIdle");
|
|
if (labGuyArm.GetComponent<Animator>().IsAnimationNotPlaying())
|
|
{
|
|
labGuyArm.GetComponent<Animator>().Play("ArmIdle");
|
|
}
|
|
})
|
|
});
|
|
}
|
|
|
|
public static void onCatch(PlayerActionEvent caller, float beat)
|
|
{
|
|
instance.labGirlHead.Play("GirlIdleFace");
|
|
if (!instance.isHolding)
|
|
{
|
|
instance.isHolding = true;
|
|
SoundByte.PlayOneShotGame("loveLab/RightCatch");
|
|
instance.labGirlArm.GetComponent<Animator>().DoScaledAnimationAsync("GrabFlask");
|
|
LoveLab.instance.girlInstantiatedFlask[0].GetComponent<LoveLabForGirlFlask>().destroyThisObj();
|
|
}
|
|
|
|
else if(instance.counter > 1 && instance.isHolding)
|
|
{
|
|
SoundByte.PlayOneShotGame("loveLab/shakeDown");
|
|
instance.labGirlArm.GetComponent<Animator>().DoScaledAnimationAsync("ShakeFlaskDown");
|
|
}
|
|
|
|
}
|
|
|
|
public static void onUpAuto(PlayerActionEvent caller, float beat)
|
|
{
|
|
SoundByte.PlayOneShotGame("loveLab/shakeUp");
|
|
instance.labGirlArm.GetComponent<Animator>().DoScaledAnimationAsync("ShakeFlaskUp");
|
|
}
|
|
|
|
public static void onRelease(PlayerActionEvent caller, float beat)
|
|
{
|
|
instance.labGirlHead.DoScaledAnimationAsync("GirlIdleFace");
|
|
SoundByte.PlayOneShotGame("loveLab/rightThrowNoShake");
|
|
instance.labGirlArm.GetComponent<Animator>().DoScaledAnimationAsync("ThrowFlask");
|
|
|
|
BeatAction.New(instance, new List<BeatAction.Action>()
|
|
{
|
|
new BeatAction.Action((caller.startBeat + caller.timer) + 1f, delegate
|
|
{
|
|
instance.labGirlHead.Play("GirlIdleFace");
|
|
if (instance.labGirlArm.GetComponent<Animator>().IsAnimationNotPlaying())
|
|
{
|
|
instance.labGirlArm.GetComponent<Animator>().Play("ArmIdle");
|
|
}
|
|
})
|
|
});
|
|
}
|
|
|
|
public void onDownFlaskCustom()
|
|
{
|
|
SoundByte.PlayOneShotGame("loveLab/shakeDown");
|
|
labGirlArm.GetComponent<Animator>().DoScaledAnimationAsync("ShakeFlaskDown");
|
|
}
|
|
|
|
public void spawnFlaskForGirlCustom(double beat, int flaskHeart) //boy to girl
|
|
{
|
|
//flaskMatForBoy.SetColor("_ColorAlpha", instance.boyLiquidColor);
|
|
LoveLabForGirlFlask spawnedFlask = Instantiate(labFlaskObj, instance.transform).AddComponent<LoveLabForGirlFlask>();
|
|
|
|
switch (flaskHeart)
|
|
{
|
|
case 0:
|
|
spawnedFlask.FastInit(beat);
|
|
break;
|
|
case 1:
|
|
spawnedFlask.SlowInit(beat);
|
|
break;
|
|
case 2:
|
|
spawnedFlask.MidSlowInit(beat);
|
|
break;
|
|
}
|
|
|
|
girlInstantiatedFlask.Add(spawnedFlask.GetComponent<LoveLabForGirlFlask>());
|
|
}
|
|
|
|
public void spawnCustomFlask(double beat) //wall to boy
|
|
{
|
|
LoveLabFlask spawnedFlask = Instantiate(labFlaskObj, instance.transform).AddComponent<LoveLabFlask>();
|
|
spawnedFlask.customShakes(beat);
|
|
}
|
|
#endregion
|
|
|
|
//make a smooth transition to day to sunset and vice versa
|
|
|
|
/*
|
|
* would be nice if there were visual warnings for the next game
|
|
* head of dj and student for the hearts
|
|
* balls of munchy monk
|
|
* fruits for catchy tune
|
|
* balls for double date
|
|
* pots for karate man
|
|
* shuttlecock for air rally
|
|
* farmer head for second contact
|
|
* etc.
|
|
*
|
|
*/
|
|
|
|
/*
|
|
* lovelabflask script
|
|
* ask for how many flask
|
|
*
|
|
*
|
|
* for catchFunctions
|
|
*/
|
|
|
|
/* generic's girl blush logic
|
|
* during shake down girl will look at guy
|
|
* before the end of the shakedown (.5f) girl goes idle look
|
|
*
|
|
* original girl blush logic
|
|
* random blushes and/or force a look blush
|
|
*/
|
|
|
|
/*
|
|
* particle effect
|
|
* when someone grabs a flask do an arc with either 2/3/4 hearts popping both left and right
|
|
*
|
|
*/
|
|
|
|
/*
|
|
* box guy
|
|
* sleeves are not tinted for sunset
|
|
*
|
|
*/
|
|
|
|
[SerializeField] SuperCurveObject.Path[] flaskBouncePath;
|
|
|
|
public void spotlight(bool active, int whichType, int whichPos)
|
|
{
|
|
if(active == true)
|
|
{
|
|
if (whichType == (int)spotlightType.normal)
|
|
{
|
|
spotlightShader.SetActive(true);
|
|
spotlightShaderCone.SetActive(false);
|
|
}
|
|
else
|
|
{
|
|
spotlightShader.SetActive(false);
|
|
spotlightShaderCone.SetActive(true);
|
|
|
|
if (whichPos == (int)spotlightPos.boy)
|
|
{
|
|
spotlightCone.transform.position = new Vector2(0, 0);
|
|
}
|
|
else
|
|
{
|
|
spotlightCone.transform.position = new Vector2(5f, 0);
|
|
}
|
|
}
|
|
}
|
|
else
|
|
{
|
|
spotlightShader.SetActive(false);
|
|
spotlightShaderCone.SetActive(false);
|
|
}
|
|
}
|
|
|
|
public enum spotlightType
|
|
{
|
|
normal,
|
|
cone
|
|
}
|
|
|
|
public enum spotlightPos
|
|
{
|
|
boy,
|
|
girl
|
|
}
|
|
|
|
|
|
public void UpdateMaterialColor(Color liquidCol, Color liquid2Col, Color liquid3Col)
|
|
{
|
|
boyLiquidColor = liquidCol;
|
|
girlLiquidColor = liquid2Col;
|
|
weirdLiquidColor = liquid3Col;
|
|
|
|
LoveLab.instance.flaskMatForBoy.SetColor("_ColorAlpha", boyLiquidColor);
|
|
LoveLab.instance.flaskMatForGirl.SetColor("_ColorAlpha", girlLiquidColor);
|
|
LoveLab.instance.flaskMatForWeird.SetColor("_ColorAlpha", weirdLiquidColor);
|
|
}
|
|
|
|
public override void OnGameSwitch(double beat)
|
|
{
|
|
preChecks(beat);
|
|
}
|
|
|
|
public override void OnPlay(double beat)
|
|
{
|
|
preChecks(beat);
|
|
queuedFlask.Clear();
|
|
}
|
|
|
|
private void OnDestroy()
|
|
{
|
|
//preChecks(0f);
|
|
queuedFlask.Clear();
|
|
//destroyAllFlasks();
|
|
foreach (var evt in scheduledInputs)
|
|
{
|
|
evt.Disable();
|
|
}
|
|
}
|
|
|
|
//private void destroyAllFlasks()
|
|
//{
|
|
// foreach(LoveLabForGirlFlask girl in girlInstantiatedFlask)
|
|
// {
|
|
// Destroy(girl);
|
|
// }
|
|
// girlInstantiatedFlask.Clear();
|
|
|
|
// foreach (LoveLabForGirlFlask weird in weirdInstantiatedFlask)
|
|
// {
|
|
// Destroy(weird);
|
|
// }
|
|
// weirdInstantiatedFlask.Clear();
|
|
//}
|
|
|
|
void preChecks(double beat)
|
|
{
|
|
List<RiqEntity> prevEntities = GameManager.instance.Beatmap.Entities.FindAll(c => c.datamodel.Split(0) == "loveLab");
|
|
RiqEntity obj = prevEntities.FindLast(c => c.beat <= beat && c.datamodel == "loveLab/set object colors");
|
|
|
|
if (obj != null)
|
|
{
|
|
UpdateMaterialColor(obj["colorA"], obj["colorB"], obj["colorC"]);
|
|
}
|
|
else
|
|
{
|
|
UpdateMaterialColor(new Color(0.02909997f, 0.4054601f, 0.97f), new Color(0.81f, 0.2984211f, 0f), new Color(0.8313726f, 0.2039216f, 0.5058824f));
|
|
}
|
|
|
|
defaultShaders();
|
|
|
|
//try
|
|
//{
|
|
// RiqEntity obj2 = prevEntities.FindLast(c => c.beat <= beat && c.datamodel == "loveLab/bop");
|
|
|
|
// if (obj2 != null)
|
|
// {
|
|
// Bop(obj2.beat, obj2.length, obj2["toggle"], obj2["toggle2"]);
|
|
// }
|
|
// else
|
|
// {
|
|
// Bop(0, 0, false, false);
|
|
// }
|
|
//}
|
|
//catch { }
|
|
}
|
|
|
|
|
|
#region IA
|
|
const int IA_AltPress = IAMAXCAT;
|
|
protected static bool IA_TouchNrmPress(out double dt)
|
|
{
|
|
return PlayerInput.GetTouchDown(InputController.ActionsTouch.Tap, out dt)
|
|
&& !instance.IsExpectingInputNow(InputAction_Alt);
|
|
}
|
|
|
|
protected static bool IA_PadAnyDown(out double dt)
|
|
{
|
|
return PlayerInput.GetPadDown(InputController.ActionsPad.Up, out dt)
|
|
|| PlayerInput.GetPadDown(InputController.ActionsPad.Down, out dt)
|
|
|| PlayerInput.GetPadDown(InputController.ActionsPad.Left, out dt)
|
|
|| PlayerInput.GetPadDown(InputController.ActionsPad.Right, out dt);
|
|
}
|
|
|
|
protected static bool IA_PadNorthDown(out double dt)
|
|
{
|
|
dt = 0;
|
|
return PlayerInput.GetPadDown(InputController.ActionsPad.Up);
|
|
}
|
|
|
|
protected static bool IA_PadSouthDown(out double dt)
|
|
{
|
|
dt = 0;
|
|
return PlayerInput.GetPadDown(InputController.ActionsPad.Down);
|
|
}
|
|
|
|
//make a down and up stuff for shake
|
|
|
|
protected static bool IA_PadAltPress(out double dt)
|
|
{
|
|
return PlayerInput.GetPadDown(InputController.ActionsPad.South, out dt);
|
|
}
|
|
protected static bool IA_BatonAltPress(out double dt)
|
|
{
|
|
return PlayerInput.GetSqueezeDown(out dt);
|
|
}
|
|
protected static bool IA_TouchAltPress(out double dt)
|
|
{
|
|
return PlayerInput.GetTouchDown(InputController.ActionsTouch.Tap, out dt)
|
|
&& instance.IsExpectingInputNow(InputAction_Alt);
|
|
}
|
|
|
|
protected static bool IA_PadAltPressing(out double dt)
|
|
{
|
|
dt = 0;
|
|
return PlayerInput.GetPad(InputController.ActionsPad.South);
|
|
}
|
|
protected static bool IA_TouchAltPressing(out double dt)
|
|
{
|
|
dt = 0;
|
|
return PlayerInput.GetTouch(InputController.ActionsTouch.Tap);
|
|
}
|
|
protected static bool IA_BatonAltPressing(out double dt)
|
|
{
|
|
dt = 0;
|
|
return PlayerInput.GetBaton(InputController.ActionsBaton.Face);
|
|
}
|
|
|
|
public static PlayerInput.InputAction InputAction_Nrm =
|
|
new("NtrLabAlt", new int[] { IAPressCat, IAPressCat, IAPressCat },
|
|
IA_PadBasicPress, IA_TouchNrmPress, IA_BatonBasicPress);
|
|
public static PlayerInput.InputAction InputAction_Alt =
|
|
new("NtrLabAlt", new int[] { IA_AltPress, IA_AltPress, IA_AltPress },
|
|
IA_PadAltPress, IA_TouchAltPress, IA_BatonAltPress);
|
|
public static PlayerInput.InputAction InputAction_AltPressing =
|
|
new("NtrLabAlt", new int[] { IA_AltPress, IA_AltPress, IA_AltPress },
|
|
IA_PadAltPressing, IA_TouchAltPressing, IA_BatonAltPressing);
|
|
public static PlayerInput.InputAction InputAction_DPad =
|
|
new("NtrLabAlt", new int[] { IAPressCat, IAPressCat, IAPressCat },
|
|
IA_PadAnyDown, IA_TouchNrmPress, IA_BatonBasicPress);
|
|
|
|
public static PlayerInput.InputAction InputAction_DPadNorth =
|
|
new("NtrLabAlt", new int[] { IAPressCat, IAPressCat, IAPressCat },
|
|
IA_PadNorthDown, IA_TouchNrmPress, IA_BatonBasicPress);
|
|
public static PlayerInput.InputAction InputAction_DPadSouth =
|
|
new("NtrLabAlt", new int[] { IAPressCat, IAPressCat, IAPressCat },
|
|
IA_PadSouthDown, IA_TouchNrmPress, IA_BatonBasicPress);
|
|
|
|
#endregion
|
|
|
|
private void Awake()
|
|
{
|
|
instance = this;
|
|
|
|
labGuyHead.DoScaledAnimation("GuyFaceIdle", 1f);
|
|
labAssistantHead.DoScaledAnimation("WeirdFaceIdle", 1f);
|
|
|
|
flaskSpriteRend.material = flaskMatForBoy;
|
|
girlFlaskSpriteRend.material = flaskMatForGirl;
|
|
weirdFlaskSpriteRend.material = flaskMatForWeird;
|
|
}
|
|
|
|
private void Start()
|
|
{
|
|
clouds.transform.position = Vector3.left * ((Time.realtimeSinceStartup * cloudSpeed) % cloudDistance);
|
|
}
|
|
|
|
// Editor gizmo to draw trajectories
|
|
new void OnDrawGizmos()
|
|
{
|
|
base.OnDrawGizmos();
|
|
foreach (SuperCurveObject.Path path in flaskBouncePath)
|
|
{
|
|
if (path.preview)
|
|
{
|
|
try
|
|
{
|
|
labFlaskObj.GetComponent<LoveLabFlask>().DrawEditorGizmo(path);
|
|
}
|
|
catch { }
|
|
}
|
|
}
|
|
}
|
|
|
|
public SuperCurveObject.Path GetPath(string name)
|
|
{
|
|
foreach (SuperCurveObject.Path path in flaskBouncePath)
|
|
{
|
|
if (path.name == name)
|
|
{
|
|
return path;
|
|
}
|
|
}
|
|
return default(SuperCurveObject.Path);
|
|
}
|
|
|
|
#region Spawn Flasks
|
|
public enum flaskHeart
|
|
{
|
|
oneHeart,
|
|
oneOffHeart,
|
|
twoHeart,
|
|
threeHeart,
|
|
fiveHeart
|
|
}
|
|
|
|
public struct QueuedFlask //for the offscreen stuff
|
|
{
|
|
public double beat;
|
|
public flaskHeart type;
|
|
}
|
|
|
|
public struct heartDetails
|
|
{
|
|
public flaskHeart heartType;
|
|
public int heartCounter;
|
|
}
|
|
|
|
|
|
public void spawnFlask(double beat, flaskHeart flaskHeart) //wall to boy
|
|
{
|
|
//flaskMatForBoy.SetColor("_ColorAlpha", instance.boyLiquidColor);
|
|
LoveLabFlask spawnedFlask = Instantiate(labFlaskObj, instance.transform).AddComponent<LoveLabFlask>();
|
|
|
|
switch (flaskHeart)
|
|
{
|
|
case flaskHeart.oneHeart:
|
|
spawnedFlask.Init(beat);
|
|
break;
|
|
case flaskHeart.oneOffHeart:
|
|
spawnedFlask.offBeat(beat);
|
|
break;
|
|
case flaskHeart.twoHeart:
|
|
spawnedFlask.twoHeart(beat);
|
|
break;
|
|
case flaskHeart.threeHeart:
|
|
spawnedFlask.threeHeart(beat);
|
|
break;
|
|
case flaskHeart.fiveHeart:
|
|
spawnedFlask.fiveHeart(beat);
|
|
break;
|
|
}
|
|
}
|
|
|
|
public void spawnFlaskForGirl(double beat, flaskHeart flaskHeart) //boy to girl
|
|
{
|
|
//flaskMatForBoy.SetColor("_ColorAlpha", instance.boyLiquidColor);
|
|
LoveLabForGirlFlask spawnedFlask = Instantiate(labFlaskObj, instance.transform).AddComponent<LoveLabForGirlFlask>();
|
|
|
|
switch (flaskHeart)
|
|
{
|
|
case flaskHeart.oneHeart:
|
|
spawnedFlask.heartType = flaskHeart.oneHeart;
|
|
spawnedFlask.FastInit(beat);
|
|
break;
|
|
case flaskHeart.oneOffHeart:
|
|
spawnedFlask.heartType = flaskHeart.oneOffHeart;
|
|
spawnedFlask.MidSlowInit(beat);
|
|
break;
|
|
case flaskHeart.twoHeart:
|
|
spawnedFlask.heartType = flaskHeart.twoHeart;
|
|
spawnedFlask.FastInit(beat);
|
|
break;
|
|
case flaskHeart.threeHeart:
|
|
spawnedFlask.heartType = flaskHeart.threeHeart;
|
|
spawnedFlask.SlowInit(beat);
|
|
break;
|
|
case flaskHeart.fiveHeart:
|
|
spawnedFlask.heartType = flaskHeart.fiveHeart;
|
|
spawnedFlask.FastInit(beat);
|
|
break;
|
|
}
|
|
|
|
girlInstantiatedFlask.Add(spawnedFlask.GetComponent<LoveLabForGirlFlask>());
|
|
}
|
|
|
|
public void spawnFlaskForWeird(double beat)
|
|
{
|
|
LoveLabForGirlFlask spawnedFlask = Instantiate(labGirlFlaskObj, instance.transform).AddComponent<LoveLabForGirlFlask>();
|
|
spawnedFlask.ForWeirdInit(beat + 1f);
|
|
weirdInstantiatedFlask.Add(spawnedFlask.GetComponent<LoveLabForGirlFlask>());
|
|
}
|
|
|
|
public static void queueFlask(double beat, flaskHeart flaskHeart)
|
|
{
|
|
//if (!instance.canCallForFlask) return;
|
|
|
|
if (GameManager.instance.currentGame != "loveLab")
|
|
{
|
|
queuedFlask.Add(new QueuedFlask()
|
|
{
|
|
beat = beat,
|
|
type = flaskHeart
|
|
});
|
|
}
|
|
else
|
|
{
|
|
instance.spawnFlask(beat, flaskHeart);
|
|
}
|
|
SoundByte.PlayOneShotGame("loveLab/LeftCatch", beat, forcePlay: true);
|
|
}
|
|
|
|
|
|
|
|
#endregion
|
|
|
|
private void Update()
|
|
{
|
|
var cond = Conductor.instance;
|
|
var songPos = cond.songPositionInBeatsAsDouble;
|
|
|
|
if (!cond.isPlaying)
|
|
{
|
|
preChecks(songPos);
|
|
}
|
|
|
|
if (cond.isPlaying && !cond.isPaused)
|
|
{
|
|
if (queuedFlask.Count != 0)
|
|
{
|
|
foreach (QueuedFlask flask in queuedFlask)
|
|
{
|
|
switch (flask.type)
|
|
{
|
|
case flaskHeart.oneHeart:
|
|
spawnFlask(flask.beat, flaskHeart.oneHeart);
|
|
break;
|
|
case flaskHeart.oneOffHeart:
|
|
spawnFlask(flask.beat, flaskHeart.oneOffHeart);
|
|
break;
|
|
case flaskHeart.twoHeart:
|
|
spawnFlask(flask.beat, flaskHeart.twoHeart);
|
|
break;
|
|
case flaskHeart.threeHeart:
|
|
spawnFlask(flask.beat, flaskHeart.threeHeart);
|
|
break;
|
|
case flaskHeart.fiveHeart:
|
|
spawnFlask(flask.beat, flaskHeart.fiveHeart);
|
|
break;
|
|
//case flaskHeart.customHeart:
|
|
// spawnFlask(flask.beat, flaskHeart.customHeart);
|
|
// break;
|
|
}
|
|
}
|
|
queuedFlask.Clear();
|
|
}
|
|
}
|
|
else
|
|
{
|
|
if ((!cond.isPaused) && queuedFlask.Count != 0)
|
|
{
|
|
queuedFlask.Clear();
|
|
}
|
|
}
|
|
|
|
#region whiff grab
|
|
if (PlayerInput.GetIsAction(InputAction_BasicPress) && !IsExpectingInputNow(InputAction_BasicPressing) && !isHoldingWhiff)
|
|
{
|
|
labGirlArm.GetComponent<Animator>().DoScaledAnimationAsync("WhiffGrab");
|
|
isHoldingWhiff = true;
|
|
}
|
|
else if (PlayerInput.GetIsAction(InputAction_BasicRelease) && !IsExpectingInputNow(InputAction_BasicRelease))
|
|
{
|
|
labGirlArm.GetComponent<Animator>().DoScaledAnimationAsync("ArmIdle");
|
|
isHoldingWhiff = false;
|
|
}
|
|
|
|
#endregion
|
|
|
|
#region whiff up and down
|
|
if (PlayerInput.GetIsAction(InputAction_DPadNorth) && !IsExpectingInputNow(InputAction_DPad) && isHoldingWhiff && !isHoldingWhiffAlt)
|
|
{
|
|
Debug.LogWarning("check one north");
|
|
onWhiffUp();
|
|
isHoldingWhiffAlt = true;
|
|
}
|
|
else if(PlayerInput.GetIsAction(InputAction_DPadSouth) && !IsExpectingInputNow(InputAction_DPad) && isHoldingWhiff && !isHoldingWhiffAlt)
|
|
{
|
|
Debug.LogWarning("check one north");
|
|
isHoldingWhiffAlt = true;
|
|
onWhiffDown();
|
|
}
|
|
else
|
|
{
|
|
isHoldingWhiffAlt = false;
|
|
}
|
|
//else
|
|
//{
|
|
// isHoldingWhiffPressed = false;
|
|
//}
|
|
|
|
//if (isHoldingWhiffAlt && isHoldingWhiff && !isHoldingWhiffPressed && labGirlArm.GetComponent<Animator>().IsAnimationNotPlaying())
|
|
//{
|
|
// labGirlArm.GetComponent<Animator>().DoNormalizedAnimation("WhiffUp");
|
|
//}
|
|
//else if(isHoldingWhiffAlt && isHoldingWhiff && isHoldingWhiffPressed && labGirlArm.GetComponent<Animator>().IsAnimationNotPlaying())
|
|
//{
|
|
// labGirlArm.GetComponent<Animator>().DoNormalizedAnimation("WhiffDown");
|
|
//}
|
|
#endregion
|
|
|
|
clouds.transform.position = Vector3.left * ((Time.realtimeSinceStartup * cloudSpeed) % cloudDistance);
|
|
}
|
|
|
|
#region Bops
|
|
public void Bop(double beat, float length, bool bop, bool autoBop)
|
|
{
|
|
if (bop)
|
|
{
|
|
for (int i = 0; i < length; i++)
|
|
{
|
|
BeatAction.New(instance, new List<BeatAction.Action>()
|
|
{
|
|
new BeatAction.Action(beat + i, delegate
|
|
{
|
|
if (!bopRight && labGuy.GetComponent<Animator>().IsAnimationNotPlaying())
|
|
{
|
|
labGuy.GetComponent<Animator>().DoScaledAnimationAsync("GuyBopRight", .5f);
|
|
labGirl.GetComponent<Animator>().DoScaledAnimationAsync("GirlBopRight", .5f);
|
|
labAssistant.GetComponent<Animator>().DoScaledAnimationAsync("AssistantBopRight", .5f);
|
|
}
|
|
else
|
|
{
|
|
labGuy.GetComponent<Animator>().DoScaledAnimationAsync("GuyBopLeft", .5f);
|
|
labGirl.GetComponent<Animator>().DoScaledAnimationAsync("GirlBopLeft", .5f);
|
|
labAssistant.GetComponent<Animator>().DoScaledAnimationAsync("AssistantBopLeft", .5f);
|
|
}
|
|
bopRight = !bopRight;
|
|
})
|
|
});
|
|
}
|
|
}
|
|
if (autoBop)
|
|
{
|
|
ToggleBop(true);
|
|
}
|
|
else
|
|
{
|
|
ToggleBop(false);
|
|
}
|
|
}
|
|
|
|
public override void OnBeatPulse(double beat)
|
|
{
|
|
if (BeatIsInBopRegion(beat)) SingleBop();
|
|
}
|
|
|
|
public void ToggleBop(bool go)
|
|
{
|
|
canBop = go;
|
|
}
|
|
|
|
void SingleBop()
|
|
{
|
|
if (canBop)
|
|
{
|
|
if (!bopRight && labGuy.GetComponent<Animator>().IsAnimationNotPlaying())
|
|
{
|
|
labGuy.GetComponent<Animator>().DoScaledAnimationAsync("GuyBopRight", .5f);
|
|
labGirl.GetComponent<Animator>().DoScaledAnimationAsync("GirlBopRight", .5f);
|
|
labAssistant.GetComponent<Animator>().DoScaledAnimationAsync("AssistantBopRight", .5f);
|
|
}
|
|
else
|
|
{
|
|
labGuy.GetComponent<Animator>().DoScaledAnimationAsync("GuyBopLeft", .5f);
|
|
labGirl.GetComponent<Animator>().DoScaledAnimationAsync("GirlBopLeft", .5f);
|
|
labAssistant.GetComponent<Animator>().DoScaledAnimationAsync("AssistantBopLeft", .5f);
|
|
}
|
|
bopRight = !bopRight;
|
|
}
|
|
}
|
|
|
|
#endregion
|
|
|
|
#region Box Guy
|
|
|
|
public enum boxGuyAction
|
|
{
|
|
takeAway,
|
|
putBack,
|
|
noBox,
|
|
instaBox
|
|
}
|
|
|
|
public void mainBoxGuy(double beat, int reqAction)
|
|
{
|
|
Animator box;
|
|
|
|
if (!isDay)
|
|
{
|
|
box = boxPerson;
|
|
}
|
|
else
|
|
{
|
|
box = boxPersonDay;
|
|
}
|
|
|
|
switch (reqAction)
|
|
{
|
|
case 0:
|
|
box.DoScaledAnimationAsync("BoxTakeAway", .5f);
|
|
break;
|
|
case 1:
|
|
box.DoScaledAnimationAsync("BoxPutBack", .5f);
|
|
break;
|
|
case 2:
|
|
box.DoScaledAnimationAsync("NoBox", 0f);
|
|
break;
|
|
case 3:
|
|
box.DoScaledAnimationAsync("BoxIdle", 0f);
|
|
break;
|
|
default:
|
|
box.DoScaledAnimationAsync("BoxTakeAway", .5f);
|
|
break;
|
|
}
|
|
}
|
|
|
|
|
|
#endregion
|
|
|
|
#region Release Throws
|
|
public static void onReleaseThrow(PlayerActionEvent caller, float beat)
|
|
{
|
|
if (instance.hasMissed) return;
|
|
|
|
instance.flaskMatForGirl.SetColor("_ColorAlpha", instance.girlLiquidColor);
|
|
instance.labGuyHead.DoScaledAnimationAsync("GuyFaceIdle");
|
|
BeatAction.New(instance, new List<BeatAction.Action>()
|
|
{
|
|
new BeatAction.Action(caller.startBeat, delegate
|
|
{
|
|
instance.labGirlHead.DoScaledAnimationAsync("GirlIdleFace");
|
|
SoundByte.PlayOneShotGame("loveLab/rightThrowNoShake");
|
|
instance.labGirlArm.GetComponent<Animator>().DoScaledAnimationAsync("ThrowFlask");
|
|
|
|
instance.spawnFlaskForWeird((caller.startBeat + caller.timer));
|
|
}),
|
|
|
|
new BeatAction.Action(caller.startBeat + 4f, delegate
|
|
{
|
|
SoundByte.PlayOneShotGame("loveLab/heartsCombine");
|
|
if (instance.labGirlArm.GetComponent<Animator>().IsAnimationNotPlaying())
|
|
{
|
|
instance.labGirlArm.GetComponent<Animator>().DoScaledAnimationAsync("ArmIdle");
|
|
}
|
|
}),
|
|
|
|
new BeatAction.Action(caller.startBeat + 5.25f, delegate
|
|
{
|
|
SoundByte.PlayOneShotGame("loveLab/bagHeartLast");
|
|
instance.heartBox.GetComponent<Animator>().DoScaledAnimationAsync("HeartBoxSquish");
|
|
}),
|
|
});
|
|
}
|
|
|
|
public static void onReleaseOffThrow(PlayerActionEvent caller, float beat)
|
|
{
|
|
if (instance.hasMissed) return;
|
|
|
|
instance.labGuyHead.DoScaledAnimationAsync("GuyFaceIdle");
|
|
BeatAction.New(instance, new List<BeatAction.Action>()
|
|
{
|
|
new BeatAction.Action(caller.startBeat, delegate
|
|
{
|
|
instance.labGirlHead.DoScaledAnimationAsync("GirlIdleFace");
|
|
SoundByte.PlayOneShotGame("loveLab/rightThrowNoShake");
|
|
instance.labGirlArm.GetComponent<Animator>().DoScaledAnimationAsync("ThrowFlask");
|
|
|
|
instance.spawnFlaskForWeird((caller.startBeat + caller.timer));
|
|
}),
|
|
|
|
new BeatAction.Action(caller.startBeat + 3.5f, delegate
|
|
{
|
|
SoundByte.PlayOneShotGame("loveLab/heartsCombine");
|
|
if (instance.labGirlArm.GetComponent<Animator>().IsAnimationNotPlaying())
|
|
{
|
|
instance.labGirlArm.GetComponent<Animator>().DoScaledAnimationAsync("ArmIdle");
|
|
}
|
|
}),
|
|
|
|
new BeatAction.Action(caller.startBeat + 4.75f, delegate
|
|
{
|
|
SoundByte.PlayOneShotGame("loveLab/bagHeartLast");
|
|
instance.heartBox.GetComponent<Animator>().DoScaledAnimationAsync("HeartBoxSquish");
|
|
}),
|
|
});
|
|
}
|
|
|
|
public static void onRelease2Throw(PlayerActionEvent caller, float beat)
|
|
{
|
|
if (instance.hasMissed) return;
|
|
|
|
instance.labGuyHead.DoScaledAnimationAsync("GuyFaceIdle");
|
|
BeatAction.New(instance, new List<BeatAction.Action>()
|
|
{
|
|
new BeatAction.Action(caller.startBeat, delegate
|
|
{
|
|
instance.labGirlHead.DoScaledAnimationAsync("GirlIdleFace");
|
|
SoundByte.PlayOneShotGame("loveLab/rightThrowNoShake");
|
|
instance.labGirlArm.GetComponent<Animator>().DoScaledAnimationAsync("ThrowFlask");
|
|
|
|
instance.spawnFlaskForWeird((caller.startBeat + caller.timer));
|
|
}),
|
|
|
|
|
|
new BeatAction.Action(caller.startBeat + 4f, delegate
|
|
{
|
|
SoundByte.PlayOneShotGame("loveLab/heartsCombine");
|
|
if (instance.labGirlArm.GetComponent<Animator>().IsAnimationNotPlaying())
|
|
{
|
|
instance.labGirlArm.GetComponent<Animator>().DoScaledAnimationAsync("ArmIdle");
|
|
}
|
|
}),
|
|
|
|
new BeatAction.Action(caller.startBeat + 5.25, delegate {
|
|
SoundByte.PlayOneShotGame("loveLab/bagHeart", beat , 1f);
|
|
instance.heartBox.GetComponent<Animator>().DoScaledAnimationAsync("HeartBoxSquish");}),
|
|
|
|
new BeatAction.Action(caller.startBeat + 5.312, delegate {
|
|
SoundByte.PlayOneShotGame("loveLab/bagHeartLast", beat , 1.1f);
|
|
instance.heartBox.GetComponent<Animator>().DoScaledAnimationAsync("HeartBoxSquish");})
|
|
});
|
|
}
|
|
|
|
public static void onReleaseLongThrow(PlayerActionEvent caller, float beat)
|
|
{
|
|
if (instance.hasMissed) return;
|
|
|
|
instance.labGuyHead.DoScaledAnimationAsync("GuyFaceIdle");
|
|
BeatAction.New(instance, new List<BeatAction.Action>()
|
|
{
|
|
new BeatAction.Action(caller.startBeat, delegate
|
|
{
|
|
instance.labGirlHead.DoScaledAnimationAsync("GirlIdleFace");
|
|
SoundByte.PlayOneShotGame("loveLab/rightThrowNoShake");
|
|
instance.labGirlArm.GetComponent<Animator>().DoScaledAnimationAsync("ThrowFlask");
|
|
|
|
instance.spawnFlaskForWeird((caller.startBeat + caller.timer));
|
|
}),
|
|
|
|
new BeatAction.Action(caller.startBeat + 7f, delegate
|
|
{
|
|
SoundByte.PlayOneShotGame("loveLab/heartsCombine");
|
|
if (instance.labGirlArm.GetComponent<Animator>().IsAnimationNotPlaying())
|
|
{
|
|
instance.labGirlArm.GetComponent<Animator>().DoScaledAnimationAsync("ArmIdle");
|
|
}
|
|
}),
|
|
|
|
new BeatAction.Action(caller.startBeat + 8.25f, delegate
|
|
{
|
|
SoundByte.PlayOneShotGame("loveLab/bagHeart");
|
|
instance.heartBox.GetComponent<Animator>().DoScaledAnimationAsync("HeartBoxSquish");
|
|
}),
|
|
|
|
new BeatAction.Action(caller.startBeat + 8.312f, delegate
|
|
{
|
|
SoundByte.PlayOneShotGame("loveLab/bagHeart", 0f, 1.1f);
|
|
instance.heartBox.GetComponent<Animator>().DoScaledAnimationAsync("HeartBoxSquish");
|
|
}),
|
|
|
|
new BeatAction.Action(caller.startBeat + 8.375f, delegate
|
|
{
|
|
SoundByte.PlayOneShotGame("loveLab/bagHeartLast", 0f, 1.28f);
|
|
instance.heartBox.GetComponent<Animator>().DoScaledAnimationAsync("HeartBoxSquish");
|
|
}),
|
|
});
|
|
}
|
|
|
|
public static void onReleaseLongestThrow(PlayerActionEvent caller, float beat)
|
|
{
|
|
if (instance.hasMissed) return;
|
|
|
|
instance.labGuyHead.DoScaledAnimationAsync("GuyFaceIdle");
|
|
BeatAction.New(instance, new List<BeatAction.Action>()
|
|
{
|
|
new BeatAction.Action(caller.startBeat, delegate
|
|
{
|
|
instance.labGirlHead.DoScaledAnimationAsync("GirlIdleFace");
|
|
SoundByte.PlayOneShotGame("loveLab/rightThrowNoShake");
|
|
instance.labGirlArm.GetComponent<Animator>().DoScaledAnimationAsync("ThrowFlask");
|
|
|
|
instance.spawnFlaskForWeird((caller.startBeat + caller.timer));
|
|
}),
|
|
|
|
new BeatAction.Action(caller.startBeat + 8f, delegate
|
|
{
|
|
SoundByte.PlayOneShotGame("loveLab/heartsCombine");
|
|
if (instance.labGirlArm.GetComponent<Animator>().IsAnimationNotPlaying())
|
|
{
|
|
instance.labGirlArm.GetComponent<Animator>().DoScaledAnimationAsync("ArmIdle");
|
|
}
|
|
}),
|
|
|
|
new BeatAction.Action(caller.startBeat + 9.25f, delegate
|
|
{
|
|
SoundByte.PlayOneShotGame("loveLab/bagHeart");
|
|
instance.heartBox.GetComponent<Animator>().DoScaledAnimationAsync("HeartBoxSquish");
|
|
}),
|
|
|
|
new BeatAction.Action(caller.startBeat + 9.312f, delegate
|
|
{
|
|
SoundByte.PlayOneShotGame("loveLab/bagHeart", 0f, 1.1f);
|
|
instance.heartBox.GetComponent<Animator>().DoScaledAnimationAsync("HeartBoxSquish");
|
|
}),
|
|
|
|
new BeatAction.Action(caller.startBeat + 9.375f, delegate
|
|
{
|
|
SoundByte.PlayOneShotGame("loveLab/bagHeart", 0f, 1.28f);
|
|
instance.heartBox.GetComponent<Animator>().DoScaledAnimationAsync("HeartBoxSquish");
|
|
}),
|
|
|
|
new BeatAction.Action(caller.startBeat + 9.438f, delegate
|
|
{
|
|
SoundByte.PlayOneShotGame("loveLab/bagHeart", 0f, 1.48f);
|
|
instance.heartBox.GetComponent<Animator>().DoScaledAnimationAsync("HeartBoxSquish");
|
|
}),
|
|
|
|
new BeatAction.Action(caller.startBeat + 9.500f, delegate
|
|
{
|
|
SoundByte.PlayOneShotGame("loveLab/bagHeartLast", 0f, 1.68f);
|
|
instance.heartBox.GetComponent<Animator>().DoScaledAnimationAsync("HeartBoxSquish");
|
|
}),
|
|
});
|
|
}
|
|
|
|
#endregion
|
|
|
|
#region Lab Girl Actions
|
|
|
|
public static void onUpFlask(PlayerActionEvent caller, float beat)
|
|
{
|
|
SoundByte.PlayOneShotGame("loveLab/shakeUp");
|
|
instance.labGirlArm.GetComponent<Animator>().DoScaledAnimationAsync("ShakeFlaskUp");
|
|
|
|
BeatAction.New(instance, new List<BeatAction.Action>()
|
|
{
|
|
new BeatAction.Action((caller.startBeat + caller.timer) + .25f, delegate { instance.onDownFlask(); })
|
|
});
|
|
|
|
if (instance.reqHeartsContainer[0].heartCounter > 0)
|
|
{
|
|
if (instance.reqHeartsContainer[0].heartType == flaskHeart.twoHeart)
|
|
{
|
|
instance.ScheduleInput(caller.startBeat, 3f, LoveLab.InputAction_BasicRelease, onRelease2Throw, onMissWhenHold, onEmpty);
|
|
|
|
heartDetails heart = instance.reqHeartsContainer[0];
|
|
heart.heartCounter--;
|
|
instance.reqHeartsContainer[0] = heart;
|
|
}
|
|
|
|
else if (instance.reqHeartsContainer[0].heartType == flaskHeart.threeHeart)
|
|
{
|
|
if (instance.reqHeartsContainer[0].heartCounter >= 2)
|
|
{
|
|
instance.ScheduleInput(caller.startBeat, caller.timer + .5f, LoveLab.InputAction_DPad, onUpFlask, onMissWhenHold, onEmpty);
|
|
}
|
|
else
|
|
{
|
|
instance.ScheduleInput(caller.startBeat, caller.timer + .5f, LoveLab.InputAction_BasicRelease, onReleaseLongThrow, onMissWhenHold, onEmpty);
|
|
}
|
|
|
|
heartDetails heart = instance.reqHeartsContainer[0];
|
|
heart.heartCounter--;
|
|
instance.reqHeartsContainer[0] = heart;
|
|
}
|
|
else if (instance.reqHeartsContainer[0].heartType == flaskHeart.fiveHeart)
|
|
{
|
|
if(instance.reqHeartsContainer[0].heartCounter == 3)
|
|
{
|
|
instance.ScheduleInput(caller.startBeat, caller.timer + 1f, LoveLab.InputAction_DPad, onUpFlask, onMissWhenHold, onEmpty);
|
|
}
|
|
else if (instance.reqHeartsContainer[0].heartCounter == 1)
|
|
{
|
|
instance.ScheduleInput(caller.startBeat, caller.timer + .5f, LoveLab.InputAction_BasicRelease, onReleaseLongestThrow, onMissWhenHold, onEmpty);
|
|
}
|
|
else
|
|
{
|
|
instance.ScheduleInput(caller.startBeat, caller.timer + .5f, LoveLab.InputAction_DPad, onUpFlask, onMissWhenHold, onEmpty);
|
|
}
|
|
|
|
heartDetails heart = instance.reqHeartsContainer[0];
|
|
heart.heartCounter--;
|
|
instance.reqHeartsContainer[0] = heart;
|
|
}
|
|
}
|
|
|
|
if (instance.reqHeartsContainer[0].heartCounter <= 0)
|
|
{
|
|
instance.reqHeartsContainer.RemoveAt(0);
|
|
}
|
|
|
|
}
|
|
|
|
public void onDownFlask()
|
|
{
|
|
SoundByte.PlayOneShotGame("loveLab/shakeDown");
|
|
labGirlArm.GetComponent<Animator>().DoScaledAnimationAsync("ShakeFlaskDown");
|
|
}
|
|
|
|
public void onWhiffUp()
|
|
{
|
|
labGirlArm.GetComponent<Animator>().DoScaledAnimationAsync("WhiffUp");
|
|
}
|
|
|
|
public void onWhiffDown()
|
|
{
|
|
labGirlArm.GetComponent<Animator>().DoScaledAnimationAsync("WhiffDown");
|
|
}
|
|
|
|
#endregion
|
|
|
|
public static void onMiss(PlayerActionEvent caller)
|
|
{
|
|
//SoundByte.PlayOneShot("miss");
|
|
//instance.hasMissed = true;
|
|
instance.labGuyHead.DoScaledAnimationAsync("GuyIdleFace");
|
|
if (instance.labGuyArm.GetComponent<Animator>().IsAnimationNotPlaying())
|
|
{
|
|
instance.labGuyArm.GetComponent<Animator>().Play("ArmIdle");
|
|
}
|
|
|
|
//instance.reqHeartsContainer.RemoveAt(0);
|
|
|
|
Destroy(instance.girlInstantiatedFlask[0].gameObject);
|
|
instance.boyFlaskBreak.Play();
|
|
instance.girlInstantiatedFlask.RemoveAt(0);
|
|
|
|
if(instance.reqHeartsContainer.Count > 0)
|
|
{
|
|
instance.reqHeartsContainer.RemoveAt(0);
|
|
}
|
|
}
|
|
|
|
public static void onMissWhenHold(PlayerActionEvent caller)
|
|
{
|
|
Debug.LogWarning(caller.timer);
|
|
instance.reqHeartsContainer.RemoveAt(0);
|
|
LoveLabForGirlFlask spawnedFlask = Instantiate(instance.labGirlFlaskObj, instance.transform).AddComponent<LoveLabForGirlFlask>();
|
|
spawnedFlask.onMissWhenHold((caller.startBeat + caller.timer) + 1f);
|
|
}
|
|
|
|
public static void onEmpty(PlayerActionEvent caller)
|
|
{
|
|
//empty
|
|
}
|
|
}
|
|
}
|