/*================================================================== * ACTION * ================================================================*/ public void ShowAction(int index) { if (!SelectAction(index)) { return; } mapManager.Mark(selectedUnit.unit.position, Marking.Orange); Marking mark = 0; if (action.type == ActionType.Attack) { mark = Marking.Red; } else if (action.type == ActionType.Buff) { mark = Marking.Purple; } mapManager.RemoveMarkings(); foreach (TargetTile targetTile in targets) { Marking m = mark; if (targetTile.type == TargetType.NotValid) { m = Marking.Orange; } mapManager.Mark(targetTile.point, m); } }
public IEnumerator NewRound(CombatMap map, bool firstRound = false) { Debug.Log(unit.position + " start"); isActive = true; spriteRenderer.material.color = Color.yellow; map.RemoveMarkings(); if (!firstRound) { if (unit.hasActionLeft) { Action action = unit.actions[0]; List <TargetTile> targets = action?.GetTargets(map, false); if (targets != null && action.CanUse() && action.GetTargets(map, false).Count > 0) { map.Mark(unit.position, Marking.Orange); map.Mark(targets[0].point, Marking.Red); yield return(new WaitForSeconds(.25f)); map.unitManager.PerformAction(this, action, targets[0].point); yield return(new WaitForSeconds(.75f)); map.RemoveMarkings(); } else if (unit.energy < unit.maxEnergy) { Effect(Attribute.Energy, 1); yield return(new WaitForSeconds(.5f)); } } } spriteRenderer.material.color = Color.white; bool triggered = unit.NewRound(map, firstRound); if (triggered) { yield return(new WaitForSeconds(.5f)); } Debug.Log(unit.position + " done"); isActive = false; }