HeavenStudio/Assets/Scripts/Games/LoveLab/LoveLabForGirlFlask.cs
Mytiaoga 46db1f83c5 Spotlight and Miss things
spotlight for boy and girl
early stuff for miss anims and logic
(made the broken shards as prefab)
2024-02-11 09:35:25 +08:00

151 lines
4.5 KiB
C#

using System;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using Starpelly;
using HeavenStudio.Util;
namespace HeavenStudio.Games.Scripts_LoveLab
{
public class LoveLabForGirlFlask : SuperCurveObject
{
private LoveLab game;
[SerializeField] private SuperCurveObject.Path path;
private double pathStartBeat = double.MinValue;
private Conductor conductor;
public LoveLab.flaskHeart heartType;
void Awake()
{
game = LoveLab.instance;
conductor = Conductor.instance;
}
void Start()
{
}
// Update is called once per frame
void Update()
{
double beat = conductor.songPositionInBeatsAsDouble;
double height = 0f;
if (pathStartBeat > double.MinValue)
{
Vector3 pos = GetPathPositionFromBeat(path, Math.Max(beat, pathStartBeat), out height, pathStartBeat);
transform.position = pos;
float rot = GetPathValue("rot");
transform.rotation = Quaternion.Euler(0f, 0f, transform.rotation.eulerAngles.z - (rot * Time.deltaTime * (1f / conductor.pitchedSecPerBeat)));
}
}
public void FastInit(double beat)
{
path = game.GetPath("GirlFastFlaskIn");
UpdateLastRealPos();
pathStartBeat = beat - 1f;
Vector3 pos = GetPathPositionFromBeat(path, pathStartBeat, pathStartBeat);
transform.position = pos;
gameObject.SetActive(true);
}
public void SlowInit(double beat)
{
path = game.GetPath("GirlSlowFlaskIn");
UpdateLastRealPos();
pathStartBeat = beat - 1f;
Vector3 pos = GetPathPositionFromBeat(path, pathStartBeat, pathStartBeat);
transform.position = pos;
gameObject.SetActive(true);
}
public void MidSlowInit(double beat)
{
path = game.GetPath("GirlMidSlowFlaskIn");
UpdateLastRealPos();
pathStartBeat = beat - 1f;
Vector3 pos = GetPathPositionFromBeat(path, pathStartBeat, pathStartBeat);
transform.position = pos;
gameObject.SetActive(true);
game.flask = this.gameObject;
}
public void ForWeirdInit(double beat)
{
path = game.GetPath("WeirdFlaskIn");
UpdateLastRealPos();
pathStartBeat = beat - 1f;
Vector3 pos = GetPathPositionFromBeat(path, pathStartBeat, pathStartBeat);
transform.position = pos;
gameObject.SetActive(true);
BeatAction.New(LoveLab.instance, new List<BeatAction.Action>()
{
new BeatAction.Action(beat + 1f, delegate
{
Destroy(this.gameObject);
LoveLab.instance.weirdInstantiatedFlask.RemoveAt(0);
LoveLab.instance.labAssistantArm.GetComponent<Animator>().DoScaledAnimationAsync("MittenGrab", 1f);
}),
new BeatAction.Action(beat + 2f, delegate
{
LoveLab.instance.labAssistantArm.GetComponent<Animator>().DoScaledAnimationAsync("MittenLetGo", 2f);
}),
});
}
//public static void onMiss(PlayerActionEvent caller)
//{
// //SoundByte.PlayOneShot("miss");
// LoveLab.instance.hasMissed = true;
// LoveLab.instance.labGuyHead.DoScaledAnimationAsync("GuyFaceIdle");
// Destroy(LoveLab.instance.girlInstantiatedFlask[0].gameObject);
// LoveLab.instance.boyFlaskBreak.Play();
// LoveLab.instance.girlInstantiatedFlask.RemoveAt(0);
//}
public void onMissWhenHold(double beat)
{
path = game.GetPath("GirlFlaskMiss");
UpdateLastRealPos();
pathStartBeat = beat - 1f;
Vector3 pos = GetPathPositionFromBeat(path, pathStartBeat, pathStartBeat);
transform.position = pos;
gameObject.SetActive(true);
BeatAction.New(game, new List<BeatAction.Action>()
{
new BeatAction.Action(beat, delegate {
game.girlFlaskBreak.Play();
Destroy(this.gameObject); })
});
}
public void destroyThisObj()
{
LoveLab.instance.girlInstantiatedFlask.RemoveAt(0);
Destroy(this.gameObject);
}
}
}