예제 #1
0
    public void Test_AffixInteraction()
    {
        TestAffix1 testAffix1 = new TestAffix1();

        testAffix1.InitAffix();

        ActionData.AFFIX_DICTIONARY.Add(ActionData.AFFIX_LIST_ID.TEST_AFFIX_1, testAffix1);

        TestAction1 testAction1 = new TestAction1();

        testAction1.SetInitPropertiesSelfTarget();

        ActionData.ABILITY_DICTIONARY.Add(ActionData.ACTION_LIST_ID.ATTACK_BASIC, testAction1);

        Test_ListAllAffixesInDictionary();

        TestCharacter testChar1 = new TestCharacter();

        testChar1.InitChar(true);

        TestCharacter testChar2 = new TestCharacter();

        testChar2.InitChar(false);
        testChar2.m_Character.SetCharacterName("Enemy Test");

        GetPlayerManager.AddCharacterToList(testChar1.m_Character);
        GetPlayerManager.AddCharacterToList(testChar2.m_Character);



        PerformActionDataModel testDataModel = new PerformActionDataModel(ActionData.ACTION_LIST_ID.ATTACK_BASIC, GenericActionModel.ACTION_TARGET_AMOUNT.SINGLE_TARGET, testChar1.m_Character, testChar2.m_Character);

        GetCombatManager.ProcessAction(testDataModel);

        for (int i = 0; i < GetPlayerManager.GetCharacterList().Count; i++)
        {
            Debug.Log("Health - " + GetPlayerManager.GetCharacterList()[i].GetCharacterName() + " : " + GetPlayerManager.GetCharacterList()[i].GetCharacterHealth());
        }

        GetCombatManager.ProcessAffix();

        Debug.Log("Affixes Processed");

        for (int i = 0; i < GetPlayerManager.GetCharacterList().Count; i++)
        {
            Debug.Log("Health - " + GetPlayerManager.GetCharacterList()[i].GetCharacterName() + " : " + GetPlayerManager.GetCharacterList()[i].GetCharacterHealth());
        }

        Debug.Log("Test Case Over");
    }
예제 #2
0
    public void Test_CharacterInteraction2()
    {
        TestCharacter testChar1 = new TestCharacter();

        testChar1.InitChar(true);

        TestCharacter testChar2 = new TestCharacter();

        testChar2.InitChar(false);
        testChar2.m_Character.SetCharacterName("Enemy Test");

        PerformActionDataModel testDataModel = new PerformActionDataModel(ActionData.ACTION_LIST_ID.ATTACK_BASIC, GenericActionModel.ACTION_TARGET_AMOUNT.SINGLE_TARGET, testChar1.m_Character, testChar2.m_Character);

        GetCombatManager.ProcessAction(testDataModel);
    }
예제 #3
0
    //Expose UseAction()
    // -> Have it look at the information from the action and do stuff based on it.

    public void PerformAction(PerformActionDataModel aPerformActionDataModel)
    {
        Debug.Log("Performing Action");

        //TODO: Maybe make null checks around this
        GenericActionModel action         = ActionData.ABILITY_DICTIONARY[aPerformActionDataModel.GetActionID()];
        GenericCharacter   actionUser     = aPerformActionDataModel.GetAttackerData();
        GenericCharacter   actionDefender = aPerformActionDataModel.GetDefenderData();

        if (action != null)
        {
            switch (aPerformActionDataModel.GetTargetAmount())
            {
            case GenericActionModel.ACTION_TARGET_AMOUNT.SINGLE_TARGET:
                if (actionUser != actionDefender)
                {
                    PerformActionSingle(action, actionUser, actionDefender);
                }
                else if (actionUser == actionDefender)
                {
                    PerformSelfAction(action, actionUser);
                }
                break;

            case GenericActionModel.ACTION_TARGET_AMOUNT.ALL_TARGETS:
                PerformActionAll(action, actionUser);
                break;

            case GenericActionModel.ACTION_TARGET_AMOUNT.MULTI_TARGET_OFFENSIVE:
                PerformMultiOffensiveAction(action, actionUser);
                break;

            case GenericActionModel.ACTION_TARGET_AMOUNT.MULTI_TARGET_DEFENSIVE:
                PerformMultiDefensiveAction(action, actionUser);
                break;

            default:
                Debug.Log("Error: Action does not have a target amount type, or is set to none.");
                break;
            }
        }
        else
        {
            Debug.Log("ERROR: Action is null/does not exist!");
        }
    }
