Fixed Love Lab Hearts!

(well okay there's still a *tiny* visual glitch I'm not sure how to attack yet but this is infinitely better than what it was)
This commit is contained in:
wookywok 2024-05-08 10:32:37 -05:00
parent d178f8f51d
commit cd98a95cf0
4 changed files with 90 additions and 47 deletions

View file

@ -596,7 +596,7 @@ Transform:
- {fileID: 4352296737110256235}
- {fileID: 7647075704793663215}
- {fileID: 8099365789100165778}
- {fileID: 7492619980896112047}
- {fileID: 7620821406320402323}
m_Father: {fileID: 0}
m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
@ -686,6 +686,7 @@ MonoBehaviour:
completeHearts: []
currentHearts:
endPoint: {fileID: 7492619980896112047}
spawnPoint: {x: 2.7, y: 0}
shaderColorsDebug:
- _ColorAlpha
- _ColorBravo
@ -12236,8 +12237,9 @@ MonoBehaviour:
_step: 0
tweenComplete: 0
onlyOne: 1
end: {fileID: 7492619980896112047}
end: {x: 0, y: 0, z: 0}
timer: 0
isWaiting: 1
dropStart: {x: 0, y: 0, z: 0}
currentBeat: 0
endValue: 0
@ -13954,8 +13956,9 @@ MonoBehaviour:
_step: 0
tweenComplete: 0
onlyOne: 1
end: {fileID: 7492619980896112047}
end: {x: 0, y: 0, z: 0}
timer: 0
isWaiting: 1
dropStart: {x: 0, y: 0, z: 0}
currentBeat: 0
endValue: 0
@ -19485,6 +19488,7 @@ Transform:
m_Children:
- {fileID: 3368113456851434604}
- {fileID: 7766427145776930279}
- {fileID: 7492619980896112047}
m_Father: {fileID: 878409105178889012}
m_RootOrder: 3
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
@ -31505,8 +31509,9 @@ MonoBehaviour:
_step: 0
tweenComplete: 0
onlyOne: 1
end: {fileID: 7492619980896112047}
end: {x: 0, y: 0, z: 0}
timer: 0
isWaiting: 1
dropStart: {x: 0, y: 0, z: 0}
currentBeat: 0
endValue: 0
@ -32678,8 +32683,9 @@ MonoBehaviour:
_step: 0
tweenComplete: 0
onlyOne: 1
end: {fileID: 7492619980896112047}
end: {x: 0, y: 0, z: 0}
timer: 0
isWaiting: 1
dropStart: {x: 0, y: 0, z: 0}
currentBeat: 0
endValue: 0
@ -40223,12 +40229,12 @@ Transform:
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 7784569542689620913}
m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
m_LocalPosition: {x: -2.7, y: -3, z: 0}
m_LocalScale: {x: 0.76234, y: 0.76234, z: 0.76234}
m_LocalPosition: {x: 0.013117568, y: 1.63773, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0
m_Children: []
m_Father: {fileID: 878409105178889012}
m_RootOrder: 12
m_Father: {fileID: 4674094147555684652}
m_RootOrder: 2
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!1 &7802884331815006546
GameObject:
@ -45954,6 +45960,37 @@ Transform:
m_Father: {fileID: 7132799052978497352}
m_RootOrder: 1
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!1 &8709141480864242041
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 7620821406320402323}
m_Layer: 0
m_Name: spawnPoint
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!4 &7620821406320402323
Transform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 8709141480864242041}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: -2.7, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0
m_Children: []
m_Father: {fileID: 878409105178889012}
m_RootOrder: 12
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!1 &8858862843781676607
GameObject:
m_ObjectHideFlags: 0

View file

@ -242,6 +242,7 @@ namespace HeavenStudio.Games
List<PlayerActionEvent> currentEvents;
[SerializeField] List<int> currentHearts;
[SerializeField] Transform endPoint;
[SerializeField] Vector3 spawnPoint;
#endregion
@ -886,44 +887,45 @@ namespace HeavenStudio.Games
foreach(LoveLabHearts h in instance.girlHearts)
{
h.stop = true;
LoveLabHearts a = Instantiate(instance.completeHeartObj, instance.heartHolder).GetComponent<LoveLabHearts>();
a.transform.position = new Vector2(a.transform.position.x, h.transform.position.y);
a.heartBeat = caller.startBeat + caller.timer + 1f;
a.end = instance.endPoint;
instance.completeHearts.Add(a);
}
var additionalHearts = 0.063f;
for(int x = 0; x < instance.currentHearts[0]; x++)
{
instance.guyHearts[0].heartAnim.Play("HeartMerge");
instance.girlHearts[0].heartAnim.Play("HeartGirlMerge");
LoveLabHearts a = Instantiate(instance.completeHeartObj, instance.heartHolder).GetComponent<LoveLabHearts>();
a.transform.position = new Vector2(a.transform.position.x, instance.girlHearts[0].transform.position.y);
var additionalHeartLength = (0.063f * instance.girlHearts.Count);
a.heartBeat = caller.startBeat + caller.timer + 1f;
a.dropStart = a.transform.position;
a.end = instance.endPoint.position;
instance.completeHearts.Add(a);
a.timer = (2.25f + additionalHeartLength);
a.isWaiting = false;
//a.goDown();
instance.guyHearts.RemoveAt(0);
instance.girlHearts.RemoveAt(0);
}
var additionalHearts = 0.063f;
instance.currentHearts.RemoveAt(0);
foreach(LoveLabHearts a in instance.completeHearts)
{
//a.startDrop();
}
for(int x = 0; x < lastCounter; x++)
{
//for(int x = 0; x < lastCounter, x++)
//{
//Debug.LogWarning(2.25f + (additionalHearts * x));
//instance.completeHearts[x].dropStart = instance.completeHearts[x].transform.position;
instance.completeHearts[x].isWaiting = false;
instance.completeHearts[x].timer = (2.25f + (additionalHearts * x));
//instance.completeHearts[x].timer = (2.25f + (additionalHearts * x));
//instance.completeHearts[x].isWaiting = false;
//}
}
instance.currentHearts.RemoveAt(0);
//instance.currentHearts.Clear();
}),
});

