using System.Collections.Generic; using UnityEngine; namespace Core.Health { /// /// A simple scriptable object that defines which other alignments it can harm. It can never harm /// any other alignment that's not a SimpleAlignment /// [CreateAssetMenu(fileName = "Alignment.asset", menuName = "StarterKit/Simple Alignment", order = 1)] public class SimpleAlignment : ScriptableObject, IAlignmentProvider { /// /// A collection of other alignment objects that we can harm /// public List opponents; /// /// Gets whether the given alignment is in our known list of opponents /// public bool CanHarm(IAlignmentProvider other) { if (other == null) { return true; } var otherAlignment = other as SimpleAlignment; return otherAlignment != null && opponents.Contains(otherAlignment); } } }