Skip to content

Instantly share code, notes, and snippets.

View codehoose's full-sized avatar

Sloan Kelly codehoose

View GitHub Profile
@codehoose
codehoose / BaseOsm.cs
Created February 10, 2020 00:36
Fix for new OSM files that contain 'm' in height data
using System;
using System.Xml;
using UnityEngine;
/*
Copyright (c) 2017 Sloan Kelly
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
#include <iostream>
#include <WS2tcpip.h>
#include <string>
#include <sstream>
#pragma comment (lib, "ws2_32.lib")
using namespace std;
void main()
public static class CloudFactory
{
public static ICloudService Create()
{
if (Application.platform == RuntimePlatform.WindowsPlayer)
return new SteamCloudService();
}
}
@codehoose
codehoose / GameSystems.cs
Created December 11, 2018 02:25
The `GameSystems` MonoBehaviour is the singleton and contains code to access the systems in the game from one location.
public class GameSystems : MonoBehaviour
{
private static GameSystems _instance;
public static GameSystems Instance
{
get
{
if (_instance == null)
{
@codehoose
codehoose / GameSystems.cs
Created December 11, 2018 02:25
The `GameSystems` MonoBehaviour is the singleton and contains code to access the systems in the game from one location.
public class GameSystems : MonoBehaviour
{
private static GameSystems _instance;
public static GameSystems Instance
{
get
{
if (_instance == null)
{
@codehoose
codehoose / bbclient.cpp
Created November 10, 2018 23:56
Barebones TCP client for Linux
#include <iostream>
#include <sys/types.h>
#include <unistd.h>
#include <sys/socket.h>
#include <netdb.h>
#include <arpa/inet.h>
#include <string.h>
#include <string>
using namespace std;
#include <iostream>
#include <sys/types.h>
#include <unistd.h>
#include <sys/socket.h>
#include <netdb.h>
#include <arpa/inet.h>
#include <string.h>
#include <string>
using namespace std;
using UnityEngine;
/// <summary>
/// Aspect ratio controller. Must be attached to the main camera.
/// </summary>
[RequireComponent(typeof(Camera))]
public class AspectRatio : MonoBehaviour
{
[Tooltip("The idea ratio that you want the world rendered at")]
public float perfectRatio = 16f / 9f;
@codehoose
codehoose / CardClass.cs
Created August 9, 2018 01:01 — forked from StuWookie/CardClass.cs
CSV to Dictionary - All credit to Sloane Kelly
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class Card
{
public int CardID { get; set; }
public int CardLvl { get; set; }
public bool CardPlayed { get; set; }
@codehoose
codehoose / gist:63eef427cc9e7403f695b3a76f0975fc
Last active July 24, 2018 18:39 — forked from fairinrenish/gist:da233147657e563d45ac3f7a8ffde398
Slider Volume updation after returning to main menu from a different scene
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class SliderVolumeValue : MonoBehaviour
{
const float DefaultVolume = 1f;
// Reference to Audio Source component
private AudioSource audioSrc;