unity-atoms/Examples/Assets/Intro/GameObjects/Harmful/DecreasePlayersHealth.cs
Adam Ramberg c3bc59259f More WIP
2020-03-02 02:26:06 +01:00

22 lines
576 B
C#

using UnityEngine;
using UnityAtoms.Tags;
using UnityAtoms.BaseAtoms;
namespace UnityAtoms.Examples
{
[CreateAssetMenu(menuName = "Unity Atoms/Examples/Intro/Decrease Players Health")]
public sealed class DecreasePlayersHealth : Collider2DAction
{
[SerializeField]
private StringConstant _tagPlayer = null;
public override void Do(Collider2D collider)
{
if (collider.gameObject.HasTag(_tagPlayer))
{
collider.GetComponent<PlayerHealth>().Health.Value -= 10;
}
}
}
}