void HandleSpotClicked(object o, SpotEventArgs e) { if (!(ActivePlayer() is AI)) { Preview((Spot)o); } }
protected virtual void RaiseClicked(SpotEventArgs e) { if (Clicked != null) { Clicked(this, e); } }
protected virtual void RaiseEnabledChanged(SpotEventArgs e) { if (EnabledChanged != null) { EnabledChanged(this, e); } }
protected virtual void RaiseOwnerChanged(SpotEventArgs e) { if (OwnerChanged != null) // if there are some listeners { OwnerChanged(this, e); // notify all listeners } }
void HandleSpotEnabledChanged(object o, SpotEventArgs e) { Spot spot = (Spot)o; if (spot.Enabled) { availableSpots.Add(spot); } else { availableSpots.Remove(spot); } }
/// <summary> /// Change image to reflect the new owner /// </summary> /// <param name="o"></param> /// <param name="e"></param> public virtual void HandleSpotOwnerChanged(object o, SpotEventArgs e) { Player owner = o == null ? null : ((Spot)o).Owner; Image image = GetComponent <Image>(); if (owner != null) { image.sprite = owner.Sprite; image.color = owner.Color; } else // no owner, clear the spot { image.sprite = empty; // color irrelevant as empty sprite is transparent } }
/// <summary> /// Update the button and its colors to reflect the enabled state of spot /// </summary> /// <param name="o"></param> /// <param name="e"></param> public virtual void HandleSpotEnabledChanged(object o, SpotEventArgs e) { button.interactable = o == null ? false : ((Spot)o).Enabled; }
void HandleSpotOwnerChanged(object o, SpotEventArgs e) { Spot spot = (Spot)o; UpdateOwnerArray(spot.Loc, spot.Owner); }