fc5614dae2
* 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>
49 lines
1.3 KiB
C#
49 lines
1.3 KiB
C#
using Starpelly;
|
|
using System;
|
|
using System.Collections;
|
|
using System.Collections.Generic;
|
|
using UnityEngine;
|
|
|
|
namespace HeavenStudio.Games.Scripts_AirRally
|
|
{
|
|
public class IslandsManager : MonoBehaviour
|
|
{
|
|
[Header("Properties")]
|
|
[SerializeField] private float loopMult = 1f;
|
|
[NonSerialized] public float endZ;
|
|
public float speedMult = 1f;
|
|
[NonSerialized] public float additionalSpeedMult = 1;
|
|
|
|
[SerializeField] private RvlIsland[] islands;
|
|
|
|
private float fullLengthZ;
|
|
|
|
private void Start()
|
|
{
|
|
speedMult /= loopMult;
|
|
float[] allZ = new float[islands.Length];
|
|
|
|
for (int i = 0; i < islands.Length; i++)
|
|
{
|
|
islands[i].manager = this;
|
|
allZ[i] = islands[i].startPos.z;
|
|
}
|
|
|
|
if (islands.Length > 0)
|
|
{
|
|
float minValueZ = Mathf.Min(allZ);
|
|
float maxValueZ = Mathf.Max(allZ);
|
|
fullLengthZ = maxValueZ - minValueZ;
|
|
endZ = -fullLengthZ * loopMult;
|
|
foreach (var island in islands)
|
|
{
|
|
island.normalizedOffset = 1 - Mathp.Normalize(island.startPos.z, minValueZ, maxValueZ);
|
|
island.normalizedOffset /= loopMult;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|