Beispiel #1
0
 private void ExitNode(FightNode fightNode)
 {
     if (attackedNode != null && attackedNode == fightNode)
     {
         attackedNode.Select(false);
         attackedNode = null;
     }
 }
Beispiel #2
0
    private void MouseButtonUp()
    {
        if (attackingNode != null && attackedNode != null)
        {
            var attackUnitsCount = attackingNode.SendAttackGroup();

            for (int i = 0; i < attackUnitsCount; i++)
            {
                var spawnPos = attackingNode.transform.position + (Vector3)Random.insideUnitCircle;
                spawnPos.z = 0f;
                AttackUnit attackUnit = Instantiate(attackUnitPrefab, spawnPos, Quaternion.identity);
                attackUnit.SetAim(attackedNode);
            }

            int attackingIndex = 0;
            int attackedIndex  = 0;

            for (int i = 0; i < FightNode.fightNodes.Count; i++)
            {
                if (attackingNode == FightNode.fightNodes[i])
                {
                    attackingIndex = i;
                }
                if (attackedNode == FightNode.fightNodes[i])
                {
                    attackedIndex = i;
                }
            }

            actionsSequence.Add(attackingIndex);
            actionsSequence.Add(attackedIndex);
        }

        if (attackingNode != null)
        {
            attackingNode.Select(false);
            attackingNode = null;
        }

        if (attackedNode != null)
        {
            attackedNode.Select(false);
            attackedNode = null;
        }

        connectionLine.gameObject.SetActive(false);
    }
Beispiel #3
0
        public bool TestActionSeries(FightNode root, List <FightAction> actions, out string res)
        {
            var target = root;
            var ii     = 0;

            res = "";
            while (ii < actions.Count())
            {
                if (!target.FightAction.IsEqual(actions[ii]))
                {
                    res = $"Action action: {target.FightAction} did not match expected: {actions[ii]}";
                    return(false);
                }
                target = target.Value.BestChoice;
                ii++;
            }
            return(true);
        }
Beispiel #4
0
    private void SelectNode(FightNode fightNode)
    {
        if (fightNode.currentNodeOwner == NodeOwner.Player && isClicking)
        {
            if (attackingNode == null)
            {
                fightNode.Select(true);
                attackingNode = fightNode;
            }
        }

        if (attackingNode != null && fightNode != attackingNode && isClicking)
        {
            if (attackedNode != null)
            {
                attackedNode.Select(false);
            }

            fightNode.Select(true);
            attackedNode = fightNode;
        }
    }
Beispiel #5
0
 public void SetAim(FightNode aim)
 {
     aimNode = aim;
     SetOwner();
 }