/// <summary> /// This is like an update function /// </summary> public void DoAction() { if (this.actionPermitted == false) { return; } ControllableUnit enemyUnit = BattleComposition.Instance.GetUnitAtTeamB(0); ControllableUnit playerUnit = BattleComposition.Instance.GetUnitAtTeamA(0); //TODO: just get first player unit ISkill normalSkill = SkillsManager.Instance.GetSkill(enemyUnit.GetUnitIdentity(), SkillNamesHolder.NORMAL_ATTACK_SKILL); normalSkill.AddOnFinishAction(this.OnSkillFinished); normalSkill.Perform(enemyUnit, playerUnit); this.actionPermitted = false; }
public void DoAction() { //like an update function if (this.performAction == false) { return; } //get selected controllable unit to apply skill ControllableUnit controllableUnit = BattleInputController.Instance.GetLastTouchedUnit(); ControllableUnit selectedUnit = BattleComposition.Instance.GetUnitAtTeamA(0); //select 1st unit for the meantime. if (controllableUnit != null && controllableUnit != selectedUnit) { Debug.Log("Hoooman selected " + controllableUnit); this.performAction = false; ISkill normalSkill = SkillsManager.Instance.GetSkill(selectedUnit.GetUnitIdentity(), SkillNamesHolder.NORMAL_ATTACK_SKILL); normalSkill.AddOnFinishAction(this.OnSkillFinished); normalSkill.Perform(selectedUnit, controllableUnit); BattleInputController.Instance.ReleaseTouchedUnit(); } }