コード例 #1
0
ファイル: HexCalcs.cs プロジェクト: 03knoppg/Hextwist
    public static Hex RotateHex(Hex hex, int direction)
    {
        Vector3 cube = HexCalcs.hex_to_cube(hex);

        for (; direction > 0; direction--)
        {
            float temp = cube.x;
            cube.x = -cube.z;
            cube.z = -cube.y;
            cube.y = -temp;
        }
        for (; direction < 0; direction++)
        {
            float temp = cube.x;
            cube.x = -cube.y;
            cube.y = -cube.z;
            cube.z = -temp;
        }
        return(HexCalcs.cube_to_hex(cube));
    }
コード例 #2
0
ファイル: GameHex.cs プロジェクト: 03knoppg/Hextwist
 //positive increments of 60 degrees clockwise
 public void Rotate(int amount)
 {
     hex = HexCalcs.RotateHex(hex, -amount);
 }