Beispiel #1
0
    /// <summary>
    /// Check for input and move the character on the grid accordingly.
    /// </summary>
    private void UpdateCheckMoveGrid()
    {
        int targetX = GridPosX, targetZ = GridPosZ;

        GridMovableNode targetNode;

        if (inputHdlr.UpKeyDown)
        {
            targetZ++;
        }
        if (inputHdlr.DownKeyDown)
        {
            targetZ--;
        }
        if (inputHdlr.LeftKeyDown)
        {
            targetX--;
        }
        if (inputHdlr.RightKeyDown)
        {
            targetX++;
        }

        targetNode = gridMgrInstance.GetNode(targetX, targetZ);

        if (targetNode != null && gridMgrInstance.GetOccupantOfNode(targetNode) == null && MovableNodes.Contains(targetNode))
        {
            GridPosX = targetX;
            GridPosZ = targetZ;

            SetCurrentNode();
        }
    }
    private void UpdateCheckAdvanceTurn()
    {
        // Advance if the player selects a node occupied by a dino of the opposite team
        if (inputHdlr.ChoiceKeyDown && gridMgrInstance.CheckIfNodeOccupied(cursorCurrentNode) && gridMgrInstance.GetOccupantOfNode(cursorCurrentNode).GetComponent <UnityCharacterTurnInfo>().PlayerNumber != charTurnInfo.PlayerNumber)
        {
            charTurnInfo.AttackTarget = gridMgrInstance.GetOccupantOfNode(cursorCurrentNode);

            Destroy(attackCursorInstance);
            attackCursorInstance = null;

            this.GetComponent <CharacterSliceMovement>().RefreshSliceTurn(); // Should maybe do this in a "turn segment starting" thing in Character script instead

            charTurnInfo.AdvanceCurrentTurnSegment();
        }
    }