// Update is called once per frame void LateUpdate() { if (StateManager.Instance.State == GameState.targetingAbility) { if (Input.GetButtonDown("Cancel")) { Cancel(); } else if (Input.GetMouseButtonDown(0)) { Tile clicked = MousePosition.GetTile(); if (listener.GetAvailableTargets().Contains(clicked)) { StateManager.Instance.DebugPop(); listener.Notify(clicked); Tile.UnColourAll(); } } else if (_aoe == AreaOfEffect.Burst) { Tile.UnColourAll(); // colour tiles in the Area foreach (Tile t in _targets) { t.ColourMe(Color.green); } // colours tiles in the area of effect Tile mt = MousePosition.GetTile(); if (_targets.Contains(mt)) { foreach (Tile t in Burst(mt)) { t.ColourMe(Color.red); } } } else if (_aoe == AreaOfEffect.Line) { Tile.UnColourAll(); // colour tiles in the Area foreach (Tile t in _targets) { t.ColourMe(Color.green); } // colours tiles in the area of effect Tile mt = MousePosition.GetTile(); if (_targets.Contains(mt)) { foreach (Tile t in Line3(_orig, mt)) { t.ColourMe(Color.red); } } } } }
public void Listen(TargetedAbility listener, AreaOfEffect aoe = 0, Tile orig = null) { _aoe = aoe; _orig = orig; Tile.UnColourAll(); this.listener = listener; StateManager.Instance.DebugPush(GameState.targetingAbility); _targets = listener.GetAvailableTargets(); foreach (Tile t in _targets) { t.ColourMe(Color.green); } }