mirror of
https://github.com/RHeavenStudioPlus/HeavenStudioPlus.git
synced 2024-12-05 07:47:30 +00:00
92baac9e38
* nearly the entire dog ninja rework lol. didn't think it would be this easy just a few more things to fix and we're good * fix some things, add NOT WORKING updater * final optimizations and fixes damn i didn't think the preparing stuff would be such a big deal * actual last fixes + ass buns --------- Co-authored-by: AstrlJelly <bdlawson115@gmail.com>
50 lines
1.6 KiB
C#
50 lines
1.6 KiB
C#
using System.Collections;
|
|
using System.Collections.Generic;
|
|
using System;
|
|
using UnityEngine;
|
|
using NaughtyBezierCurves;
|
|
|
|
|
|
namespace HeavenStudio.Games.Scripts_DogNinja
|
|
{
|
|
// this code sucks but i don't wanna touch it. it works fine enough. sorry!
|
|
public class SpawnHalves : MonoBehaviour
|
|
{
|
|
public double startBeat;
|
|
public Vector3 objPos;
|
|
public bool lefty;
|
|
float bpmModifier;
|
|
double songPos;
|
|
|
|
[SerializeField] float rotSpeed;
|
|
|
|
[Header("References")]
|
|
[SerializeField] BezierCurve3D fallLeftCurve;
|
|
[SerializeField] BezierCurve3D fallRightCurve;
|
|
BezierCurve3D curve;
|
|
public SpriteRenderer sr;
|
|
|
|
private void Start()
|
|
{
|
|
bpmModifier = Conductor.instance.songBpm / 100;
|
|
songPos = Conductor.instance.songPositionInBeatsAsDouble;
|
|
curve = lefty ? fallRightCurve : fallLeftCurve;
|
|
}
|
|
|
|
private void Update()
|
|
{
|
|
float flyPosHalves = (Conductor.instance.GetPositionFromBeat(songPos, 3f) * Conductor.instance.GetPositionFromBeat(songPos, 2f)) + Conductor.instance.GetPositionFromBeat(songPos, 1f);
|
|
flyPosHalves = (flyPosHalves * 0.2f) + 0.35f;
|
|
transform.position = curve.GetPoint(flyPosHalves) + objPos;
|
|
|
|
float rot = rotSpeed;
|
|
rot *= lefty ? bpmModifier : -1 * bpmModifier;
|
|
transform.rotation = Quaternion.Euler(0, 0, transform.rotation.eulerAngles.z + (rot * Time.deltaTime));
|
|
|
|
// clean-up logic
|
|
if (flyPosHalves > 1f) {
|
|
Destroy(gameObject);
|
|
}
|
|
}
|
|
}
|
|
}
|