HeavenStudio/Assets/Scripts/Games/TheDazzles/TheDazzlesGirl.cs
ev 5952d4d8d1
The Dazzles (#325)
* i Am trying

* changes

* i moved boxes by like 3 pixels

* particle

* done w the pose particle

* edited the particle a bit oops

* The dazzles is now initiliazed

* Lol added a script to the girl prefab

* girl

* Girl in scene activated

* Added animator to girl

* should be good now

* almost all the animations

* night walk stars

* oops

* scddfxcdx

* Got Started on the inputs

* Started on custom poses

* box stuff

* anim changes

* Custom poses!

* oops

* grr

* Box moment

* Stretchables crouch + star enable/disable dropdown

* fixed box animation

* anim fix again

* Bopping added

* Fixes to bops and other weird stuff

* mis s stuff

* oops

* Sound improvements

* blackflash is funky

* The heads are in... kinda

* Angy >:(

* small fix

* fixed heads

* fixed mouth

* Whiff inputs should be more accurate now

* Fixed every possible Issue I could find

* Fixed the lighting, only missing an icon now

* Force hold event added + sound fixes

* made them autobop by default

* anims fixes lol

* Fixed some inputs being inaccurate

* temp icon

* oops

* some tweaks and We are done!

* Count in is more accurate

* fixed the sounds yet again

* new icon

* oops

---------

Co-authored-by: Rapandrasmus <78219215+Rapandrasmus@users.noreply.github.com>
2023-03-03 04:24:02 +00:00

160 lines
4.6 KiB
C#

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using HeavenStudio.Util;
namespace HeavenStudio.Games.Scripts_TheDazzles
{
public class TheDazzlesGirl : MonoBehaviour
{
[SerializeField] List<Sprite> headSpriteEmotions = new List<Sprite>();
public enum Emotion
{
Neutral = 0,
Happy = 1,
Angry = 2,
Ouch = 3
}
public enum Expression
{
Neutral = 0,
Happy = 1,
Angry = 2,
Ouch = 3,
OpenMouth = 4
}
public bool canBop = true;
bool holding = false;
bool preparingPose = false;
public bool hasOuched;
public Emotion currentEmotion;
Animator anim;
[SerializeField] Animator lightingAnim;
[SerializeField] Animator holdEffectAnim;
[SerializeField] SpriteRenderer headSprite;
[SerializeField] GameObject blackFlash;
[SerializeField] List<SpriteRenderer> bodyParts = new List<SpriteRenderer>();
TheDazzles game;
void Awake()
{
anim = GetComponent<Animator>();
game = TheDazzles.instance;
}
public void PickHead(Expression expression)
{
headSprite.sprite = headSpriteEmotions[(int)expression];
}
public void Prepare(bool hit = true)
{
if (hit)
{
holdEffectAnim.DoScaledAnimationAsync("HoldBox", 0.25f);
blackFlash.SetActive(true);
lightingAnim.Play("Dark", 0, 0);
}
holding = true;
hasOuched = false;
if (preparingPose)
{
Hold();
return;
}
anim.Play("Prepare", 0, 0);
}
public void StartReleaseBox(float beat)
{
BeatAction.New(game.gameObject, new List<BeatAction.Action>()
{
new BeatAction.Action(beat - 1f, delegate {if (holding) holdEffectAnim.DoScaledAnimationAsync("ReleaseBox", 0.25f);})
});
}
public void Pose(bool hit = true)
{
if (hit)
{
anim.DoScaledAnimationAsync("Pose", 0.5f);
lightingAnim.DoScaledAnimationAsync("PoseFlash", 0.5f);
hasOuched = false;
}
else
{
anim.DoScaledAnimationAsync("MissPose", 0.5f);
lightingAnim.DoScaledAnimationAsync("MissFlash", 0.5f);
currentEmotion = Emotion.Ouch;
hasOuched = true;
}
holdEffectAnim.Play("HoldNothing", 0, 0);
holding = false;
preparingPose = false;
blackFlash.SetActive(false);
}
public void EndPose()
{
if (holding || hasOuched) return;
anim.DoScaledAnimationAsync("EndPose", 0.5f);
}
public void Hold()
{
preparingPose = true;
if (!holding) return;
anim.DoScaledAnimationAsync("Hold", 0.5f);
}
public void Ouch()
{
anim.DoScaledAnimationAsync("Ouch", 0.5f);
currentEmotion = Emotion.Ouch;
hasOuched = true;
}
public void UnPrepare()
{
game.ScoreMiss(1f);
holdEffectAnim.Play("HoldNothing", 0, 0);
canBop = true;
if (preparingPose)
{
anim.DoScaledAnimationAsync("StopHold", 0.5f);
}
else
{
anim.DoScaledAnimationAsync("EndPrepare", 0.5f);
}
holding = false;
preparingPose = false;
hasOuched = true;
blackFlash.SetActive(false);
lightingAnim.Play("Lit", 0, 0);
}
public void Bop()
{
if (!canBop || holding) return;
switch (currentEmotion)
{
case Emotion.Neutral:
anim.DoScaledAnimationAsync("IdleBop", 0.4f);
break;
case Emotion.Happy:
anim.DoScaledAnimationAsync("HappyBop", 0.4f);
break;
case Emotion.Angry:
PickHead(Expression.Angry);
anim.DoScaledAnimationAsync("IdleBop", 0.4f);
break;
case Emotion.Ouch:
anim.DoScaledAnimationAsync("OuchBop", 0.4f);
break;
}
}
}
}