This file contains 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
// GravityObject.cs | |
using UnityEngine; | |
using System.Collections; | |
[RequireComponent (typeof (Rigidbody))] | |
public class GravityObject : MonoBehaviour | |
{ | |
public float gravityModifier = 1.0f; | |
This file contains 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
private Bounds bounds; | |
void Start () | |
{ | |
bounds = new Bounds (transform.position, Vector3.one); | |
Renderer[] renderers = GetComponentsInChildren<Renderer> (); | |
foreach (Renderer renderer in renderers) | |
{ | |
bounds.Encapsulate (renderer.bounds); |
This file contains 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; | |
public class CustomGUILayout | |
{ | |
public static bool MyFocusControl (Texture2D texture, params GUILayoutOption[] options) | |
{ | |
int id = GUIUtility.GetControlID (); | |
Color color = GUI.color; | |
GUI.color = GUIUtility.hotControl == id ? Color.green : Color.red; |
This file contains 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
const string controlName = "My text field"; | |
string myString = "Text"; | |
void OnGUI () | |
{ | |
EventType handledEventType = Event.current.type; | |
GUI.SetNextControlName (controlName); | |
myString = GUILayout.TextField (myString); |
This file contains 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
///////////////////////////////////////////////////////////////// | |
// MyProxy.cs - the C# source file in your assets | |
///////////////////////////////////////////////////////////////// | |
using UnityEngine; | |
using UnityEditor; | |
using MyAssemblyNamespace; | |
This file contains 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 Tile tilePrefabs[]; | |
public int width = 1, height = 1; | |
public Vector2 tileSize = new Vector2 (1.0f, 1.0f); | |
Tile tiles[]; | |
void Start () | |
{ | |
tiles = new Tile[width * height]; |
This file contains 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; | |
enum CameraIdentity | |
{ | |
None, | |
One, | |
Two, | |
Three, |
This file contains 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 UnityEditor; | |
using System.Collections; | |
using System.Collections.Generic; | |
[CustomEditor (typeof (Animation))] | |
public class CustomAnimationEditor : Editor | |
{ | |
AnimationClip m_SampleClip; | |
float m_SampleTime = 0.0f; |
This file contains 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 BehaveResult StartPanicAction | |
{ | |
get | |
{ | |
panic = true; | |
return BehaveResult.Success; | |
} | |
} | |
public BehaveResult PatrolAction |
This file contains 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
void InvokeDelayed (Action action, float seconds) | |
{ | |
StartCoroutine (DoInvokeDelayed (action, seconds)); | |
} | |
IEnumerator DoInvokeDelayed (Action action, float seconds) | |
{ | |
yield return new WaitForSeconds (seconds); | |
action (); |