This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using UnityEngine; | |
using System.Collections.Generic; | |
public class SimpleFSM : MonoBehaviour { | |
public delegate IEnumerator StateHandler(); | |
public enum State { | |
Idle, | |
Attack, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function CameraShake () { | |
var hitTime = Time.time; | |
var originalPosition = cam.transform.localPosition.x; | |
var shakeCounter = numberOfShakes; | |
var shakeDistance = startingShakeDistance; | |
while (shakeCounter > 0) { | |
// Make timers always start at 0 | |
var timer = (Time.time - hitTime) * shakeSpeed; | |
cam.transform.localPosition.x = originalPosition + Mathf.Sin(timer) * shakeDistance; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using UnityEngine; | |
using System.Collections; | |
using System.Collections.Generic; | |
public class TimerManager : MonoBehaviour { | |
public delegate void Callback(); | |
static TimerManager _instance = null; | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using UnityEngine; | |
using System.Collections; | |
public class RTSCamera : MonoBehaviour { | |
public float scrollArea = 50f; | |
public float scrollSpeed = 50f; | |
public float rotateSpeed = 4f; | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using UnityEngine; | |
using System.Collections; | |
public class CameraFaderTest : MonoBehaviour { | |
void Start(){ | |
//level 1 enter fade in | |
CameraFader.NewFadeIn().endCall = delegate { | |
//finish level1 | |
//level 1 fade out |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using UnityEngine; | |
using System.Collections; | |
using System.Collections.Generic; | |
class Selection { | |
List<Unit> static PickUnitsInRect(float left, float top, float right, float bottom, Camera camera = null) { | |
List<Unit> pickedUnits = new List<Unit>(); | |
if(camera == null) camera = Camera.main; | |
Ray bottomLeft = camera.ScreenPointToRay(new Vector3(left, bottom)); | |
Ray topLeft = camera.ScreenPointToRay(new Vector3(left, top)); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using using UnityEngine; | |
using System.Collections; | |
using System.Collections.Generic; | |
class MathHelper { | |
float static CalcAngleOfElevation (Vector3 from, Vector3 to, float v, float g) { | |
float x = (to - from).z; | |
float y = (to - from).y; | |
float v2 = v * v; | |
float v4 = v2 * v2; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#ifndef OBJECT_MANAGER | |
#define OBJECT_MANAGER 0 | |
#include <vector> | |
#include <cassert> | |
const size_t INVALID = -1; | |
template <typename T> | |
class object_manager; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using UnityEngine; | |
using System.Collections; | |
using System.Collections.Generic; | |
using System; | |
using System.Net.Sockets; | |
using System.Net; | |
using System.Text; | |
using LitJson; | |
public class NetworkClient : MonoBehaviour { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public static ExportMenu { | |
[MenuItem("Export/Config")] | |
static public void ExportConfig() | |
{ | |
string platInfo = "PC"; | |
BuildTarget target = BuildTarget.StandaloneWindows; | |
#if UNITY_ANDROID | |
target = BuildTarget.Android; | |
platInfo = "Android"; | |
#endif |
OlderNewer