mirror of
https://github.com/RHeavenStudio/HeavenStudio.git
synced 2025-06-12 08:27:40 +02:00
Air Rally Rework/Finalization (#512)
* smol tweaks * air rally is now recursive and has the bg sheet * everything has been reworked now * oopsie * toss + constant anims * catch * catch and alt ba bum bum bum * day/night cycle, needs accurate colors * enter, daynight fixes and start on cloud density options * cloud density options * fixes * islands basics * islands progress * island tweaks * more tweaks * final tweaks * Birds implemented * snowflakes, cloud speed changes, snowflake speed changes and forward pose * rainbow added, so gay * el background clouds * oop * boat and balloons * Trees added * reduced tree amounts --------- Co-authored-by: ev <85412919+evdial@users.noreply.github.com>
This commit is contained in:
@ -1,9 +1,8 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
using NaughtyBezierCurves;
|
||||
using HeavenStudio.Util;
|
||||
|
||||
using System;
|
||||
|
||||
namespace HeavenStudio.Games.Scripts_AirRally
|
||||
{
|
||||
@ -13,20 +12,25 @@ namespace HeavenStudio.Games.Scripts_AirRally
|
||||
[SerializeField] Transform OtherTarget;
|
||||
[SerializeField] float TargetHeight;
|
||||
[SerializeField] float TargetHeightLong;
|
||||
[SerializeField] float TargetHeightToss = 2.5f;
|
||||
[SerializeField] ParticleSystem hitEffect;
|
||||
|
||||
public double startBeat;
|
||||
public double flyBeats;
|
||||
private Rigidbody2D rb;
|
||||
|
||||
public bool flyType;
|
||||
[NonSerialized] public double startBeat;
|
||||
[NonSerialized] public double flyBeats;
|
||||
|
||||
[NonSerialized] public bool flyType;
|
||||
bool miss = false;
|
||||
public float flyPos;
|
||||
public bool isReturning;
|
||||
[NonSerialized] public float flyPos;
|
||||
[NonSerialized] public bool isReturning;
|
||||
[NonSerialized] public bool isTossed = false;
|
||||
AirRally game;
|
||||
|
||||
private void Awake()
|
||||
{
|
||||
game = AirRally.instance;
|
||||
rb = GetComponent<Rigidbody2D>();
|
||||
}
|
||||
|
||||
void Start()
|
||||
@ -41,8 +45,13 @@ namespace HeavenStudio.Games.Scripts_AirRally
|
||||
|
||||
Vector3 startPos = isReturning ? PlayerTarget.position : OtherTarget.position;
|
||||
Vector3 endPos = isReturning ? OtherTarget.position : PlayerTarget.position;
|
||||
if (isTossed)
|
||||
{
|
||||
startPos = OtherTarget.position;
|
||||
endPos = OtherTarget.position;
|
||||
}
|
||||
Vector3 lastPos = transform.position;
|
||||
if (!GetComponent<Rigidbody2D>().simulated)
|
||||
if (!rb.simulated)
|
||||
{
|
||||
flyPos = cond.GetPositionFromBeat(startBeat, flyBeats);
|
||||
|
||||
@ -50,25 +59,34 @@ namespace HeavenStudio.Games.Scripts_AirRally
|
||||
|
||||
float yMul = flyPos * 2f - 1f;
|
||||
float yWeight = -(yMul*yMul) + 1f;
|
||||
transform.position += Vector3.up * yWeight * (flyType ? TargetHeightLong : TargetHeight);
|
||||
if (isTossed) transform.position += Vector3.up * yWeight * TargetHeightToss;
|
||||
else transform.position += Vector3.up * yWeight * (flyType ? TargetHeightLong : TargetHeight);
|
||||
}
|
||||
|
||||
// calculates next position
|
||||
{
|
||||
float rotation;
|
||||
if (flyPos > 0.5)
|
||||
if (isTossed)
|
||||
{
|
||||
Vector3 midPos = Vector3.LerpUnclamped(startPos, endPos, 0.5f);
|
||||
midPos += Vector3.up * (flyType ? TargetHeightLong : TargetHeight);
|
||||
Vector3 direction = (transform.position - midPos).normalized;
|
||||
rotation = Mathf.Atan2(direction.y, direction.x) * Mathf.Rad2Deg;
|
||||
rotation = Mathf.Lerp(90, -90, flyPos);
|
||||
}
|
||||
else
|
||||
{
|
||||
Vector3 direction = (transform.position - lastPos).normalized;
|
||||
rotation = Mathf.Atan2(direction.y, direction.x) * Mathf.Rad2Deg;
|
||||
if (flyPos > 0.5)
|
||||
{
|
||||
Vector3 midPos = Vector3.LerpUnclamped(startPos, endPos, 0.5f);
|
||||
midPos += Vector3.up * (flyType ? TargetHeightLong : TargetHeight);
|
||||
Vector3 direction = (transform.position - midPos).normalized;
|
||||
rotation = Mathf.Atan2(direction.y, direction.x) * Mathf.Rad2Deg;
|
||||
}
|
||||
else
|
||||
{
|
||||
Vector3 direction = (transform.position - lastPos).normalized;
|
||||
rotation = Mathf.Atan2(direction.y, direction.x) * Mathf.Rad2Deg;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
this.transform.eulerAngles = new Vector3(0, 0, rotation - 90f);
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user