Esempio n. 1
0
    // where center of triangle should be, **relative to board coordinates**
    Vector3 getIncenter(int row, int col)
    {
        // NOTE: This calculation depends on nRows = 2*(odd number)
        // a, b, c, are the corner points of the triangle
        float a_y, a_x, b_y, b_x, c_y, c_x;

        if (getDirection(row, col) == TriangleDirection.Upward)
        {
            // every other row is offset by half a triangle side length
            a_y = (Constants.Instance().s / 2) * ((row + 1) % 2) + Mathf.Floor(col / 2) * Constants.Instance().s;
            a_x = -1 * (row) * Constants.Instance().h - Constants.Instance().h / 3;
        }
        else             // Direction is Downward
        {
            a_y = (Constants.Instance().s / 2) * (row % 2) + Mathf.Floor(col / 2) * Constants.Instance().s;
            a_x = -1 * (row) * Constants.Instance().h;
        }

        b_y = a_y + 1 * Constants.Instance().s;
        b_x = a_x;

        c_y = a_y + (Constants.Instance().s / 2);
        c_x = a_x + 1 * Constants.Instance().s;
        Vector3 incenter = new Vector3((a_x + b_x + c_x) / 3, (a_y + b_y + c_y) / 3);


        //incenter = incenter + corner;

        // rotate based on the rotation of the board
        incenter = Quaternion.Euler(0, 0, BoardHandler.Instance().transform.rotation.eulerAngles.z) * incenter;

        return(incenter);
    }
Esempio n. 2
0
    public void startNewGameDialog()
    {
        UnityAction yesAction = new UnityAction(() => { BoardHandler.Instance().reset();
                                                        BattleInfo.Instance().resetStats();
                                                        BattleInfo.gameState = GameState.PlayerTurn; });
        UnityAction noAction = new UnityAction(() => { BattleInfo.gameState = GameState.Exiting;
                                                       Application.Quit(); });

        dialogBox.Choice("Would you like to battle again?", yesAction, noAction);
    }