mirror of
https://github.com/RHeavenStudioPlus/HeavenStudioPlus.git
synced 2024-11-29 13:03:05 +00:00
493309c925
* blue bear and bop region fix * fixed see saw bug * I hate blue bear. * Accuracy * random things * extended bgs * karate man stuff * ok * star colors and senior gradient * reworked blue bear emotions again * head seperated in ringside * fix * blink fix * blink fix again * no cancel * karate man right hand thing * new sheet * oops * bop anim fix * i have made a severe and continuous lapse in judgement * fixed stuff * fixed stuff in sneak y Psirits * drumming practice new sprites and anims * extended bg * the blush was lower on z axis oops * if you love it so much why dont u put a ringside on it * blue bear change * Double date ! * new karate joe heads + snow and double date bench fix * ops * fixed breakup anim thing * story position fixes * oops * smile anim fix * added jump option --------- Co-authored-by: ev <85412919+evdial@users.noreply.github.com>
104 lines
3.6 KiB
C#
104 lines
3.6 KiB
C#
|
|
using System;
|
|
using System.Collections;
|
|
using System.Collections.Generic;
|
|
using UnityEngine;
|
|
|
|
using HeavenStudio.Util;
|
|
|
|
namespace HeavenStudio.Games.Scripts_DoubleDate
|
|
{
|
|
public class Basketball : SuperCurveObject
|
|
{
|
|
private DoubleDate game;
|
|
private SuperCurveObject.Path path;
|
|
private double pathStartBeat = double.MinValue;
|
|
private Conductor conductor;
|
|
private GameObject shadow;
|
|
private bool _jump;
|
|
|
|
void Awake()
|
|
{
|
|
game = DoubleDate.instance;
|
|
conductor = Conductor.instance;
|
|
}
|
|
|
|
void Update()
|
|
{
|
|
double beat = conductor.songPositionInBeatsAsDouble;
|
|
double height = 0f;
|
|
if (pathStartBeat > double.MinValue)
|
|
{
|
|
Vector3 pos = GetPathPositionFromBeat(path, Math.Max(beat, pathStartBeat), out height, pathStartBeat);
|
|
transform.position = pos;
|
|
float rot = GetPathValue("rot");
|
|
transform.rotation = Quaternion.Euler(0f, 0f, transform.rotation.eulerAngles.z - (rot * Time.deltaTime * (1f/conductor.pitchedSecPerBeat)));
|
|
}
|
|
shadow.transform.position = new Vector3(transform.position.x, (float) Math.Min(transform.position.y - height, game.floorHeight), transform.position.z);
|
|
shadow.transform.localScale = Vector3.one * Mathf.Clamp(((transform.position.y) - game.shadowDepthScaleMin) / (game.shadowDepthScaleMax - game.shadowDepthScaleMin), 0f, 1f);
|
|
}
|
|
|
|
public void Init(double beat, bool shouldJump)
|
|
{
|
|
_jump = shouldJump;
|
|
game.ScheduleInput(beat, 1f, DoubleDate.InputAction_FlickPress, Just, Miss, Empty);
|
|
path = game.GetPath("BasketBallIn");
|
|
UpdateLastRealPos();
|
|
pathStartBeat = beat - 1f;
|
|
|
|
Vector3 pos = GetPathPositionFromBeat(path, pathStartBeat, pathStartBeat);
|
|
transform.position = pos;
|
|
|
|
gameObject.SetActive(true);
|
|
shadow = game.MakeDropShadow();
|
|
shadow.transform.position = new Vector3(transform.position.x, Mathf.Min(game.floorHeight, transform.position.y - offset.y), transform.position.z);
|
|
shadow.SetActive(true);
|
|
}
|
|
|
|
void Just(PlayerActionEvent caller, float state)
|
|
{
|
|
BeatAction.New(this, new List<BeatAction.Action>()
|
|
{
|
|
new BeatAction.Action(conductor.songPositionInBeatsAsDouble + 3f, delegate
|
|
{
|
|
Destroy(gameObject);
|
|
}),
|
|
});
|
|
UpdateLastRealPos();
|
|
pathStartBeat = conductor.songPositionInBeatsAsDouble;
|
|
if (state >= 1f || state <= -1f)
|
|
{
|
|
path = game.GetPath("BasketBallNg" + (state > 0 ? "Late" : "Early"));
|
|
SoundByte.PlayOneShot("miss");
|
|
game.Kick(false);
|
|
GetComponent<SpriteRenderer>().sortingOrder = 8;
|
|
return;
|
|
}
|
|
Hit();
|
|
}
|
|
|
|
void Hit()
|
|
{
|
|
UpdateLastRealPos();
|
|
pathStartBeat = conductor.songPositionInBeatsAsDouble;
|
|
path = game.GetPath("BasketBallJust");
|
|
game.Kick(true, false, true, _jump);
|
|
SoundByte.PlayOneShotGame("doubleDate/kick");
|
|
}
|
|
|
|
void Miss(PlayerActionEvent caller)
|
|
{
|
|
SoundByte.PlayOneShotGame("doubleDate/weasel_hide");
|
|
game.MissKick(pathStartBeat + 2.25f);
|
|
}
|
|
|
|
void Empty(PlayerActionEvent caller) { }
|
|
|
|
private void OnDestroy() {
|
|
if (shadow != null)
|
|
{
|
|
Destroy(shadow);
|
|
}
|
|
}
|
|
}
|
|
}
|