Пример #1
0
    public void UpdateSelectionAttackTarget(int dir)
    {
        CharMgrScript character = CombatMgr._instance.currentTurnChar;

        //Update lists of targets - First check to see who is attacking, player party or enemy
        bool playerParty = CombatMgr._instance.PlayerParty.Contains(character);

        //Get ref to targets to deactivate highlight arrow after new list is found
        List <CharMgrScript> prevTargets = currTargets;

        //TODO:Handle moving 'target' arrow for attack selection based on player input
        possibleTargets = CombatMgr._instance.GetPossibleTargets(character, character.GetBasicAttack(), playerParty);
        currTargets     = CombatMgr._instance.GetNextTargets(character, character.GetBasicAttack(), currTargets, possibleTargets, playerParty, dir);

        //deactivate old arrows
        foreach (CharMgrScript p in prevTargets)
        {
            p.HighlightArrowStatus(false);
        }

        //Turn on highlight arrows for current targets
        foreach (CharMgrScript c in currTargets)
        {
            c.HighlightArrowStatus(true);
        }
    }
Пример #2
0
    public NPCCombatTurn ChooseCombatAction(CharMgrScript npc, List <CharMgrScript> possibleTargets)
    {
        NPCCombatTurn thisTurn = new NPCCombatTurn();
        //TODO: Implement logic for NPC combat action selection

        int actChoiceProb    = Random.Range(0, 100);
        int subSelectionProb = Random.Range(0, 100);

        //Choose action based on the NPC's internal logic
        GameConstants.ActionOptionIndices selectedAction = this.ChooseAction(npc, actChoiceProb);
        //Create list that will hold targets and their priority
        List <PrioritizedTarget> weightedTargets = new List <PrioritizedTarget>();
        List <CharMgrScript>     randomTargets   = new List <CharMgrScript>();
        CharAbility turnAbility = new CharAbility();

        /*Generate list of all targets based on a conditional statement based off the chosen action by the NPC*/
        switch (selectedAction)
        {
        case (GameConstants.ActionOptionIndices.Ability):

            break;

        case (GameConstants.ActionOptionIndices.Attack):
            //Get reference to the npc's attack
            turnAbility = npc.GetBasicAttack();

            //Get list of targets that the attack effects
            randomTargets = this.GetNPCTargets(turnAbility, CombatMgr._instance.PlayerParty);
            break;

        default:
            Debug.Log("Selected action was" + selectedAction.ToString() + " and NPC Turn Switch Fell through - Performing default action");
            break;
        }

        //Add priorities to targets from above selection and put them into a list TODO: prioitize via function
        foreach (CharMgrScript target in randomTargets)
        {
            weightedTargets.Add(new PrioritizedTarget(100, target));
        }
        //TODO perform some function to prioritize list of targets and grab the preffered one
        List <CharMgrScript> turnTargets = new List <CharMgrScript>();

        foreach (PrioritizedTarget t in weightedTargets)
        {
            turnTargets.Add(t.target);
        }
        //Set the fields of the created turn and return it
        thisTurn.SelectedAbility = turnAbility;
        thisTurn.SelectedTargets = turnTargets;
        thisTurn.SelectedAction  = selectedAction;
        //return the created turn data
        return(thisTurn);
    }
Пример #3
0
    public void UpdateMenuFromSelection(GameConstants.ActionOptionIndices selection)
    {
        if (TestScript._instance.TestMode)
        {
            Debug.Log("UPDATE menu from selection called in Combat UI mgr!!");
        }
        //Set the selected menu state as active
        CombatUIManager._instance.actMenuScript.SetSelectedState(selection, true);
        CharMgrScript character = CombatMgr._instance.currentTurnChar;

        switch (selection)
        {
        //Update menu level to reflect game state
        case (GameConstants.ActionOptionIndices.Attack):
            if (TestScript._instance.TestMode)
            {
                Debug.Log("UpdateMenuFromSelection - Entered switch and refreshed targets!!");
            }
            //Update menu level to the match
            CombatUIManager._instance.MenuLevel = GameConstants.CombatMenuPage.Attack;
            //Update lists of targets - First check to see who is attacking, player party or enemy
            bool playerParty = CombatMgr._instance.PlayerParty.Contains(character);
            //Get list of all possible targets for moving selection UI
            possibleTargets = CombatMgr._instance.GetPossibleTargets(character, character.GetBasicAttack(), playerParty);
            //Get list of the currently higlighted targets for the start
            currTargets = CombatMgr._instance.GetNextTargets(character, character.GetBasicAttack(), currTargets, possibleTargets, playerParty, 1);
            //Turn on highlight arrows for current targets
            foreach (CharMgrScript c in currTargets)
            {
                c.HighlightArrowStatus(true);
            }
            break;

        default:

            break;
        }
    }