mirror of
https://github.com/RHeavenStudio/HeavenStudio.git
synced 2025-06-13 17:37:38 +02:00
Love Lab (R2) (#901)
* Love Lab (Initialization) * Spotlight and Miss things spotlight for boy and girl early stuff for miss anims and logic (made the broken shards as prefab) * Custom Shakes (init) idk about the rest, some bug fixes and some tweaks * custom shakes almost fully implemented missing "miss" stuff but ok on autoplay * code cleanup * bop and auto down fix * hearts init + optimize tod * updated to main * fixed repo * Heart Stuff (again) * reup * reup (for real)
This commit is contained in:
8
Assets/Scripts/Games/LoveLab.meta
Normal file
8
Assets/Scripts/Games/LoveLab.meta
Normal file
@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: dc4f7ee2586e5d04ba53c5338fb257b0
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
1590
Assets/Scripts/Games/LoveLab/LoveLab.cs
Normal file
1590
Assets/Scripts/Games/LoveLab/LoveLab.cs
Normal file
File diff suppressed because it is too large
Load Diff
11
Assets/Scripts/Games/LoveLab/LoveLab.cs.meta
Normal file
11
Assets/Scripts/Games/LoveLab/LoveLab.cs.meta
Normal file
@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: e5ba4526fa4d9454992ee6120732dfbb
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
109
Assets/Scripts/Games/LoveLab/LoveLabFlask.cs
Normal file
109
Assets/Scripts/Games/LoveLab/LoveLabFlask.cs
Normal file
@ -0,0 +1,109 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
using HeavenStudio.Util;
|
||||
|
||||
|
||||
namespace HeavenStudio.Games.Scripts_LoveLab
|
||||
{
|
||||
public class LoveLabFlask : 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 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 customShakes(double beat, string reqArc)
|
||||
{
|
||||
path = game.GetPath(reqArc);
|
||||
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
|
||||
{
|
||||
Destroy(this.gameObject);
|
||||
}),
|
||||
});
|
||||
}
|
||||
|
||||
public void girlArc(double beat, string reqArc)
|
||||
{
|
||||
path = game.GetPath(reqArc);
|
||||
UpdateLastRealPos();
|
||||
pathStartBeat = beat - 1f;
|
||||
|
||||
Vector3 pos = GetPathPositionFromBeat(path, pathStartBeat, pathStartBeat);
|
||||
transform.position = pos;
|
||||
|
||||
gameObject.SetActive(true);
|
||||
}
|
||||
|
||||
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);
|
||||
|
||||
game.labWeirdEndState(beat, 1f, this.gameObject);
|
||||
}
|
||||
|
||||
|
||||
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.playFlaskBreak(1);
|
||||
Destroy(this.gameObject); })
|
||||
});
|
||||
}
|
||||
|
||||
public void destroyThisObj()
|
||||
{
|
||||
LoveLab.instance.girlInstantiatedFlask.RemoveAt(0);
|
||||
Destroy(this.gameObject);
|
||||
}
|
||||
}
|
||||
}
|
11
Assets/Scripts/Games/LoveLab/LoveLabFlask.cs.meta
Normal file
11
Assets/Scripts/Games/LoveLab/LoveLabFlask.cs.meta
Normal file
@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 32c7639974ad3bd40af10000d068432c
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
26
Assets/Scripts/Games/LoveLab/LoveLabHeartMisc.cs
Normal file
26
Assets/Scripts/Games/LoveLab/LoveLabHeartMisc.cs
Normal file
@ -0,0 +1,26 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.Threading.Tasks;
|
||||
using UnityEngine;
|
||||
|
||||
|
||||
namespace HeavenStudio.Games.Scripts_LoveLab
|
||||
{
|
||||
public class LoveLabHeartMisc : MonoBehaviour
|
||||
{
|
||||
[SerializeField] GameObject heart;
|
||||
[SerializeField] GameObject completeHeart;
|
||||
public async void destroyObj()
|
||||
{
|
||||
await Task.Delay(100);
|
||||
Destroy(heart);
|
||||
}
|
||||
|
||||
public void createHeart()
|
||||
{
|
||||
Debug.Log("heart");
|
||||
//LoveLabHearts ch = Instantiate(completeHeart, LoveLab.instance.getHeartHolder()).GetComponent<LoveLabHearts>();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
11
Assets/Scripts/Games/LoveLab/LoveLabHeartMisc.cs.meta
Normal file
11
Assets/Scripts/Games/LoveLab/LoveLabHeartMisc.cs.meta
Normal file
@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 44f9f0118afe6e14688990c6135f2735
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
203
Assets/Scripts/Games/LoveLab/LoveLabHearts.cs
Normal file
203
Assets/Scripts/Games/LoveLab/LoveLabHearts.cs
Normal file
@ -0,0 +1,203 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
using HeavenStudio.Util;
|
||||
using System;
|
||||
using System.Threading.Tasks;
|
||||
using DG.Tweening;
|
||||
using HeavenStudio.Editor.Track;
|
||||
|
||||
namespace HeavenStudio.Games.Scripts_LoveLab
|
||||
{
|
||||
public class LoveLabHearts : MonoBehaviour
|
||||
{
|
||||
[SerializeField] heartType whatHeartType;
|
||||
public double prevHeartBeat;
|
||||
public double heartBeat;
|
||||
public double nextHeartBeat;
|
||||
public Animator heartAnim;
|
||||
[SerializeField] ParticleSystem death;
|
||||
[SerializeField] GameObject outline;
|
||||
[SerializeField] GameObject fill;
|
||||
LoveLab game;
|
||||
Conductor cond;
|
||||
Timeline timeLine;
|
||||
//public double counter;
|
||||
public bool stop;
|
||||
//float testContainer;
|
||||
//public float testSmth;
|
||||
//float speed;
|
||||
Vector3 origPos;
|
||||
public float addPos = 0;
|
||||
float speedMultiplier;
|
||||
public float startPos = 0f;
|
||||
public double length;
|
||||
double duration;
|
||||
double startTime;
|
||||
double endTime;
|
||||
public int heartCount;
|
||||
public bool hasChecked;
|
||||
float playBackSpeed;
|
||||
public double intervalSpeed;
|
||||
public float _step;
|
||||
public bool tweenComplete;
|
||||
Tween movePos;
|
||||
public bool onlyOne = true;
|
||||
public Transform end;
|
||||
public double timer;
|
||||
|
||||
//y = 0 (endpoint)
|
||||
|
||||
public int getHeartType()
|
||||
{
|
||||
return (int)whatHeartType;
|
||||
}
|
||||
|
||||
enum heartType
|
||||
{
|
||||
guyHeart,
|
||||
girlHeart,
|
||||
completeHeart
|
||||
}
|
||||
|
||||
private void Awake()
|
||||
{
|
||||
if(heartCount == 0)
|
||||
{
|
||||
transform.position = new Vector2(transform.position.x, transform.position.y + 2f);
|
||||
}
|
||||
else
|
||||
{
|
||||
transform.position = new Vector2(transform.position.x, transform.position.y + 4f);
|
||||
}
|
||||
|
||||
playBackSpeed = Timeline.instance.PlaybackSpeed.value;
|
||||
addPos = 2.5f; //3f
|
||||
}
|
||||
|
||||
void Start()
|
||||
{
|
||||
game = LoveLab.instance;
|
||||
cond = Conductor.instance;
|
||||
timeLine = Timeline.instance;
|
||||
origPos = transform.position;
|
||||
//Debug.LogWarning(testContainer);
|
||||
speedMultiplier = game.speedForHeartsMultiplier;
|
||||
//test = (((float)intervalSpeed / cond.GetBpmAtBeat(heartBeat)) * playBackSpeed);
|
||||
|
||||
if(heartCount == 0)
|
||||
{
|
||||
_step = 1;
|
||||
}
|
||||
//test = .2f * ((60 / cond.GetBpmAtBeat(heartBeat) * _step) * playBackSpeed);
|
||||
//Debug.LogWarning(test);
|
||||
|
||||
//DOTween.timeScale = 1f * playBackSpeed;
|
||||
//DOTween.timeScale = (float)((intervalSpeed / cond.GetBpmAtBeat(heartBeat)) * 60) * playBackSpeed;
|
||||
//Debug.LogWarning("Sec per beat: " + cond.secPerBeat);
|
||||
|
||||
//if (length <= .5f && onlyOne)
|
||||
//{
|
||||
// addPos = 1.5f;
|
||||
//}
|
||||
DOTween.timeScale = playBackSpeed;
|
||||
var a = (float)(length * cond.secPerBeat) / playBackSpeed;
|
||||
Debug.LogWarning("Length: " + length);
|
||||
Debug.LogWarning("Sec per beat: " + cond.secPerBeat);
|
||||
Debug.LogWarning("Playback: " + playBackSpeed);
|
||||
debugSmth<float>(ref a);
|
||||
endValue = transform.position.y + addPos;
|
||||
upTween = transform.DOMoveY(endValue, (float)((length * cond.secPerBeat) / playBackSpeed)).SetEase(Ease.OutBack).OnComplete(restartTween);
|
||||
|
||||
//s
|
||||
}
|
||||
|
||||
public void debugSmth<T>(ref T idk)
|
||||
{
|
||||
Debug.LogWarning(idk);
|
||||
}
|
||||
|
||||
public void updateBeat()
|
||||
{
|
||||
//test = .2f * ((60 / cond.GetBpmAtBeat(heartBeat) * _step) * playBackSpeed);
|
||||
}
|
||||
|
||||
public void continousUp()
|
||||
{
|
||||
transform.position = new Vector3(transform.position.x, transform.position.y + .1f * playBackSpeed);
|
||||
}
|
||||
|
||||
public void restartTween()
|
||||
{
|
||||
upTween.ChangeEndValue(endValue);
|
||||
upTween.Restart();
|
||||
}
|
||||
|
||||
public Tweener upTween;
|
||||
public float endValue;
|
||||
|
||||
void FixedUpdate()
|
||||
{
|
||||
if(!stop && whatHeartType != heartType.completeHeart)
|
||||
{
|
||||
//DOTween.timeScale = .7f * playBackSpeed;
|
||||
//DOTween.timeScale = (float)cond.secPerBeat * playBackSpeed;
|
||||
//transform.DOMoveY(origPos.y + (1 + game.guyHearts.Count * .5f), 2 * (float)((length / cond.GetBpmAtBeat(heartBeat)) * 60)).SetEase(Ease.OutBack);
|
||||
//transform.DOMoveY(origPos.y + (addPos), (float)((length / cond.GetBpmAtBeat(heartBeat)) * 60 )).SetEase(Ease.OutBack);
|
||||
//transform.position = new Vector3(transform.position.x, transform.position.y + .1f * playBackSpeed);
|
||||
//transform.position = new Vector3(transform.position.x , (transform.position.y + (float)(intervalSpeed / cond.GetBpmAtBeat(heartBeat)) * 60) * playBackSpeed);
|
||||
//transform.DOMoveY(origPos.y + (addPos), (float)((intervalSpeed / cond.GetBpmAtBeat(heartBeat)) * 60)).SetEase(Ease.OutBack);
|
||||
//transform.DOMoveY(origPos.y + (addPos), (float)((intervalSpeed * cond.secPerBeat / cond.GetBpmAtBeat(heartBeat)) * 60) * playBackSpeed).SetEase(Ease.OutBack);
|
||||
//transform.DOMoveY(origPos.y + (addPos), (float)((intervalSpeed * cond.secPerBeat / cond.GetBpmAtBeat(heartBeat)) * 60) * playBackSpeed).SetEase(Ease.OutBack);
|
||||
// goUp((float)((intervalSpeed * cond.secPerBeat / cond.GetBpmAtBeat(heartBeat)) * 60) * playBackSpeed);
|
||||
//goUp((float)((length * cond.secPerBeat)) / playBackSpeed);
|
||||
upTween.ChangeEndValue(endValue);
|
||||
var t = ((float)cond.secPerBeat * length) * (transform.position.y - origPos.y) / ((origPos.y + addPos) - origPos.y);
|
||||
upTween.Goto((float)t, true);
|
||||
}
|
||||
else if(whatHeartType == heartType.completeHeart)
|
||||
{
|
||||
transform.DOMoveY(-1f, (float)(cond.secPerBeat / intervalSpeed) * playBackSpeed).SetEase(Ease.InBack);
|
||||
}
|
||||
|
||||
//transform.position = Vector3.Lerp(origPos, new Vector3(origPos.x, origPos.y + addPos), Mathf.SmoothStep(0, 1, testContainer));
|
||||
}
|
||||
|
||||
public void goUp(float timer)
|
||||
{
|
||||
transform.DOMoveY(origPos.y + (addPos), timer).SetEase(Ease.OutBack);
|
||||
}
|
||||
|
||||
public void goDown()
|
||||
{
|
||||
Debug.LogWarning("go down");
|
||||
//DOTween.timeScale = cond.secPerBeat * playBackSpeed;
|
||||
transform.DOMoveY(end.position.y, 2.25f).SetEase(Ease.OutBack);
|
||||
// sorting layer = 1020
|
||||
}
|
||||
|
||||
|
||||
public void destroyWhenDone()
|
||||
{
|
||||
Destroy(this.gameObject);
|
||||
}
|
||||
|
||||
public async void deadHeart()
|
||||
{
|
||||
//just instantiate this shit idk
|
||||
outline.SetActive(false);
|
||||
fill.SetActive(false);
|
||||
death.Play();
|
||||
|
||||
await Task.Delay(500);
|
||||
destroyWhenDone();
|
||||
}
|
||||
|
||||
private void OnDestroy()
|
||||
{
|
||||
DOTween.KillAll();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
11
Assets/Scripts/Games/LoveLab/LoveLabHearts.cs.meta
Normal file
11
Assets/Scripts/Games/LoveLab/LoveLabHearts.cs.meta
Normal file
@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 4ac4985fbd444824ba80ae18fc8d0fc6
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
Reference in New Issue
Block a user