Added animations to move the whole doll on a just/missed input. Fixed bugs with the default hand object not properly playing its animations due to its names previously being changed. Modernized the BG Colors event to have the whole easing dropdown in place of the "Fade?" toggle. Combined the spotlight recoloring section of the BG Colors event with the Hand Colors event to make the Object Colors event.
98 lines
2.8 KiB
C#
98 lines
2.8 KiB
C#
using HeavenStudio.Util;
|
|
using System;
|
|
using System.Collections;
|
|
using System.Collections.Generic;
|
|
using UnityEngine;
|
|
|
|
namespace HeavenStudio.Games.Scripts_ClapTrap
|
|
{
|
|
public class Sword : MonoBehaviour
|
|
{
|
|
public double cueStart;
|
|
public float cueLength;
|
|
public string cueType;
|
|
public bool spotlightToggle;
|
|
|
|
private Animator dollHead;
|
|
private Animator dollArms;
|
|
|
|
|
|
private ClapTrap game;
|
|
|
|
// Start is called before the first frame update
|
|
void Awake()
|
|
{
|
|
|
|
|
|
game = ClapTrap.instance;
|
|
dollHead = game.dollHead;
|
|
dollArms = game.dollArms;
|
|
}
|
|
|
|
void Start()
|
|
{
|
|
game.ScheduleInput((float)cueStart, cueLength, ClapTrap.InputAction_BasicPress, Hit, Miss, Out);
|
|
gameObject.SetActive(false);
|
|
}
|
|
|
|
// Update is called once per frame
|
|
void Update()
|
|
{
|
|
|
|
}
|
|
|
|
void KillYourselfNow()
|
|
{
|
|
GameObject.Destroy(gameObject);
|
|
}
|
|
|
|
private void Hit(PlayerActionEvent caller, float state)
|
|
{
|
|
if (state >= 1f || state <= -1f)
|
|
{
|
|
SoundByte.PlayOneShotGame($"clapTrap/barely{UnityEngine.Random.Range(1, 2)}");
|
|
dollHead.DoScaledAnimationAsync("HeadBarely", 0.5f);
|
|
}
|
|
else if (state >= -0.2 && state <= 0.2)
|
|
{
|
|
SoundByte.PlayOneShotGame($"clapTrap/aceClap{UnityEngine.Random.Range(1, 4)}");
|
|
dollHead.DoScaledAnimationAsync("HeadHit", 0.5f);
|
|
}
|
|
else
|
|
{
|
|
SoundByte.PlayOneShotGame($"clapTrap/goodClap{UnityEngine.Random.Range(1, 4)}");
|
|
dollHead.DoScaledAnimationAsync("HeadHit", 0.5f);
|
|
}
|
|
|
|
dollArms.DoScaledAnimationAsync("ArmsHit", 0.5f);
|
|
game.doll.DoScaledAnimationAsync("DollHit", 0.5f);
|
|
game.clapEffect.DoScaledAnimationAsync("ClapEffect", 0.5f);
|
|
|
|
gameObject.SetActive(true);
|
|
GetComponent<Animator>().DoScaledAnimationAsync("sword" + cueType + "Hit", 0.5f);
|
|
|
|
if (spotlightToggle) { game.currentSpotlightClaps -= 1; }
|
|
|
|
Debug.Log(state);
|
|
}
|
|
|
|
private void Miss(PlayerActionEvent caller)
|
|
{
|
|
SoundByte.PlayOneShotGame($"clapTrap/miss");
|
|
dollHead.DoScaledAnimationAsync("HeadMiss", 0.5f);
|
|
dollArms.DoScaledAnimationAsync("ArmsMiss", 0.5f);
|
|
game.doll.DoScaledAnimationAsync("DollMiss", 0.5f);
|
|
|
|
gameObject.SetActive(true);
|
|
GetComponent<Animator>().DoScaledAnimationAsync("sword" + cueType + "Miss", 0.5f);
|
|
|
|
if (spotlightToggle) { game.currentSpotlightClaps -= 1; }
|
|
}
|
|
|
|
private void Out(PlayerActionEvent caller)
|
|
{
|
|
|
|
}
|
|
}
|
|
}
|