The Team
class is a very simple ScriptableObject
containing a list of allied teams and an Editor-Only description:
public sealed class Team : ScriptableObject
{
[SerializeField]
[Tooltip("Other teams are enemies by default unless they are in this list")]
private Team[] _Allies;
public ref Team[] Allies => ref _Allies;
#if UNITY_EDITOR
[SerializeField, TextArea]
private string _EditorDescription;
#endif
}
This allows characters on opposing teams to hit each other while characters on the same or allied teams don't harm each other.
Enemies | Allies |
---|---|
There are currently 3 teams and you can create more by Right Clicking in the Project window and using the Create -> Platformer Game Kit -> Team
function.
Player | Green | Brown |
---|---|---|
The Player | Gobblers | All other monsters |