public BattleCommand(XmlElement commandInfo) { Label = commandInfo.GetAttribute("name"); Description = commandInfo.SelectSingleNode("description").InnerText.Trim(); string type = commandInfo.HasAttribute("expends") ? commandInfo.GetAttribute("expends") : ""; if (type.Equals("move")) { Expends = Type.Move; } else if (type.Equals("action")) { Expends = Type.Action; } else { Expends = Type.None; } XmlNode selectsInfo = commandInfo.SelectSingleNode("select"); if (selectsInfo != null) { foreach (XmlElement selectInfo in selectsInfo.ChildNodes) { Selections.Add(BattleCommandSelection.Parse(selectInfo)); } } XmlNode actionsInfo = commandInfo.SelectSingleNode("action"); if (actionsInfo != null) { foreach (XmlElement actionInfo in actionsInfo.ChildNodes) { Actions.Add(BattleCommandAction.Parse(actionInfo)); } } }
void CommandValidationManagement(BattleCommandAction.commandActionType actionType) { switch(actionType) { case BattleCommandAction.commandActionType.attack: if (enemyList.Length > 0) selectedTarget = enemyList[0]; else selectedTarget = playerList[0]; battleState = BattleState.playerChoosingAtkTarget; break; case BattleCommandAction.commandActionType.skill: //Activer le menu skills SkillSelect(); break; case BattleCommandAction.commandActionType.summon: //Invoque les Gardiens en combat! break; case BattleCommandAction.commandActionType.defend: Debug.Log("DEFENSE!"); //Creer un defend factor pour le tour -> force*defendFactor pendant l'attaque, 0.5 ou 1, réinitialiser au début de chaque tour pour chaque perso, ennemi comme allié selectedPlayer.defending = true; break; case BattleCommandAction.commandActionType.escape: //Mettre fin au combat en fonction d'on ne sait pas encore quoi break; } }