Exemplo n.º 1
0
 public ActionGroup(HexCell cellToEndTurnOn, HexCell cellAbilityTarget, ActionChoice typeOfAction, Ability abilityToUse)
 {
     this.cellToEndTurnOn   = cellToEndTurnOn;
     this.cellAbilityTarget = cellAbilityTarget;
     this.typeOfAction      = typeOfAction;
     this.abilityToUse      = abilityToUse;
 }
Exemplo n.º 2
0
    public void AddAction(IAIAction newAction, int priority)
    {
        ActionChoice pair = new ActionChoice();

        pair.action   = newAction;
        pair.priority = Mathf.Max(priority, 1);

        actions.Add(pair);
    }
Exemplo n.º 3
0
        public void SetAction(string strTermSym, ActionChoice choice, Rule r)
        {
            ActionNode tempNode = new ActionNode(choice, r);

            if (!myAction.ContainsKey(strTermSym))
            {
                myAction.Add(strTermSym, tempNode);
            }
        }
Exemplo n.º 4
0
        private void init(Rectangle rect)
        {
            result      = new ProcessModel();
            result.rect = rect;
            #region show rect
            labelShowRect.Text = string.Format("x:{0}, y:{1}, w:{2}, h:{3}", rect.X, rect.Y, rect.Width, rect.Height);
            #endregion end show rect
            #region action combobox
            BindingList <ActionChoice> listActionObjects = new BindingList <ActionChoice>();

            ActionChoice upAction = new ActionChoice();
            upAction.Name  = "UP";
            upAction.Value = ActionModel.UP;

            ActionChoice downAction = new ActionChoice();
            downAction.Name  = "Down";
            downAction.Value = ActionModel.DOWN;

            listActionObjects.Add(upAction);
            listActionObjects.Add(downAction);

            comboBoxAction.ValueMember   = null;
            comboBoxAction.DisplayMember = "Name";
            comboBoxAction.DataSource    = listActionObjects;
            comboBoxAction.TabIndex      = 0;
            #endregion end action combobox


            #region operation combobox
            BindingList <OperationChoice> listOperationObjects = new BindingList <OperationChoice>();

            OperationChoice gtOperation = new OperationChoice();
            gtOperation.Name  = "Greater than";
            gtOperation.Value = OperationModel.GreaterThan;

            OperationChoice ltOperation = new OperationChoice();
            ltOperation.Name  = "Less than";
            ltOperation.Value = OperationModel.LessThan;

            listOperationObjects.Add(gtOperation);
            listOperationObjects.Add(ltOperation);

            comboBoxOperation.ValueMember   = null;
            comboBoxOperation.DisplayMember = "Name";
            comboBoxOperation.DataSource    = listOperationObjects;
            comboBoxOperation.TabIndex      = 0;
            #endregion end operation combobox
        }
Exemplo n.º 5
0
    public void DoRandomAction(Action callback)
    {
        if (controlling.isStunned)
        {
            callback.Invoke();
            return;
        }

        List <ActionChoice> candidates = GetPossibleActions();

        candidates.Sort((a, b) => { return(Mathf.Clamp(a.priority - b.priority, -1, 1)); });

        int prioritySum = 0;

        foreach (ActionChoice pair in candidates)
        {
            prioritySum += pair.priority;
        }

        int budget = UnityEngine.Random.Range(0, prioritySum);

        Debug.Log("candidatsize: " + candidates.Count + ", budget: " + budget);

        if (candidates.Count != 0)
        {
            //select from weighted set
            IAIAction action = null;
            int       index  = 0;
            while (budget >= 0 && index < candidates.Count)
            {
                ActionChoice pair = candidates[index];
                action  = pair.action;
                budget -= pair.priority;
                index++;
            }

            Debug.Log("chose " + action?.ActionName);

            action.OnActionFinish += callback;
            action.Do(controlling);
        }
        else
        {
            Debug.LogWarning(controlling.entityName + " had no valid actions this turn");
            callback?.Invoke();
        }
    }
Exemplo n.º 6
0
 //Lets the player select an item for the party member to use
 public void ButtonItemOption()
 {
     if (state == BattleState.PARTYONESEL)
     {
         choiceOne = ActionChoice.ITEM;
     }
     else if (state == BattleState.PARTYTWOSEL)
     {
         choiceTwo = ActionChoice.ITEM;
     }
     else if (state == BattleState.PARTYTHREESEL)
     {
         choiceThree = ActionChoice.ITEM;
     }
     else if (state == BattleState.PARTYFOURSEL)
     {
         choiceFour = ActionChoice.ITEM;
     }
 }
Exemplo n.º 7
0
    //Fills in action for Special Button
    IEnumerator CorouAttackSpecial()
    {
        if (state == BattleState.PARTYONESEL)
        {
            choiceOne = ActionChoice.ATTACKTWO;
            state     = BattleState.PARTYTWOSEL;
            yield return(new WaitForSeconds(1f));

            ButtonAttackBack();
            dialogueText.text = partyTwoUnit.unitName + "'s Action";
        }
        else if (state == BattleState.PARTYTWOSEL)
        {
            choiceTwo = ActionChoice.ATTACKTWO;
            state     = BattleState.PARTYTHREESEL;
            yield return(new WaitForSeconds(1f));

            ButtonAttackBack();
            dialogueText.text = partyThreeUnit.unitName + "'s Action";
        }
        else if (state == BattleState.PARTYTHREESEL)
        {
            choiceThree = ActionChoice.ATTACKTWO;
            state       = BattleState.PARTYFOURSEL;
            yield return(new WaitForSeconds(1f));

            ButtonAttackBack();
            dialogueText.text = partyFourUnit.unitName + "'s Action";
        }
        else if (state == BattleState.PARTYFOURSEL)
        {
            choiceFour = ActionChoice.ATTACKTWO;
            state      = BattleState.ATTACKTURN;
            yield return(new WaitForSeconds(1f));

            actionPanel.SetActive(false);
            attackPanel.SetActive(false);
            dialogueText.text = " ... ";
            StartCoroutine(PlayerCombatTurn());
        }
    }
Exemplo n.º 8
0
        private void buttonOk_Click(object sender, EventArgs e)
        {
            double threshold;

            if (double.TryParse(textBoxInputThreshold.Text, out threshold))
            {
                result.threshold = threshold;
            }

            if (comboBoxAction.SelectedValue != null)
            {
                ActionChoice currentAction = (ActionChoice)comboBoxAction.SelectedValue;
                result.action = currentAction.Value;
            }

            if (comboBoxOperation.SelectedValue != null)
            {
                OperationChoice currentOperation = (OperationChoice)comboBoxOperation.SelectedValue;
                result.operaion = currentOperation.Value;
            }
        }
Exemplo n.º 9
0
 public ActionNode(ActionChoice choice, Rule r)
 {
     nowAction = choice;
     nowRule   = r;
     nextState = -1;
 }
Exemplo n.º 10
0
 public ActionNode(ActionChoice choice)
 {
     nowAction = choice;
     nowRule   = new Rule();
     nextState = -1;
 }
Exemplo n.º 11
0
 public ActionNode(ActionChoice choice, int n)
 {
     nowAction = choice;
     nextState = n;
     nowRule   = new Rule();
 }