1f03646118
* basic setup+inputs this is gonna be so annoying to optimize i am SO overwhelmed with the options that i have object pooling, disabling the monkeys, literally just placing them manually... idk. * custom monkeys + more setup stuff it's all coming together . * a few tweaks committing to update the spritesheet * hi ev * player stuff * player anims * particles * more of prefab * upscale for this sheet * prefab more * oops * anims n stuff * assign the stuff, a little bit of rotation * better sheet * balloon sheet * particles * Revert "particles" This reverts commitfe4d589731
. * Revert "Revert "particles"" This reverts commitce117b280d
. * fixed the watch outline + pink monkey prefab variant the bccad really is a life saver * anims for monkeys * convert to dictionary yippee for dictionaries * better camera * click animations are all done * custom monkeys are actually good now :) * prefab adjustments * oopps2 * tweaked particles * inactive monkeys/custom monkeys + prefab fixes they should work perfectly now, and the prefab should also need no further adjustment hopefully... * many animations * click fixes * the prefab needed One more adjustment * oops again hopefully the shadow is good now * sheet adjustment * all yellow anims done * progress. starting on the monkeys appear block rn, and then i'll work on the monkey spawning logic. honestly should be pretty easy (and i DON'T think this will be something i look back on as if i was crazy 😄 ) * open / close hole * monkey spawning working better * pink monkey anims * clean slate * gonna test something * proper camera * Camera movements done * pink monkey sounds and a small bug fix * clock arrow now moves * gettin ready to spawn el monkeys * monkeys should spawn now ig * bug fixes * oops * monkeys appear added * more fixes yahoo * shadow tweak * bug fixes * zoom out beginnings * hour more smooth * smooth minute too * it now zooms out lol * middle monkey * oopsie doopsie * hot air balloon * oops * anim * disappear fix * ticks on input now * prepare earlier * tiny tweak * oops again * fixed the input bug * holes * middle monkey anims * fixed layering * zoom out tweaks and shadow movement * camera tweak * tweaks * quad * camera tweak * quart * inspcetor * shadow correct * Okay * zoom out seperation * instant * balloon movement * balloon fixed * fixed particle * icon * fixed beataction parameters * monkey watch camera refactor run sourcegen --------- Co-authored-by: AstrlJelly <bdlawson115@gmail.com> Co-authored-by: ev <85412919+evdial@users.noreply.github.com> Co-authored-by: minenice55 <star.elementa@gmail.com>
116 lines
3.9 KiB
C#
116 lines
3.9 KiB
C#
using System.Collections;
|
|
using System.Collections.Generic;
|
|
using UnityEngine;
|
|
using HeavenStudio.Util;
|
|
using Starpelly;
|
|
|
|
namespace HeavenStudio.Games.Scripts_MonkeyWatch
|
|
{
|
|
public class MonkeyClockArrow : MonoBehaviour
|
|
{
|
|
[Header("Components")]
|
|
[SerializeField] private Animator anim;
|
|
[SerializeField] private Transform anchorRotateTransform;
|
|
[SerializeField] private Animator playerMonkeyAnim;
|
|
[SerializeField] private ParticleSystem yellowClap;
|
|
[SerializeField] private ParticleSystem pinkClap;
|
|
[SerializeField] private Transform shadowTrans;
|
|
[SerializeField] private Transform camMoveTrans;
|
|
[Header("Properties")]
|
|
[SerializeField] private float shadowXRange = 2f;
|
|
[SerializeField] private float shadowYRange = 1f;
|
|
|
|
private MonkeyWatch game;
|
|
|
|
private void Awake()
|
|
{
|
|
game = MonkeyWatch.instance;
|
|
}
|
|
|
|
private void Update()
|
|
{
|
|
if (PlayerInput.GetIsAction(MonkeyWatch.InputAction_BasicPress) && !game.IsExpectingInputNow(MonkeyWatch.InputAction_BasicPress))
|
|
{
|
|
PlayerClap(false, false, true);
|
|
}
|
|
}
|
|
|
|
public void Move()
|
|
{
|
|
anchorRotateTransform.localEulerAngles = new Vector3(0, 0, anchorRotateTransform.localEulerAngles.z - 6);
|
|
anim.DoScaledAnimationAsync("Click", 0.4f);
|
|
MoveShadow();
|
|
}
|
|
|
|
private void MoveShadow()
|
|
{
|
|
float realAngle = anchorRotateTransform.localEulerAngles.z % 360 - 360;
|
|
realAngle *= -1;
|
|
|
|
float x;
|
|
float y;
|
|
|
|
if (realAngle <= 180)
|
|
{
|
|
float normalizedAngle = Mathp.Normalize(realAngle, 0, 180);
|
|
x = Mathf.Lerp(0, shadowXRange, normalizedAngle);
|
|
}
|
|
else
|
|
{
|
|
float normalizedAngle = Mathp.Normalize(realAngle, 180, 360);
|
|
x = Mathf.Lerp(shadowXRange, 0, normalizedAngle);
|
|
}
|
|
|
|
float realAngleY = anchorRotateTransform.localEulerAngles.z % 180 - 180;
|
|
realAngleY *= -1;
|
|
|
|
if (realAngleY <= 90)
|
|
{
|
|
float normalizedAngle = Mathp.Normalize(realAngleY, 0, 90);
|
|
y = Mathf.Lerp(0, shadowYRange, normalizedAngle);
|
|
}
|
|
else
|
|
{
|
|
float normalizedAngle = Mathp.Normalize(realAngleY, 90, 180);
|
|
y = Mathf.Lerp(shadowYRange, 0, normalizedAngle);
|
|
}
|
|
shadowTrans.localPosition = new Vector3(x, y);
|
|
}
|
|
|
|
public void MoveToAngle(float angle)
|
|
{
|
|
anchorRotateTransform.localEulerAngles = new Vector3(0, 0, -angle);
|
|
}
|
|
|
|
public bool PlayerIsClapAnim()
|
|
{
|
|
return !playerMonkeyAnim.IsAnimationNotPlaying();
|
|
}
|
|
|
|
public void PlayerClap(bool big, bool barely, bool whiff)
|
|
{
|
|
if (playerMonkeyAnim.IsPlayingAnimationNames("PlayerClapBarely") && whiff) return;
|
|
if (whiff)
|
|
{
|
|
game.middleMonkey.DoScaledAnimationAsync("MiddleMonkeyMiss", 0.4f);
|
|
SoundByte.PlayOneShot("miss");
|
|
}
|
|
if (barely || whiff)
|
|
{
|
|
playerMonkeyAnim.DoScaledAnimationAsync("PlayerClapBarely", 0.4f);
|
|
}
|
|
else
|
|
{
|
|
playerMonkeyAnim.DoScaledAnimationAsync(big ? "PlayerClapBig" : "PlayerClap", 0.4f);
|
|
ParticleSystem clapToSpawn = big ? pinkClap : yellowClap;
|
|
ParticleSystem spawnedClap = Instantiate(clapToSpawn, camMoveTrans, true);
|
|
spawnedClap.transform.eulerAngles = Vector3.zero;
|
|
spawnedClap.transform.GetChild(0).GetComponent<ParticleSystem>().SetAsyncScaling(0.4f);
|
|
spawnedClap.PlayScaledAsync(0.4f);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|