/// <summary> /// Adds object to selected list if is not on it already, /// otherwise removes it from that list. /// </summary> /// <param name="o">Object to toggle</param> /// <returns>Is selected</returns> private bool ToggleSelected(NKMObject o) { if (SelectedObjects.Contains(o)) { SelectedObjects.Remove(o); return(false); } SelectedObjects.Add(o); return(true); }
private void SpawnSpriteObject(NKMObject o) { GameObject spriteObject = Instantiate(SpriteObjectPrefab, Sprites.transform); var button = spriteObject.GetComponent <Button>(); button.onClick.AddListener(delegate { var isSelected = ToggleSelected(o); button.image.color = isSelected ? Color.white : Color.grey; }); button.image.color = Color.grey; button.image.sprite = Stuff.Sprites.CharacterHexagons.SingleOrDefault(c => c.name == o.Name); }
public void Reset() { // ((Ability)AbilityToUse)?.Finish(); if (IsActiveUse || Turn.IsDone) { CharacterOnMap?.Deselect(); } AbilityToUse = null; HexCells = null; NkmObject = null; SelectedCell = null; Action = Action.None; if (AirSelection.IsEnabled) { AirSelection.Disable(); } }
public void Cancel() { if (AbilityToUse != null) { ((Ability)AbilityToUse).Cancel(); Console.GameLog($"ABILITY CANCEL"); } else if (NkmObject != null) { Game.HexMapDrawer.RemoveHighlights(); NkmObject = null; } else { CharacterOnMap?.Deselect(); SelectedCell = null; } }