public void OnMouseDown() { Debug.Log("DEBUG - OBJECT WAS CLICKED: " + this.name); if (m_CharacterStats != null) { GameManager.GetCombatManager.OnCharacterSelected(m_CharacterStats); if (m_CharacterStats.IsPlayerControlled()) { GameManager.GetCombatManager.m_CombatUIController.UpdateActionButtonVisuals(true); } } }
public void PerformMultiDefensiveAction(GenericActionModel aAction, GenericCharacter aDefender) { Debug.Log("Performing multi defensive action"); Debug.Log("Action name from dictionary: " + aAction.GetActionName()); int hitTracking = 0; for (int i = 0; i < GameManager.GetPlayerManager.GetCharacterList().Count; i++) { GenericCharacter genericCharacter = GameManager.GetPlayerManager.GetCharacterList()[i]; if (genericCharacter.IsPlayerControlled() == true) { if (aAction.GetDoesActionDamage()) { ApplyDamage(genericCharacter, aDefender, aAction); hitTracking++; } if (aAction.GetDoesActionHeal()) { ApplyHeal(genericCharacter, aDefender, aAction); hitTracking++; } if (aAction.GetDoesActionHaveAffix()) { List <ActionData.AFFIX_LIST_ID> affixList = aAction.GetListOfAffixes(); if (affixList.Count != 0) { for (int j = 0; j < affixList.Count; j++) { ApplyAffix(genericCharacter, ActionData.AFFIX_DICTIONARY[affixList[j]]); } } } } } Debug.Log("Action hit " + hitTracking + " times"); }
//TODO: Deprecate private void UpdateNextCharacter() { m_TurnQueueIndex++; if (m_TurnQueueIndex > m_AllActionUsers.Count) { m_TurnQueueIndex = 0; } m_CurrentActionUser = m_AllActionUsers[m_TurnQueueIndex]; if (m_CurrentActionUser.IsPlayerControlled() == true) { m_CurrentPlayer = m_CurrentActionUser; } else { m_CurrentPlayer = null; } }
public void OnCharacterSelected(GenericCharacter aGenericCharacter) { if (m_CombatState == COMBAT_STATE.PLAYER_TURN) { //If it is the players turn, and we are selecting a player party member if (aGenericCharacter.IsPlayerControlled()) { //Do we have something selected already and is it not equal to the new selection? if (m_CurrentSelectedCharacter != aGenericCharacter) { //If we don't have a selected action and are just swapping characters if (m_CurrentSelectedAction == ActionData.ACTION_LIST_ID.NONE) { m_CurrentSelectedCharacter = aGenericCharacter; m_CombatUIController.GetInterfaceModel().UpdateListOfActions(); } else { //If we have an action and users selected... //Create perform action data and send it to be used //If it's single target, do this, else, the rest will be automatically sorted if (ActionData.ABILITY_DICTIONARY[m_CurrentSelectedAction].GetActionTargetAmount() == GenericActionModel.ACTION_TARGET_AMOUNT.SINGLE_TARGET) { PerformActionDataModel performActionDataModel = new PerformActionDataModel(m_CurrentSelectedAction, GenericActionModel.ACTION_TARGET_AMOUNT.SINGLE_TARGET, m_CurrentSelectedCharacter, aGenericCharacter); m_ActionController.PerformAction(performActionDataModel); } else if (ActionData.ABILITY_DICTIONARY[m_CurrentSelectedAction].GetActionTargetAmount() == GenericActionModel.ACTION_TARGET_AMOUNT.MULTI_TARGET_DEFENSIVE) { PerformActionDataModel performActionDataModel = new PerformActionDataModel(m_CurrentSelectedAction, GenericActionModel.ACTION_TARGET_AMOUNT.MULTI_TARGET_DEFENSIVE, m_CurrentSelectedCharacter); m_ActionController.PerformAction(performActionDataModel); } else { //Won't attack everyone on your team, perhaps change this? if (ActionData.ABILITY_DICTIONARY[m_CurrentSelectedAction].GetActionTargetAmount() == GenericActionModel.ACTION_TARGET_AMOUNT.MULTI_TARGET_OFFENSIVE && !aGenericCharacter.IsPlayerControlled()) { PerformActionDataModel performActionDataModel = new PerformActionDataModel(m_CurrentSelectedAction, ActionData.ABILITY_DICTIONARY[m_CurrentSelectedAction].GetActionTargetAmount(), m_CurrentSelectedCharacter); } else { Debug.Log("Can't offensive on teammates"); } } m_CurrentSelectedAction = ActionData.ACTION_LIST_ID.NONE; //TODO: Clean this up m_CombatUIController.SetAllUIInactive(); m_CombatUIController.SetEndTurnUIActive(); m_CombatUIController.SetMainSelectionState(); } } } //If it's the player turn, and we are selecting an enemy else { if (m_CurrentSelectedCharacter != null) { if (m_CurrentSelectedCharacter != aGenericCharacter) { //If we don't have something selected if (m_CurrentSelectedAction == ActionData.ACTION_LIST_ID.NONE) { //do nothing I guess...? } else { if (ActionData.ABILITY_DICTIONARY[m_CurrentSelectedAction].GetActionTargetAmount() == GenericActionModel.ACTION_TARGET_AMOUNT.SINGLE_TARGET) { PerformActionDataModel performActionDataModel = new PerformActionDataModel(m_CurrentSelectedAction, ActionData.ABILITY_DICTIONARY[m_CurrentSelectedAction].GetActionTargetAmount(), m_CurrentSelectedCharacter, aGenericCharacter); m_ActionController.PerformAction(performActionDataModel); } else { if (ActionData.ABILITY_DICTIONARY[m_CurrentSelectedAction].GetActionTargetAmount() == GenericActionModel.ACTION_TARGET_AMOUNT.MULTI_TARGET_OFFENSIVE) { PerformActionDataModel performActionDataModel = new PerformActionDataModel(m_CurrentSelectedAction, ActionData.ABILITY_DICTIONARY[m_CurrentSelectedAction].GetActionTargetAmount(), m_CurrentSelectedCharacter); m_ActionController.PerformAction(performActionDataModel); } else { Debug.Log("Can't use defensive on enemies."); } } m_CurrentSelectedAction = ActionData.ACTION_LIST_ID.NONE; //TODO: Clean this up m_CombatUIController.SetAllUIInactive(); m_CombatUIController.SetEndTurnUIActive(); m_CombatUIController.SetMainSelectionState(); } } } } } }