예제 #4
0
    public PerformActionDataModel CreatePerformActionDataModel(ActionData.ACTION_LIST_ID aActionID)
    {
        GenericActionModel     actionModel     = ActionData.ABILITY_DICTIONARY[aActionID];
        PerformActionDataModel actionDataModel = null;

        switch (actionModel.GetActionTargetAmount())
        {
        case GenericActionModel.ACTION_TARGET_AMOUNT.ALL_TARGETS:
            actionDataModel = new PerformActionDataModel(aActionID, GenericActionModel.ACTION_TARGET_AMOUNT.ALL_TARGETS, GetComponentInParent <GenericCharacterController>().GetCharacterStats());
            break;

        case GenericActionModel.ACTION_TARGET_AMOUNT.MULTI_TARGET_DEFENSIVE:
            actionDataModel = new PerformActionDataModel(aActionID, GenericActionModel.ACTION_TARGET_AMOUNT.MULTI_TARGET_DEFENSIVE, GetComponentInParent <GenericCharacterController>().GetCharacterStats());
            break;

        case GenericActionModel.ACTION_TARGET_AMOUNT.MULTI_TARGET_OFFENSIVE:
            actionDataModel = new PerformActionDataModel(aActionID, GenericActionModel.ACTION_TARGET_AMOUNT.MULTI_TARGET_OFFENSIVE, GetComponentInParent <GenericCharacterController>().GetCharacterStats());
            break;

        case GenericActionModel.ACTION_TARGET_AMOUNT.SINGLE_TARGET:
            GenericCharacter defender;

            if (actionModel.GetActionOffOrDef() == GenericActionModel.ACTION_OFF_OR_DEF.DEFENSIVE)
            {
                defender = GetRandomNonPlayerCharacter();
            }
            else
            {
                defender = GetRandomPlayerCharacter();
            }

            actionDataModel = new PerformActionDataModel(aActionID, GenericActionModel.ACTION_TARGET_AMOUNT.SINGLE_TARGET, GetComponentInParent <GenericCharacterController>().GetCharacterStats(), defender);
            break;

        case GenericActionModel.ACTION_TARGET_AMOUNT.NO_TARGETS:
        default:
            Debug.Log("ERROR: Tried to create an action model through the AI component but the target type is none or null.");
            break;
        }

        return(actionDataModel);
    }
예제 #5
0
    public void Test_ActionInteraction()
    {
        TestCharacter testChar1 = new TestCharacter();

        testChar1.InitChar(true);
        testChar1.m_Character.SetCharacterName("Player");

        TestCharacter testChar2 = new TestCharacter();

        testChar2.InitChar(false);

        TestCharacter testChar3 = new TestCharacter();

        testChar3.InitChar(false);

        GetPlayerManager.AddCharacterToList(testChar1.m_Character);
        GetPlayerManager.AddCharacterToList(testChar2.m_Character);
        GetPlayerManager.AddCharacterToList(testChar3.m_Character);

        PerformActionDataModel testActionSelfTarget     = new PerformActionDataModel(ActionData.ACTION_LIST_ID.SHIELD_ONE, GenericActionModel.ACTION_TARGET_AMOUNT.SINGLE_TARGET, testChar1.m_Character);
        PerformActionDataModel testActionAllTarget      = new PerformActionDataModel(ActionData.ACTION_LIST_ID.ATTACK_ONE, GenericActionModel.ACTION_TARGET_AMOUNT.ALL_TARGETS, testChar1.m_Character);
        PerformActionDataModel testActionMultiOffensive = new PerformActionDataModel(ActionData.ACTION_LIST_ID.ATTACK_TWO, GenericActionModel.ACTION_TARGET_AMOUNT.MULTI_TARGET_OFFENSIVE, testChar1.m_Character);
        PerformActionDataModel testActionMultiDefensive = new PerformActionDataModel(ActionData.ACTION_LIST_ID.SHIELD_TWO, GenericActionModel.ACTION_TARGET_AMOUNT.MULTI_TARGET_DEFENSIVE, testChar1.m_Character);

        GetCombatManager.ProcessAction(testActionSelfTarget);
        GetCombatManager.ProcessAction(testActionAllTarget);
        GetCombatManager.ProcessAction(testActionMultiOffensive);
        GetCombatManager.ProcessAction(testActionMultiDefensive);

        for (int i = 0; i < GetPlayerManager.GetCharacterList().Count; i++)
        {
            Debug.Log("Health - " + GetPlayerManager.GetCharacterList()[i].GetCharacterName() + " : " + GetPlayerManager.GetCharacterList()[i].GetCharacterHealth());
        }

        Debug.Log("Test Case Over");
    }
 //GameManeger -> GetCombatManager() -> Do the action with the id that is listed
 //Have an "OnClick"/"OnSelected" function for the ability selection to callback to set the actionID here
 void TestCallActionFunction()
 {
     PerformActionDataModel performActionData = new PerformActionDataModel();
     //GameManager.GetCombatManager.ProcessAction();
     //GameManager.GetCombatManager.PerformAction(m_SelectedActionID, m_CharacterStats);
 }
예제 #7
0
    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();
                        }
                    }
                }
            }
        }
    }
예제 #8
0
 public void ProcessAction(PerformActionDataModel aPerformActionDataModel)
 {
     m_ActionController.PerformAction(aPerformActionDataModel);
 }