Skip to content

Instantly share code, notes, and snippets.

View CSaratakij's full-sized avatar
🎯
Focusing

Chatchai Saratakij CSaratakij

🎯
Focusing
View GitHub Profile
@CSaratakij
CSaratakij / Health
Last active August 29, 2015 14:12
HealthController(Author: Chatchai Saratakij)
using UnityEngine;
using System.Collections;
public sealed class Health : MonoBehaviour {
[SerializeField]
int health;
[SerializeField]
int maxHealth;
@CSaratakij
CSaratakij / Timer.cs
Last active September 9, 2015 16:54
Unity Timer Example (Author : Chatchai Saratakij (Ton))
using UnityEngine;
using System.Collections;
public sealed class Timer : MonoBehaviour {
[SerializeField]
[Range(0, 600)]
[Tooltip("Time in seconds. (Time between 0 seconds to 10 minutes.)")]
int time;
@CSaratakij
CSaratakij / AutoSnap.cs
Created October 10, 2015 05:11 — forked from estebanpadilla/AutoSnap.cs
Auto snap to grid in Unity If you need to auto snap a gameObject to the grid in unity this script will help you. Usage: Create a Editor folder in your assets folder. Add the AutoSnap.cs script to the Editor folder. To open press Command + L (Mal), Control + L (PC) Source: http://answers.unity3d.com/questions/148812/is-there-a-toggle-for-snap-to-…
using UnityEngine;
using UnityEditor;
public class AutoSnap : EditorWindow
{
private Vector3 prevPosition;
private bool doSnap = true;
private float snapValue = 1;
[MenuItem( "Edit/Auto Snap %_l" )]
Windows Registry Editor Version 5.00
[HKEY_CLASSES_ROOT\Folder\shell\Unity5]
@=""
"Icon"="%ProgramFiles%\\Unity\\Editor\\Unity.exe"
"MUIVerb"="Open as Unity Project"
[HKEY_CLASSES_ROOT\Folder\shell\Unity5\Command]
@="cmd /c start /D\"c:\\Program Files\\Unity\\Editor\\\" Unity.exe -projectPath \"%1\""
@CSaratakij
CSaratakij / CameraAnchor.cs
Created November 4, 2015 20:26 — forked from fadookie/CameraAnchor.cs
Screen-relative anchoring component for Unity3D
/***
* This script will anchor a GameObject to a relative screen position.
* This script is intended to be used with CameraFit.cs by Marcel Căşvan, available here: http://gamedev.stackexchange.com/a/89973/50623
*
* Note: For performance reasons it's currently assumed that the game resolution will not change after the game starts.
* You could not make this assumption by periodically calling UpdateAnchor() in the Update() function or a coroutine, but is left as an exercise to the reader.
*/
/* The MIT License (MIT)
Copyright (c) 2015, Eliot Lash
package playground.application
import javafx.application.Application
import javafx.scene.Scene
import javafx.stage.Stage
import javafx.scene.paint.Color
import javafx.scene.text.*
import javafx.scene.control.*
import javafx.scene.layout.*
import javafx.geometry.*
@CSaratakij
CSaratakij / gist:cd148cb82799619f70cb
Created February 24, 2016 13:52 — forked from dodyg/gist:5823184
Kotlin Programming Language Cheat Sheet Part 1

#Intro

Kotlin is a new programming language for the JVM. It produces Java bytecode, supports Android and generates JavaScript. The latest version of the language is Kotlin M5.3

Kotlin project website is at kotlin.jetbrains.org.

All the codes here can be copied and run on Kotlin online editor.

Let's get started.

@CSaratakij
CSaratakij / calStation.c
Last active February 26, 2016 11:48
ตัวอย่าง program ที่ run ได้ -> original ref : http://pantip.com/topic/34834020
#include<stdio.h>
#include<conio.h>
#include<stdbool.h>
int main()
{
char menu;
int recieved, change, stationPrice;
do
@CSaratakij
CSaratakij / ExNumLoopFlag.java
Last active March 21, 2016 03:17
My Num Flag Example
package exnumloopflag;
public class ExNumLoopFlag {
public static void main(String[] args) {
int maxNum = 6;
String space = "";
for (int i = maxNum; i > 0; i--) {
package exnumloopflagver2;
public class ExNumLoopFlagVer2 {
public static void main(String[] args) {
int maxNum = 6;
int dragNum = 1;
for (int i = maxNum; i > 0; i--) {