mirror of
https://github.com/unity-atoms/unity-atoms.git
synced 2025-01-24 09:08:23 -05:00
23 lines
631 B
C#
23 lines
631 B
C#
using UnityEngine;
|
|
using UnityAtoms.Extensions;
|
|
using UnityEngine.Serialization;
|
|
|
|
namespace UnityAtoms.Examples
|
|
{
|
|
[CreateAssetMenu(menuName = "Unity Atoms/Examples/Intro/Decrease Players Health")]
|
|
public sealed class DecreasePlayersHealth : Collider2DAction
|
|
{
|
|
[FormerlySerializedAs("TagPlayer")]
|
|
[SerializeField]
|
|
private StringConstant _tagPlayer = null;
|
|
|
|
public override void Do(Collider2D collider)
|
|
{
|
|
if (collider.gameObject.HasTag(_tagPlayer))
|
|
{
|
|
collider.GetComponent<PlayerHealth>().Health.Value -= 10;
|
|
}
|
|
}
|
|
}
|
|
}
|