twinStick/twinStickCrawler/Assets/Scripts/Creatures/Boxsack/BoxsackVitalReaction.cs

33 lines
878 B
C#
Raw Normal View History

2024-12-27 19:01:20 +00:00
using System;
2024-12-27 22:56:58 +00:00
using System.Collections.Generic;
2024-12-24 20:40:18 +00:00
using UnityEngine;
2024-12-27 22:56:58 +00:00
using Random = Unity.Mathematics.Random;
2024-12-24 20:40:18 +00:00
namespace Creatures.Boxsack
{
public class BoxsackVitalReaction : MonoBehaviour, IVitalReaction
{
2024-12-27 19:01:20 +00:00
public Animation boxsackAnimation;
2024-12-27 22:56:58 +00:00
public List<AudioClip> hitSounds;
[Range(0f, 1f)]
public float hitSoundVolume;
2024-12-27 19:01:20 +00:00
2024-12-24 20:40:18 +00:00
public void Hit()
{
2024-12-27 19:01:20 +00:00
boxsackAnimation.Stop();
boxsackAnimation.Play("HitAnimation");
2024-12-27 22:56:58 +00:00
Random rnd = new Random((uint)DateTime.Now.Ticks);
AudioSource.PlayClipAtPoint(hitSounds[rnd.NextInt(0, hitSounds.Count)], transform.position, hitSoundVolume);
2024-12-24 20:40:18 +00:00
print("Boxsack Vital Reaction Hit");
}
public void Heal()
{
print("Boxsack Vital Reaction Heal");
}
}
}