mirror of
https://github.com/RHeavenStudioPlus/HeavenStudioPlus.git
synced 2024-11-29 13:03:05 +00:00
84aad376cb
* 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>
44 lines
1.4 KiB
C#
44 lines
1.4 KiB
C#
using System;
|
|
using System.Collections;
|
|
using System.Collections.Generic;
|
|
using UnityEngine;
|
|
using DG.Tweening;
|
|
|
|
namespace HeavenStudio.Games.Scripts_AirRally
|
|
{
|
|
public class RvlIsland : MonoBehaviour
|
|
{
|
|
[NonSerialized] public IslandsManager manager;
|
|
[NonSerialized] public Vector3 startPos;
|
|
private float normalized = 0f;
|
|
[NonSerialized] public float normalizedOffset = 0f;
|
|
[SerializeField] private SpriteRenderer[] srs;
|
|
|
|
private Tween[] fadeInTweens;
|
|
|
|
private void Awake()
|
|
{
|
|
startPos = transform.position;
|
|
fadeInTweens = new Tween[srs.Length];
|
|
}
|
|
|
|
private void Update()
|
|
{
|
|
if (!Conductor.instance.isPlaying) return;
|
|
float moveZ = Mathf.LerpUnclamped(startPos.z, startPos.z + manager.endZ, normalized);
|
|
transform.position = new Vector3(transform.position.x, transform.position.y, moveZ);
|
|
normalized += manager.speedMult * manager.additionalSpeedMult * Time.deltaTime;
|
|
if (transform.position.z < manager.endZ)
|
|
{
|
|
normalized = -normalizedOffset;
|
|
for(int i = 0; i < srs.Length; i++)
|
|
{
|
|
srs[i].color = new Color(1, 1, 1, 0);
|
|
if (fadeInTweens[i] != null) fadeInTweens[i].Kill(true);
|
|
fadeInTweens[i] = srs[i].DOColor(Color.white, 0.4f);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|