Skip to content

Instantly share code, notes, and snippets.

View shaunsales's full-sized avatar
🛀
coding

Shaun Sales shaunsales

🛀
coding
View GitHub Profile
@shaunsales
shaunsales / Linear_Remap.cs
Last active August 29, 2015 14:07
Linear Remap - map the value of one range to another range
// Remap the value of a range to the equivalent in another range
// Y = (X-A)/(B-A) * (D-C) + C
// Use floats because of the percentage significand
float rangeOneStart = 500, rangeOneEnd = 1000;
float rangeTwoStart = 0.5f, rangeTwoEnd = 2.0f;
// Choose an arbitrary number within range one
float numberInRangeOne = 750;
using UnityEngine;
using System.Collections;
using System.Runtime.InteropServices;
using System.Text;
public class Test : MonoBehaviour
{
private static string m_AuthToken;
private static string m_HeartbeatHash;
@shaunsales
shaunsales / Seoul.md
Last active September 15, 2015 07:54

Here's a shortlist of places:

Dongdaemun - 24hr clothing market

Daehakro (pronunced daehangro) (at Hyehwa station) - Hip hop and theatrical performances

Gangnam: Saemaeul sikdan (great meat), Dr Fish (near 7 exit of Gangnam station)

Anguk: Beewon guesthouse

Thread 0 Crashed:: CrBrowserMain Dispatch queue: com.apple.main-thread
0 libsystem_kernel.dylib 0x00007fff84784286 __pthread_kill + 10
1 libsystem_c.dylib 0x00007fff837d39b3 abort + 129
2 com.unity3d.UnityEditor5.x 0x00000001010620c1 HandleSignal(int, __siginfo*, void*) + 385
3 libmono.0.dylib 0x0000000109cec50a mono_chain_signal + 71
4 libmono.0.dylib 0x0000000109c39a33 mono_sigsegv_signal_handler + 213
5 libsystem_platform.dylib 0x00007fff8e66bf1a _sigtramp + 26
6 com.unity3d.UnityEditor5.x 0x000000010141bf96 AssetInterface::StopAssetEditing(AssetInterface::CancelBehaviour, UpdateAssetOptions) + 678
7 com.unity3d.UnityEditor5.x 0x000000010141f90f AssetInterface::Refresh(UpdateAssetOptions) + 6943
8 com.unity3d.UnityEditor5.x 0x00000001019ae198 Application::AutoRefresh() + 184
@shaunsales
shaunsales / ExampleClass.cs
Last active January 20, 2016 09:38
Example Unity Class - How to format your code.
using UnityEngine;
using System.Collections;
using System.Collections.Generic;
public class ExampleClass : MonoBehaviour // Try to name classes so other developers can infer their functionality. Abstract classes are prefixed with 'Base'
{
private enum WidgetType // Enums should end in 'Type' and can be inlined with the class if private, but generally should be relocated if public
{
None,
Circle,
@shaunsales
shaunsales / gist:4102b3407683d69aeeb0
Created November 24, 2015 03:27
RethinkDB Lifecycle Management
Things we have trouble with;
- Synchronizing changes between dev and production databases
- Documents tend to change over time
- i.e. Player doc starts with 4 fields then new fields get added to newer documents
- Tracking changes to tables
- What document layout changes were made and when
- Taking changes made in dev, and non-destructively (where possible) moving them to prod
What we want to be able to do;
- For smaller tables (like config data), compare the contents between dev and prod and cherry pick changes to send in either direction (i.e. diff/merge)
private static void WriteGitInfo(string filename, string arguments)
{
System.Diagnostics.ProcessStartInfo procStartInfo = new System.Diagnostics.ProcessStartInfo();
procStartInfo.FileName = "git";
string path = Application.dataPath.Replace("Assets","");
procStartInfo.WorkingDirectory = path;
private IEnumerator Start()
{
ScreenFader.Instance.FadeToBlack(instant: true);
#if UNITY_IOS
UnityEngine.iOS.NotificationServices.RegisterForNotifications(UnityEngine.iOS.NotificationType.Alert);
#endif
DebugLog = new LimitedQueue<DebugMessage>(Settings.Global.DebugLogLimit);
* thread #1: tid = 0xdc50f, 0x000000010a6e2d85 ep1`::CreateMaterial() + 61 at Material.cpp:493, queue = 'com.apple.main-thread', stop reason = EXC_BAD_ACCESS (code=1, address=0x0)
* frame #0: 0x000000010a6e2d85 ep1`::CreateMaterial() + 61 at Material.cpp:493 [opt]
frame #1: 0x000000010aa2af5b ep1`::GetDefaultUIMaterial() + 93 at Canvas.cpp:38 [opt]
frame #2: 0x000000010aa358c7 ep1`::Canvas_CUSTOM_GetDefaultCanvasMaterial() + 98 at UICanvasBindings.gen.cpp:267 [opt]
frame #3: 0x000000010a0b3076 ep1`::Graphic_get_defaultGraphicMaterial_m456140641_0(__this=<unavailable>, method=<unavailable>) + 108 at Bulk_UnityEngine.UI_0.cpp:17133 [opt]
frame #4: 0x000000010a0b3b45 ep1`::Graphic_get_materialForRendering_m1154169789_0(Graphic_t141164899_0 *, const MethodInfo *) [inlined] VirtFuncInvoker0<Material_t1234304623_0*>::Invoke(slot=26, obj=0x00000001246c05a0) + 16 at GeneratedVirtualInvokers.h:33 [opt]
frame #5: 0x000000010a0b3b35 ep1`::Graphic_get_materialForRendering_m1154169789_0(__this=0x0000
Smart Shooter
- Allow players to disable smart shooting, similar to ADS on Titanfall
- Possibly give extra rewards for hitscan kills
- More Score/XP
- Movement bonus
- Headshots/Nutshot in game events
HUD