3002e48350
* add mouse controller * support different control styles in options deprecate old input check methods * fully functional input actions system * btsds InputAction * blue bear InputAction * more games fix bugs with some input related systems * coin toss re-toss * cheer readers touch * dog ninja touch * multiple games * last of the easy games' touch * more specialized games * specialized games 2 * finish ktb games * remove legacy settings disclaimer * "only" two games left * karate man touch * rockers touch still needs fixes and bad judge strum * DSGuy flicking animation * playstyle chart property * improve performance of minigame preloading * improve look of cursor make assetbundles use chunk-based compression refactor assetbundle loading methods a bit * prime conductor stream playback to stabilize seeking operations * fix air rally swing on pad release * use virtual mouse pointer * add UniTask * make BeatAction use UniTask * implement UniTask to replace some coroutines * add touch style UI elements and effects games now support the ability to define two cursor colours if they need split screen touch inputs * update plugins and buildscript * implement thresholded pointer position clipping * fix clamping * instant show / hide fix discord game SDK crashes
111 lines
3.8 KiB
C#
111 lines
3.8 KiB
C#
using System;
|
|
using System.Collections;
|
|
using System.Collections.Generic;
|
|
using UnityEngine;
|
|
using Starpelly;
|
|
|
|
using HeavenStudio.Util;
|
|
|
|
namespace HeavenStudio.Games.Scripts_DoubleDate
|
|
{
|
|
public class SoccerBall : SuperCurveObject
|
|
{
|
|
private DoubleDate game;
|
|
private SuperCurveObject.Path path;
|
|
private double pathStartBeat = double.MinValue;
|
|
private Conductor conductor;
|
|
private GameObject shadow;
|
|
|
|
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)
|
|
{
|
|
game.ScheduleInput(beat, 1f, DoubleDate.InputAction_FlickPress, Just, Miss, Empty);
|
|
path = game.GetPath("SoccerIn");
|
|
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("SoccerNg" + (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("SoccerJust");
|
|
game.Kick();
|
|
SoundByte.PlayOneShotGame("doubleDate/kick");
|
|
}
|
|
|
|
void Miss(PlayerActionEvent caller)
|
|
{
|
|
SoundByte.PlayOneShotGame("doubleDate/weasel_hide");
|
|
game.MissKick(pathStartBeat + 2.25f);
|
|
|
|
BeatAction.New(this, new List<BeatAction.Action>()
|
|
{
|
|
new BeatAction.Action(conductor.songPositionInBeatsAsDouble + 4f, delegate
|
|
{
|
|
Destroy(gameObject);
|
|
}),
|
|
});
|
|
}
|
|
|
|
void Empty(PlayerActionEvent caller) { }
|
|
|
|
private void OnDestroy() {
|
|
if (shadow != null)
|
|
{
|
|
Destroy(shadow);
|
|
}
|
|
}
|
|
}
|
|
}
|