public void Start() { if (WorldCrumbler.Instance != null) { WorldCrumbler.Instance.OnCrumble += OnCrumbleTurn; } else { // MDebug.Log("Möp"); } SelectibleObjectBase b = GetComponent <SelectibleObjectBase>(); if (b == null) { b = gameObject.AddComponent <SelectibleObjectBase>(); } b.OnHover += OnHover; b.OnHoverEnd += OnHoverEnd; b.OnSelect += delegate { TileSelecter.SelectTile(this); }; SetBaseState(); }
void Awake() { Inventory = GetComponent <UnitInventory>(); Stats = GetComponent <UnitStats>(); Stats.OnHPDepleted += KillUnit; Actions = GetComponent <ActionManager>(); Actions.SetOwner(this); Actions.OnActionSelected += ActionChanged; Actions.OnActionUnselected += ActionChanged; AllUnits.Add(this); SelectibleObjectBase b = GetComponent <SelectibleObjectBase>(); if (b == null) { b = gameObject.AddComponent <SelectibleObjectBase>(); } b.OnSelect += UnitSelected; b.OnHover += OnHover; b.OnHoverEnd += OnHoverEnd; }