Exemplo n.º 1
0
    /**
     * Disables the current turn player and moves on to the next
     */
    private void turnOver()
    {
        Debug.Log("Disabling " + battleQueueController.getCharacterRef().charName);

        if (turn == TYPE.PLAYER)
        {
            plyPanel.changeCurrentActivePlayer(players.IndexOf(battleQueueController.getCharacterRef()), false);
        }

        battleQueueController.getCharacterRef().setActive(false);
        battleQueueController = battleQueueController.getNext();
        battleQueueController.getCharacterRef().setActive(true);

        Debug.Log("Enabling " + battleQueueController.getCharacterRef().charName);

        turn = battleQueueController.getCharacterRef().getType();

        if (turn == TYPE.PLAYER)
        {
            heroCursor.reposition(battleQueueController.getCharacterRef().getPosition());
            heroCursor.relocate(1.5f * scale, 0.5f * scale);
            plyPanel.changeCurrentActivePlayer(players.IndexOf(battleQueueController.getCharacterRef()), true);
        }
        else if (turn == TYPE.ENEMY)
        {
            heroCursor.gameObject.SetActive(false);
        }
    }
Exemplo n.º 2
0
    private void addToQueue(Character c)
    {
        if (battleQueue == null)
        {
            battleQueue = new CharacterNode(c, battleQueue);
            battleQueue.setNextRef(battleQueue);
        }
        else
        {
            CharacterNode current = battleQueue;

            //keep traversing as long as c.speed is greater than the one next to it and
            //the next node is not the head node
            while (c.speed >= current.getCharacterRef().speed&& !battleQueue.equals(current.getNext()))
            {
                current = current.getNext();
            }

            current.setNextRef(new CharacterNode(c, current.getNext()));
        }
    }