Games fixes/reworks patch (#501)

* ghosts are scaled now

* Lockstep fully reworked

* mr. bach has been implemented

* Space dance fixes

* oops

* Tap trial rework part 1

* tap trial rework part 2

* oopsie

* Gramps Talk Update

* Space Dance Voice Offsets

* Giraffe done! (Except miss anim)

* bg is not showing up for some reason

* bg not rendering fixed + giraffe fixed

* scrolling done

* fixed space dance and space soccer bg scrolls

* fixed rockers bugs

* adjustment

* fixed el inaccuracies

* particle fix

* changed pitch and volume of monkey tap

* miss anim

* megamix face for girl

* Proper miss anim implementation

* Added force stepping event

* miss anim fix

---------

Co-authored-by: saladplainzone <chocolate2890mail@gmail.com>
Co-authored-by: ev <85412919+evdial@users.noreply.github.com>
This commit is contained in:
Rapandrasmus
2023-07-13 02:35:47 +02:00
committed by minenice55
parent 2b1642a706
commit f3609125b7
94 changed files with 11089 additions and 2864 deletions

View File

@ -2,8 +2,6 @@ using System;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using DG.Tweening;
using HeavenStudio.Util;
namespace HeavenStudio.Games.Loaders
@ -26,61 +24,60 @@ namespace HeavenStudio.Games.Loaders
},
new GameAction("tap", "Tap")
{
function = delegate { TapTrial.instance.Tap(eventCaller.currentEntity.beat); },
defaultLength = 2.0f
},
new GameAction("double tap", "Double Tap")
{
function = delegate { TapTrial.instance.DoubleTap(eventCaller.currentEntity.beat); },
defaultLength = 2.0f
},
new GameAction("triple tap", "Triple Tap")
{
function = delegate { TapTrial.instance.TripleTap(eventCaller.currentEntity.beat); },
defaultLength = 4.0f
},
new GameAction("jump tap prep", "Prepare Stance")
{
function = delegate { TapTrial.instance.JumpTapPrep(eventCaller.currentEntity.beat); },
function = delegate { TapTrial.instance.JumpPrepare(); },
},
new GameAction("jump tap", "Jump Tap")
{
function = delegate { TapTrial.instance.JumpTap(eventCaller.currentEntity.beat); },
defaultLength = 2.0f
},
new GameAction("final jump tap", "Final Jump Tap")
{
function = delegate { TapTrial.instance.FinalJumpTap(eventCaller.currentEntity.beat); },
defaultLength = 2.0f
function = delegate { var e = eventCaller.currentEntity; TapTrial.instance.JumpTap(e.beat, e["final"]); },
defaultLength = 2.0f,
parameters = new List<Param>()
{
new Param("final", false, "Final")
}
},
new GameAction("scroll event", "Scroll Background")
{
function = delegate { TapTrial.instance.scrollEvent(eventCaller.currentEntity["toggle"], eventCaller.currentEntity["flash"]); },
defaultLength = .5f,
function = delegate { var e = eventCaller.currentEntity; TapTrial.instance.Scroll(e["toggle"], e["flash"], e["m"]); },
defaultLength = 1f,
parameters = new List<Param>()
{
new Param("toggle", true, "Scroll FX", "Will scroll"),
new Param("flash", false, "Flash FX", "Will flash to white"),
new Param("flash", true, "Flash FX", "Will flash to white"),
new Param("m", new EntityTypes.Float(0, 10, 1), "Speed Multiplier")
}
},
new GameAction("giraffe events", "Giraffe Animations")
{
function = delegate { TapTrial.instance.giraffeEvent(eventCaller.currentEntity["instant"]); },
defaultLength = .5f,
function = delegate { var e = eventCaller.currentEntity; TapTrial.instance.GiraffeAnims(e.beat, e.length, e["toggle"], e["instant"]); },
resizable = true,
parameters = new List<Param>()
{
new Param("toggle", true, "Enter?", "Giraffe will enter the scene"),
new Param("instant", false, "Instant", "Will the giraffe enter/exit instantly?")
new Param("toggle", TapTrial.GiraffeAnimation.Enter, "Animation", "Which animation?"),
new Param("instant", EasingFunction.Ease.Linear, "Ease", "Which ease will be used?")
}
}
},
// backwards-compatibility
new GameAction("final jump tap", "Final Jump Tap")
{
function = delegate { var e = eventCaller.currentEntity; TapTrial.instance.JumpTap(e.beat, true); },
defaultLength = 2.0f,
hidden = true
},
},
new List<string>() {"agb", "normal"},
"agbtap", "en",
@ -92,35 +89,30 @@ namespace HeavenStudio.Games.Loaders
namespace HeavenStudio.Games
{
using Scripts_TapTrial;
using HeavenStudio.Common;
using Scripts_TapTrial;
public class TapTrial : Minigame
{
[Header("References")]
public TapTrialPlayer player;
//public GameObject tap;
[SerializeField] List<Animator> monkeys;
[SerializeField] List<GameObject> monkey_roots;
[SerializeField] GameObject player_root;
//temporary
[SerializeField] List<GameObject> monkey_effects;
[SerializeField] List<GameObject> player_effects;
[SerializeField] Scroll scrollBG;
[SerializeField] SpriteRenderer flash;
[SerializeField] ScrollForTap scroll;
[SerializeField] GameObject giraffe;
bool goBop = true, isPrep;
bool hasJumped, isFinalJump;
public double jumpStartTime = double.MinValue;
float jumpPos;
public bool crIsRunning;
[SerializeField] GameObject bg;
bool giraffeIsIn;
[Header("Components")]
[SerializeField] private TapTrialPlayer player;
[SerializeField] private Animator monkeyL, monkeyR, giraffe;
[SerializeField] private ParticleSystem monkeyTapLL, monkeyTapLR, monkeyTapRL, monkeyTapRR;
[SerializeField] private Transform rootPlayer, rootMonkeyL, rootMonkeyR;
[SerializeField] private CanvasScroll bgScroll;
[SerializeField] private SpriteRenderer flash;
[Header("Values")]
[SerializeField] private float jumpHeight = 4f;
[SerializeField] private float monkeyJumpHeight = 3f;
[SerializeField] private float maxFlashOpacity = 0.8f;
public GameEvent bop = new GameEvent();
private GameEvent bop = new();
private bool canBop = true;
private bool shouldBop = true;
public static TapTrial instance { get; set; }
private double jumpStartBeat = double.MinValue;
public static TapTrial instance;
private void Awake()
{
@ -129,387 +121,365 @@ namespace HeavenStudio.Games
private void Update()
{
if (Conductor.instance.ReportBeat(ref bop.lastReportedBeat, bop.startBeat % 1))
var cond = Conductor.instance;
if (cond.isPlaying && !cond.isPaused)
{
if (goBop) SingleBop();
}
jumpPos = Conductor.instance.GetPositionFromBeat(jumpStartTime, 1f);
if (Conductor.instance.songPositionInBeatsAsDouble >= jumpStartTime && Conductor.instance.songPositionInBeatsAsDouble < jumpStartTime + 1f)
{
float yMul = jumpPos * 2f - 1f;
float yWeight = -(yMul * yMul) + 1f;
monkey_roots[0].transform.localPosition = new Vector3(0, 1.5f * yWeight);
monkey_roots[1].transform.localPosition = new Vector3(0, 1.5f * yWeight);
if (!isFinalJump)
if (shouldBop && cond.ReportBeat(ref bop.lastReportedBeat, bop.startBeat % 1))
{
player_root.transform.localPosition = new Vector3(0f, 2.5f * yWeight);
SingleBop();
}
GiraffeUpdate(cond);
JumpUpdate(cond);
ScrollUpdate(cond);
}
}
public void Scroll(bool scroll, bool flash, float multiplier)
{
scrolling = scroll;
flashing = flash;
scrollMultiplier = multiplier;
ResetScroll();
}
public void ResetScroll()
{
currentScrollSpeed = 0;
currentNormalizedY = 0;
flash.color = new Color(1, 1, 1, 0);
}
private bool scrolling;
private bool flashing;
[SerializeField] private float maxScrollSpeed = 0.25f;
[SerializeField] private float accelerationSpeed = 0.01f;
private float currentScrollSpeed = 0;
private float currentNormalizedY = 0;
private float scrollMultiplier = 1;
private void ScrollUpdate(Conductor cond)
{
if (!scrolling)
{
bgScroll.Normalized = Vector2.zero;
ResetScroll();
return;
}
currentNormalizedY += currentScrollSpeed * Time.deltaTime;
bgScroll.NormalizedY = currentNormalizedY * scrollMultiplier;
if (flashing) flash.color = new Color(1, 1, 1, Mathf.Lerp(0, maxFlashOpacity, currentNormalizedY));
currentScrollSpeed += accelerationSpeed * Time.deltaTime;
currentScrollSpeed = Mathf.Min(maxScrollSpeed, currentScrollSpeed);
}
private void GiraffeUpdate(Conductor cond)
{
float normalizedGiraffeBeat = cond.GetPositionFromBeat(animStartBeat, animLength);
EasingFunction.Function func = EasingFunction.GetEasingFunction(currentEase);
if (normalizedGiraffeBeat <= 1f && normalizedGiraffeBeat >= 0f)
{
switch (currentAnim)
{
case GiraffeAnimation.Enter:
giraffe.DoNormalizedAnimation("Enter", func(0, 1, normalizedGiraffeBeat));
break;
case GiraffeAnimation.Exit:
giraffe.DoNormalizedAnimation("Exit", func(0, 1, normalizedGiraffeBeat));
break;
default: break;
}
}
}
private void JumpUpdate(Conductor cond)
{
float normalizedJumpBeat = cond.GetPositionFromBeat(jumpStartBeat, 1);
if (normalizedJumpBeat >= 0 && normalizedJumpBeat <= 1)
{
if (normalizedJumpBeat >= 0.5f)
{
float normalizedUp = cond.GetPositionFromBeat(jumpStartBeat, 0.5);
EasingFunction.Function func = EasingFunction.GetEasingFunction(EasingFunction.Ease.EaseOutQuad);
float newPlayerY = func(0, jumpHeight, normalizedUp);
float newMonkeyY = func(0, monkeyJumpHeight, normalizedUp);
rootPlayer.localPosition = new Vector3(0, newPlayerY);
rootMonkeyL.localPosition = new Vector3(0, newMonkeyY);
rootMonkeyR.localPosition = new Vector3(0, newMonkeyY);
}
else
{
player_root.transform.localPosition = new Vector3(0f, 3.5f * yWeight);
float normalizedDown = cond.GetPositionFromBeat(jumpStartBeat + 0.5, 0.5);
EasingFunction.Function func = EasingFunction.GetEasingFunction(EasingFunction.Ease.EaseInQuad);
float newPlayerY = func(jumpHeight, 0, normalizedDown);
float newMonkeyY = func(monkeyJumpHeight, 0, normalizedDown);
rootPlayer.localPosition = new Vector3(0, newPlayerY);
rootMonkeyL.localPosition = new Vector3(0, newMonkeyY);
rootMonkeyR.localPosition = new Vector3(0, newMonkeyY);
}
}
else
{
monkey_roots[0].transform.localPosition = new Vector3(0, 0);
monkey_roots[1].transform.localPosition = new Vector3(0, 0);
player_root.transform.localPosition = new Vector3(0, 0);
if (hasJumped)
{
//Jukebox.PlayOneShotGame("fanClub/landing_impact", pitch: UnityEngine.Random.Range(0.95f, 1f), volume: 1f / 4);
}
hasJumped = false;
if (PlayerInput.Pressed() && !IsExpectingInputNow())
{
player.anim.Play("Tap", 0, 0);
SoundByte.PlayOneShotGame("tapTrial/tonk");
}
rootPlayer.localPosition = Vector3.zero;
rootMonkeyL.localPosition = Vector3.zero;
rootMonkeyR.localPosition = Vector3.zero;
}
}
void SingleBop()
public enum GiraffeAnimation
{
if (!isPrep)
Enter,
Exit,
Blink
}
private GiraffeAnimation currentAnim = GiraffeAnimation.Enter;
private double animStartBeat = -1;
private float animLength = 0;
private EasingFunction.Ease currentEase = EasingFunction.Ease.Linear;
public void GiraffeAnims(double beat, float length, int type, int ease)
{
animStartBeat = beat;
animLength = length;
currentAnim = (GiraffeAnimation)type;
currentEase = (EasingFunction.Ease)ease;
if (currentAnim == GiraffeAnimation.Blink) giraffe.DoScaledAnimationAsync("Blink", 0.5f);
}
public void Bop(double beat, float length, bool bop, bool autoBop)
{
shouldBop = autoBop;
if (bop)
{
if (monkeys[0].GetCurrentAnimatorStateInfo(0).IsName("Idle")) monkeys[0].DoScaledAnimationAsync("Bop", 0.5f);
if (monkeys[1].GetCurrentAnimatorStateInfo(0).IsName("Idle")) monkeys[1].DoScaledAnimationAsync("Bop", 0.5f);
if (player.anim.GetCurrentAnimatorStateInfo(0).IsName("Idle")) player.anim.DoScaledAnimationAsync("Bop", 0.5f);
List<BeatAction.Action> actions = new();
for (int i = 0; i < length; i++)
{
actions.Add(new BeatAction.Action(beat + i, delegate { SingleBop(); }));
}
BeatAction.New(gameObject, actions);
}
}
public void Bop(double beat, float length, bool isBopping, bool autoBop)
private void SingleBop()
{
goBop = autoBop;
if (isBopping)
{
for (int i = 0; i < length; i++)
{
BeatAction.New(instance.gameObject, new List<BeatAction.Action>()
{
new BeatAction.Action(beat + i, delegate { SingleBop(); })
});
}
}
if (!canBop) return;
PlayMonkeyAnimationScaledAsync("Bop", 0.5f);
player.Bop();
}
public void Tap(double beat)
{
isPrep = true;
SoundByte.PlayOneShotGame("tapTrial/ook");
player.anim.DoScaledAnimationAsync("TapPrepare", 0.5f);
//Monkey Tap Prepare Anim
BeatAction.New(gameObject, new List<BeatAction.Action>()
canBop = false;
BeatAction.New(instance.gameObject, new List<BeatAction.Action>()
{
new BeatAction.Action(beat, delegate { monkeys[0].DoScaledAnimationAsync("TapPrepare", 0.5f); }),
new BeatAction.Action(beat, delegate { monkeys[1].DoScaledAnimationAsync("TapPrepare", 0.5f); }),
new BeatAction.Action(beat + 1f, delegate { monkeys[0].DoScaledAnimationAsync("Tap", 0.6f); particleEffectMonkeys(); }),
new BeatAction.Action(beat + 1f, delegate { monkeys[1].DoScaledAnimationAsync("Tap", 0.6f); }),
new BeatAction.Action(beat, delegate
{
PlayMonkeyAnimationScaledAsync("TapPrepare", 0.5f);
player.PrepareTap();
}),
new BeatAction.Action(beat + 1, delegate
{
PlayMonkeyAnimationScaledAsync("Tap", 0.5f);
MonkeyParticles(true);
}),
new BeatAction.Action(beat + 1.5, delegate
{
canBop = true;
})
});
//CreateTap(beat);
ScheduleInput(beat, 1f, InputType.STANDARD_DOWN, OnTap, OnTapMiss, OnEmpty);
BeatAction.New(gameObject, new List<BeatAction.Action>()
MultiSound.Play(new MultiSound.Sound[]
{
new BeatAction.Action(beat + 1.5f, delegate { isPrep = false; })
new MultiSound.Sound("tapTrial/ook", beat),
new MultiSound.Sound("tapTrial/tapMonkey", beat + 1, 1.4f, 0.5f),
});
ScheduleInput(beat, 1, InputType.STANDARD_DOWN, JustTap, Miss, Empty);
}
public void DoubleTap(double beat)
{
isPrep = true;
canBop = false;
BeatAction.New(instance.gameObject, new List<BeatAction.Action>()
{
new BeatAction.Action(beat, delegate
{
PlayMonkeyAnimationScaledAsync("DoubleTapPrepare", 0.5f);
player.PrepareTap(true);
}),
new BeatAction.Action(beat + 0.5, delegate
{
PlayMonkeyAnimationScaledAsync("DoubleTapPrepare_2", 0.5f);
}),
new BeatAction.Action(beat + 1, delegate
{
PlayMonkeyAnimationScaledAsync("DoubleTap", 0.5f);
MonkeyParticles(false);
}),
new BeatAction.Action(beat + 1.5, delegate
{
PlayMonkeyAnimationScaledAsync("DoubleTap", 0.5f);
MonkeyParticles(false);
canBop = true;
}),
});
MultiSound.Play(new MultiSound.Sound[]
{
new MultiSound.Sound("tapTrial/ookook", beat),
new MultiSound.Sound("tapTrial/ookook", beat + 0.5f)
new MultiSound.Sound("tapTrial/ookook", beat),
new MultiSound.Sound("tapTrial/ookook", beat + 0.5),
new MultiSound.Sound("tapTrial/tapMonkey", beat + 1, 1.4f, 0.5f),
new MultiSound.Sound("tapTrial/tapMonkey", beat + 1.5, 1.4f, 0.5f),
});
player.anim.DoScaledAnimationAsync("DoubleTapPrepare", 0.5f);
BeatAction.New(gameObject, new List<BeatAction.Action>()
{
new BeatAction.Action(beat, delegate { monkeys[0].DoScaledAnimationAsync("DoubleTapPrepare", 0.5f); }),
new BeatAction.Action(beat + .5f, delegate { monkeys[0].DoScaledAnimationAsync("DoubleTapPrepare_2", 0.5f); }),
new BeatAction.Action(beat + 1f, delegate { monkeys[0].DoScaledAnimationAsync("DoubleTap", 0.6f); particleEffectMonkeys(); }),
new BeatAction.Action(beat + 1.5f, delegate { monkeys[0].DoScaledAnimationAsync("DoubleTap", 0.6f); particleEffectMonkeys(); }),
new BeatAction.Action(beat + 1.99f, delegate {monkeys[0].Play("Idle", 0, 0); }),
});
BeatAction.New(gameObject, new List<BeatAction.Action>()
{
new BeatAction.Action(beat, delegate { monkeys[1].DoScaledAnimationAsync("DoubleTapPrepare", 0.5f); }),
new BeatAction.Action(beat + .5f, delegate { monkeys[1].DoScaledAnimationAsync("DoubleTapPrepare_2", 0.5f); }),
new BeatAction.Action(beat + 1f, delegate { monkeys[1].DoScaledAnimationAsync("DoubleTap", 0.6f); }),
new BeatAction.Action(beat + 1.5f, delegate { monkeys[1].DoScaledAnimationAsync("DoubleTap", 0.6f); }),
new BeatAction.Action(beat + 1.99f, delegate {monkeys[1].Play("Idle", 0, 0); }),
});
BeatAction.New(gameObject, new List<BeatAction.Action>()
{
new BeatAction.Action(beat + 1.5f, delegate { isPrep = false; })
});
ScheduleInput(beat, 1f, InputType.STANDARD_DOWN, OnDoubleTap, OnTapMiss, OnEmpty);
ScheduleInput(beat, 1.5f, InputType.STANDARD_DOWN, OnDoubleTap, OnTapMiss, OnEmpty);
ScheduleInput(beat, 1, InputType.STANDARD_DOWN, JustDoubleTap, Miss, Empty);
ScheduleInput(beat, 1.5, InputType.STANDARD_DOWN, JustDoubleTap, Miss, Empty);
}
public void TripleTap(double beat)
{
isPrep = true;
canBop = false;
BeatAction.New(instance.gameObject, new List<BeatAction.Action>()
{
new BeatAction.Action(beat, delegate
{
player.PrepareTripleTap(beat);
PlayMonkeyAnimationScaledAsync("PostPrepare_1", 0.5f);
}),
new BeatAction.Action(beat + 0.5, delegate
{
PlayMonkeyAnimationScaledAsync("PostPrepare_2", 0.5f);
}),
new BeatAction.Action(beat + 2, delegate
{
PlayMonkeyAnimationScaledAsync("PostTap", 0.5f);
MonkeyParticles(true);
}),
new BeatAction.Action(beat + 2.5, delegate
{
PlayMonkeyAnimationScaledAsync("PostTap_2", 0.5f);
MonkeyParticles(false);
}),
new BeatAction.Action(beat + 3, delegate
{
PlayMonkeyAnimationScaledAsync("PostTap", 0.5f);
MonkeyParticles(true);
}),
});
MultiSound.Play(new MultiSound.Sound[]
{
new MultiSound.Sound("tapTrial/ooki1", beat),
new MultiSound.Sound("tapTrial/ooki2", beat + 0.5f)
new MultiSound.Sound("tapTrial/ooki1", beat),
new MultiSound.Sound("tapTrial/ooki2", beat + 0.5),
new MultiSound.Sound("tapTrial/tapMonkey", beat + 2, 1.4f, 0.5f),
new MultiSound.Sound("tapTrial/tapMonkey", beat + 2.5, 1.4f, 0.5f),
new MultiSound.Sound("tapTrial/tapMonkey", beat + 3, 1.4f, 0.5f),
});
player.tripleOffset = 0;
BeatAction.New(gameObject, new List<BeatAction.Action>()
{
new BeatAction.Action(beat, delegate { player.anim.Play("PosePrepare_1", 0, 0);}),
new BeatAction.Action(beat + .5f, delegate { player.anim.Play("PosePrepare_2", 0, 0);}),
});
BeatAction.New(gameObject, new List<BeatAction.Action>()
{
new BeatAction.Action(beat, delegate { monkeys[0].Play("PostPrepare_1", 0, 0); }),
new BeatAction.Action(beat + .5f, delegate { monkeys[0].Play("PostPrepare_2", 0, 0); }),
new BeatAction.Action(beat + 2f, delegate { monkeys[0].Play("PostTap", 0, 0); }),
new BeatAction.Action(beat + 2.5f, delegate { monkeys[0].Play("PostTap_2", 0, 0); }),
new BeatAction.Action(beat + 3f, delegate { monkeys[0].Play("PostTap", 0, 0);}),
});
BeatAction.New(gameObject, new List<BeatAction.Action>()
{
new BeatAction.Action(beat, delegate { monkeys[1].Play("PostPrepare_1", 0, 0); }),
new BeatAction.Action(beat + .5f, delegate { monkeys[1].Play("PostPrepare_2", 0, 0); }),
new BeatAction.Action(beat + 2f, delegate { monkeys[1].Play("PostTap", 0, 0); }),
new BeatAction.Action(beat + 2.5f, delegate { monkeys[1].Play("PostTap_2", 0, 0);}),
new BeatAction.Action(beat + 3f, delegate { monkeys[1].Play("PostTap", 0, 0);}),
});
BeatAction.New(gameObject, new List<BeatAction.Action>()
{
new BeatAction.Action(beat + 2f, delegate { particleEffectMonkeys(); }),
new BeatAction.Action(beat + 2.5f, delegate { particleEffectMonkeys(); }),
new BeatAction.Action(beat + 3f, delegate { particleEffectMonkeys(); }),
});
ScheduleInput(beat, 2f, InputType.STANDARD_DOWN, OnTripleTap, OnTapMiss, OnEmpty);
ScheduleInput(beat, 2.5f, InputType.STANDARD_DOWN, OnTripleTap, OnTapMiss, OnEmpty);
ScheduleInput(beat, 3f, InputType.STANDARD_DOWN, OnTripleTap, OnTapMiss, OnEmpty);
BeatAction.New(gameObject, new List<BeatAction.Action>()
{
new BeatAction.Action(beat + 4f, delegate { isPrep = false; })
});
ScheduleInput(beat, 2, InputType.STANDARD_DOWN, JustTripleTap, Miss, Empty);
ScheduleInput(beat, 2.5, InputType.STANDARD_DOWN, JustTripleTap, Miss, Empty);
ScheduleInput(beat, 3, InputType.STANDARD_DOWN, JustTripleTap, Miss, Empty);
}
public void JumpTap(double beat)
public void JumpPrepare()
{
isPrep = true;
hasJumped = true;
SoundByte.PlayOneShotGame("tapTrial/jumptap1");
player.anim.Play("JumpTap", 0, 0);
BeatAction.New(gameObject, new List<BeatAction.Action>()
{
new BeatAction.Action(beat, delegate {jumpStartTime = Conductor.instance.songPositionInBeatsAsDouble;}),
new BeatAction.Action(beat, delegate {monkeys[0].Play("JumpTap", 0, 0); }),
new BeatAction.Action(beat, delegate {monkeys[1].Play("JumpTap", 0, 0); }),
new BeatAction.Action(beat + 1f, delegate { particleEffectMonkeys(); monkeys[0].Play("Jumpactualtap", 0, 0); monkeys[1].Play("Jumpactualtap", 0, 0); }),
new BeatAction.Action(beat + 1f, delegate { particleEffectMonkeys_2(); }),
});
ScheduleInput(beat, 1f, InputType.STANDARD_DOWN, OnJumpTap, OnJumpTapMiss, OnEmpty); //why would it be .95f? no idea, sounds fine w/ 1f
BeatAction.New(gameObject, new List<BeatAction.Action>()
{
new BeatAction.Action(beat + 2f, delegate { isPrep = false; })
});
canBop = false;
player.PrepareJump();
PlayMonkeyAnimationScaledAsync("JumpPrepare", 0.5f);
}
public void JumpTapPrep(double beat)
public void JumpTap(double beat, bool final)
{
isPrep = true;
monkeys[0].Play("JumpPrepare", 0, 0);
monkeys[1].Play("JumpPrepare", 0, 0);
player.anim.Play("JumpPrepare", 0, 0);
}
public void FinalJumpTap(double beat)
{
isPrep = true;
hasJumped = true;
isFinalJump = true;
SoundByte.PlayOneShotGame("tapTrial/jumptap2");
player.anim.Play("FinalJump");
canBop = false;
jumpStartBeat = beat;
BeatAction.New(gameObject, new List<BeatAction.Action>()
{
new BeatAction.Action(beat, delegate {jumpStartTime = Conductor.instance.songPositionInBeatsAsDouble;}),
new BeatAction.Action(beat, delegate {monkeys[0].Play("Jump", 0, 0); }),
new BeatAction.Action(beat, delegate {monkeys[1].Play("Jump", 0, 0); }),
new BeatAction.Action(beat + 1f, delegate { monkeys[0].Play("FinalJumpTap", 0, 0); particleEffectMonkeys(); particleEffectMonkeys_2(); }),
new BeatAction.Action(beat + 1f, delegate { monkeys[1].Play("FinalJumpTap", 0, 0); }),
});
ScheduleInput(beat, 1f, InputType.STANDARD_DOWN, OnJumpFinalTap, OnFinalJumpTapMiss, OnEmpty);
BeatAction.New(gameObject, new List<BeatAction.Action>()
{
new BeatAction.Action(beat + 2f, delegate { isPrep = false; })
});
}
public void giraffeEvent(bool instant)
{
float animTime = 0;
if (instant) animTime = 1;
if (!giraffeIsIn)
{
giraffe.SetActive(true);
giraffe.GetComponent<Animator>().Play("Enter", 0, animTime);
giraffeIsIn = true;
}
else if (giraffeIsIn)
{
giraffe.GetComponent<Animator>().Play("Exit", 0, animTime);
giraffeIsIn = false;
}
}
public void scrollEvent(bool isScrolling, bool flashToWhite)
{
if (isScrolling)
{
if (!crIsRunning) // if coroutine is not running, play the following once
new BeatAction.Action(beat, delegate
{
if (flashToWhite)
{
Sequence sequence = DOTween.Sequence();
sequence.Append(flash.DOColor(new Color(flash.color.r, flash.color.g, flash.color.b, .8f), 2f));
//sequence.Kill();
}
StartCoroutine(timer());
}
}
else //should be the reverse of the code above
{
scrollBG.enabled = false;
scrollBG.scrollSpeedY = 0;
}
}
#region Player Action Scripts
public void OnTap(PlayerActionEvent caller, float beat)
{
SoundByte.PlayOneShotGame("tapTrial/tap");
player.anim.DoScaledAnimationAsync("Tap", 0.6f);
player_effects[0].GetComponent<ParticleSystem>().Play();
}
public void OnDoubleTap(PlayerActionEvent caller, float beat)
{
SoundByte.PlayOneShotGame("tapTrial/tap");
player.anim.DoScaledAnimationAsync("DoubleTap", 0.6f);
player_effects[1].GetComponent<ParticleSystem>().Play();
}
public void OnTapMiss(PlayerActionEvent caller)
{
SoundByte.PlayOneShotGame("tapTrial/tapMonkey", pitch: 1.5f, volume: .3f);
}
public void OnJumpTapMiss(PlayerActionEvent caller)
{
SoundByte.PlayOneShotGame("tapTrial/tapMonkey", pitch: 1.5f, volume: .3f);
player.anim.Play("JumpTap_Miss", 0, 0);
}
public void OnFinalJumpTapMiss(PlayerActionEvent caller)
{
SoundByte.PlayOneShotGame("tapTrial/tapMonkey", pitch: 1.5f, volume: .3f);
player.anim.Play("FinalJump_Miss", 0, 0);
}
public void OnEmpty(PlayerActionEvent caller)
{
//empty
}
public void OnTripleTap(PlayerActionEvent caller, float beat)
{
if (player.tripleOffset % 2 == 0)
{
BeatAction.New(gameObject, new List<BeatAction.Action>()
player.Jump(final);
PlayMonkeyAnimationScaledAsync(final ? "Jump" : "JumpTap", 0.5f);
}),
new BeatAction.Action(beat + 1, delegate
{
new BeatAction.Action(beat, delegate { player.anim.Play("PoseTap_L", 0, 0); })
});
player.tripleOffset += 1;
}
else
{
BeatAction.New(gameObject, new List<BeatAction.Action>()
PlayMonkeyAnimationScaledAsync(final ? "FinalJumpTap" : "Jumpactualtap", 0.5f);
MonkeyParticles(true);
MonkeyParticles(false);
}),
new BeatAction.Action(beat + 1.5, delegate
{
new BeatAction.Action(beat, delegate { player.anim.Play("PoseTap_R", 0, 0); })
});
player.tripleOffset += 1;
}
player_effects[0].GetComponent<ParticleSystem>().Play();
SoundByte.PlayOneShotGame("tapTrial/tap");
}
public void OnJumpTap(PlayerActionEvent caller, float beat)
{
SoundByte.PlayOneShotGame("tapTrial/tap");
player.anim.Play("JumpTap_Success", 0, 0);
player_effects[0].GetComponent<ParticleSystem>().Play();
player_effects[1].GetComponent<ParticleSystem>().Play();
}
public void OnJumpFinalTap(PlayerActionEvent caller, float beat)
{
SoundByte.PlayOneShotGame("tapTrial/tap");
player.anim.Play("FinalJump_Tap");
player_effects[0].GetComponent<ParticleSystem>().Play();
player_effects[1].GetComponent<ParticleSystem>().Play();
isFinalJump = false;
}
#endregion
canBop = final;
})
});
#region Misc. Functions
public void particleEffectMonkeys()
{
monkey_effects[0].GetComponent<ParticleSystem>().Play();
monkey_effects[1].GetComponent<ParticleSystem>().Play();
}
public void particleEffectMonkeys_2()
{
monkey_effects[2].GetComponent<ParticleSystem>().Play();
monkey_effects[3].GetComponent<ParticleSystem>().Play();
}
IEnumerator timer()
{
crIsRunning = true;
while (scroll.scrollSpeedY < 20)
MultiSound.Play(new MultiSound.Sound[]
{
scroll.scrollSpeedY += 5f;
yield return new WaitForSecondsRealtime(.5f);
}
}
#endregion
new MultiSound.Sound(final ? "tapTrial/jumptap2" : "tapTrial/jumptap1", beat),
new MultiSound.Sound("tapTrial/tapMonkey", beat + 1, 1.4f, 0.5f),
});
//this is the orig way for input handling
//public void CreateTap(float beat, int type = 0)
//{
// GameObject _tap = Instantiate(tap);
// _tap.transform.parent = tap.transform.parent;
// _tap.SetActive(true);
// Tap t = _tap.GetComponent<Tap>();
// t.startBeat = beat;
// t.type = type;
//}
ScheduleInput(beat, 1, InputType.STANDARD_DOWN, final ? JustJumpTapFinal : JustJumpTap, final ? MissJumpFinal : MissJump, Empty);
}
private void JustJumpTap(PlayerActionEvent caller, float state)
{
player.JumpTap(state < 1f && state > -1f, false);
}
private void JustJumpTapFinal(PlayerActionEvent caller, float state)
{
player.JumpTap(state < 1f && state > -1f, true);
}
private void MissJump(PlayerActionEvent caller)
{
player.JumpTapMiss(false);
if (giraffe.IsAnimationNotPlaying()) giraffe.DoScaledAnimationAsync("Miss", 0.5f);
ResetScroll();
}
private void MissJumpFinal(PlayerActionEvent caller)
{
player.JumpTapMiss(true);
if (giraffe.IsAnimationNotPlaying()) giraffe.DoScaledAnimationAsync("Miss", 0.5f);
ResetScroll();
}
private void JustTap(PlayerActionEvent caller, float state)
{
player.Tap(state < 1f && state > -1f);
}
private void JustDoubleTap(PlayerActionEvent caller, float state)
{
player.Tap(state < 1f && state > -1f, true);
}
private void JustTripleTap(PlayerActionEvent caller, float state)
{
player.TripleTap(state < 1f && state > -1f);
}
private void Miss(PlayerActionEvent caller)
{
if (giraffe.IsAnimationNotPlaying() && currentAnim != GiraffeAnimation.Exit) giraffe.DoScaledAnimationAsync("Miss", 0.5f);
ResetScroll();
}
private void Empty(PlayerActionEvent caller) { }
private void PlayMonkeyAnimationScaledAsync(string name, float timeScale)
{
monkeyL.DoScaledAnimationAsync(name, timeScale);
monkeyR.DoScaledAnimationAsync(name, timeScale);
}
private void MonkeyParticles(bool left)
{
ParticleSystem spawnedEffectL = Instantiate(left ? monkeyTapLL : monkeyTapLR, transform);
spawnedEffectL.Play();
ParticleSystem spawnedEffectR = Instantiate(left ? monkeyTapRL : monkeyTapRR, transform);
spawnedEffectR.Play();
}
}
}