mirror of
https://github.com/RHeavenStudioPlus/HeavenStudioPlus.git
synced 2024-11-11 12:15:11 +00:00
6b58b427c8
* prefab * Spawn Rod * Shoot Rod * Square * Shoot Rod EX * Custom Bounce * Fix spawn * fix animation * Change Block * Change Block Animation * Destroy Square * Fix block's transition * Shoot Rod (mute) * High Curve * animation tweaks, revert to old spritesheet * more accurate placement * more animations * finished anims * all animations done * shake more * Minor correction * fixed square rotations * upscale * icon * Add miss curve and Toggle Blocks --------- Co-authored-by: ev <85412919+iloveoatmeal2022@users.noreply.github.com>
64 lines
No EOL
1.9 KiB
C#
64 lines
No EOL
1.9 KiB
C#
using System;
|
|
using System.Collections;
|
|
using System.Collections.Generic;
|
|
using UnityEngine;
|
|
using UnityEngine.Rendering;
|
|
using NaughtyBezierCurves;
|
|
|
|
namespace HeavenStudio.Games.Scripts_BuiltToScaleRvl
|
|
{
|
|
using HeavenStudio.Util;
|
|
public class Square : MonoBehaviour
|
|
{
|
|
public string anim;
|
|
public double startBeat, targetBeat, lengthBeat = 1;
|
|
public int endTime;
|
|
public Vector3 CorrectionPos;
|
|
private Animator squareAnim;
|
|
|
|
private BuiltToScaleRvl game;
|
|
|
|
public void Init()
|
|
{
|
|
game = BuiltToScaleRvl.instance;
|
|
squareAnim = GetComponent<Animator>();
|
|
var endTime = (int)Math.Ceiling((targetBeat - startBeat)/lengthBeat);
|
|
transform.position = transform.position - endTime * CorrectionPos;
|
|
double beat = targetBeat - lengthBeat * endTime;
|
|
squareAnim.Play(anim, 0, (beat==0 ? 0 : 1));
|
|
Recursion(beat, lengthBeat);
|
|
}
|
|
|
|
private void Recursion(double beat, double length)
|
|
{
|
|
if (beat > targetBeat + 10 * lengthBeat) End();
|
|
BeatAction.New(this, new List<BeatAction.Action>()
|
|
{
|
|
new BeatAction.Action(beat + length, delegate
|
|
{
|
|
transform.position = transform.position + CorrectionPos;
|
|
squareAnim.Play(anim, 0, 0);
|
|
Recursion(beat + length, length);
|
|
}),
|
|
});
|
|
}
|
|
|
|
void PositionCorrection()
|
|
{
|
|
var pos = transform.position;
|
|
Debug.Log(transform.position);
|
|
transform.position = pos + CorrectionPos;
|
|
Debug.Log(transform.position);
|
|
}
|
|
|
|
void ChangeSortingOrder(int order)
|
|
{
|
|
GetComponent<SortingGroup>().sortingOrder = order;
|
|
}
|
|
|
|
void End()
|
|
{
|
|
Destroy(gameObject);
|
|
}
|
|
}
|
|
} |