View file

@ -44,7 +44,7 @@ namespace HeavenStudio.Games.Scripts_LoveLab
public bool tweenComplete;
Tween movePos;
public bool onlyOne = true;
public Transform end;
public Vector3 end;
public double timer;
public bool isWaiting = true;
SpriteRenderer heartRenderer;
@ -66,6 +66,7 @@ namespace HeavenStudio.Games.Scripts_LoveLab
}
private void Awake()
{if (whatHeartType != heartType.completeHeart)
{
if(heartCount == 0)
{
@ -75,11 +76,13 @@ namespace HeavenStudio.Games.Scripts_LoveLab
{
transform.position = new Vector2(transform.position.x, transform.position.y + 4f);
}
}
playBackSpeed = Timeline.instance.PlaybackSpeed.value;
addPos = 2.5f; //3f
heartRenderer = this.GetComponent<SpriteRenderer>();
//dropStart = new Vector3 (transform.position.x, origPos.y+(addPos), transform.position.z);
}
void Start()
@ -117,10 +120,10 @@ namespace HeavenStudio.Games.Scripts_LoveLab
//}
//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);
//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);
@ -130,7 +133,7 @@ namespace HeavenStudio.Games.Scripts_LoveLab
public void debugSmth<T>(ref T idk)
{
Debug.LogWarning(idk);
//Debug.LogWarning(idk);
}
public void startDrop()
@ -148,11 +151,7 @@ namespace HeavenStudio.Games.Scripts_LoveLab
transform.position = new Vector3(transform.position.x, transform.position.y + .1f * playBackSpeed);
}
public void restartTween()
{
upTween.ChangeEndValue(new Vector3(transform.position.x, endValue, transform.position.z));
upTween.Restart();
}
public Tweener upTween;
public float endValue;
@ -173,6 +172,7 @@ namespace HeavenStudio.Games.Scripts_LoveLab
//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);
//DOTween.timeScale = playBackSpeed;
//DOTween.timeScale = cond.pitchedSecPerBeat;
//float normalizedBeat = Conductor.instance.GetPositionFromBeat(heartBeat, length);
@ -183,12 +183,14 @@ namespace HeavenStudio.Games.Scripts_LoveLab
}
else if (!isWaiting)
{
float normalizedBeat = Conductor.instance.GetPositionFromBeat(heartBeat, ((timer/2)*playBackSpeed));
float newPosY = EasingFunction.EaseInQuad(dropStart.y, end.y, normalizedBeat);
float newPosY = EasingFunction.EaseInQuad(transform.position.y, -3f, normalizedBeat);
if (normalizedBeat<=1) transform.position = new Vector2(transform.position.x, newPosY);
else destroyWhenDone();
if (normalizedBeat<=1) transform.position = new Vector2(dropStart.x, newPosY);
else Destroy(this.gameObject);
//else destroyWhenDone();
//if (normalizedBeat >= 1) {destroyWhenDone();}
//transform.position = Vector2.Lerp(dropStart, end.position, newPosY);
@ -209,7 +211,7 @@ namespace HeavenStudio.Games.Scripts_LoveLab
//goDown();
}
else {transform.position = new Vector2(dropStart.x, dropStart.y);}
//else {transform.position = new Vector2(dropStart.x, dropStart.y);}
//transform.position = Vector3.Lerp(origPos, new Vector3(origPos.x, origPos.y + addPos), Mathf.SmoothStep(0, 1, testContainer));
}
@ -226,7 +228,7 @@ namespace HeavenStudio.Games.Scripts_LoveLab
{
//DOTween.timeScale = cond.pitchedSecPerBeat;
//transform.DOLocalMoveY(end.position.y, (float)timer).From(true).SetEase(Ease.InBack);
Debug.LogWarning("go down");
//Debug.LogWarning("go down");
//DOTween.timeScale = playBackSpeed;
//DOTween.timeScale = cond.secPerBeat * playBackSpeed;

View file

@ -398,5 +398,7 @@ MonoBehaviour:
- Assets/Scripts/Games/FlipperFlop/FlipperFlop.cs
- Assets/Scripts/Games/LoveLab/LoveLabHearts.cs
- Assets/Scripts/Games/LoveLab/LoveLab.cs
- Assets/Scripts/Games/LoveLab/LoveLabFlask.cs
- Assets/Scripts/Games/LoveLab/LoveLabHeartMisc.cs
PathsToSkipImportEvent: []
PathsToIgnoreOverwriteSettingOnAttribute: []