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
// Example: | |
// | |
// currentPos = ExpEase.Out(currentPos, targetPos, -4.0); | |
// | |
// or | |
// | |
// ExpEase.Out2(currentPos, targetPos, -4.0); // This modifies currentPos. | |
// | |
using UnityEngine; |
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
var target : Vector3; | |
var power = 5.0; | |
function LateUpdate () { | |
var particles = particleEmitter.particles; | |
for (var i = 0; i < particles.Length; i++) { | |
var rp = target - particles[i].position; | |
if (rp.magnitude < 0.5) { | |
// 近づき過ぎたパーティクルを消す。 | |
particles[i].energy = 0.0; | |
} else { |
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
var guiIsHot : boolean; | |
function Update() { | |
if (Input.GetMouseButton(0) && GUIUtility.hotControl != 0) { | |
guiIsHot = true; | |
} | |
if (Input.GetMouseButtonUp(0)) { | |
if (!guiIsHot) { | |
Debug.Log("Hooray!"); | |
} |
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
@MenuItem ("MyMenu/Do Something") | |
static function DoSomething () { | |
var header1 = ScriptableObject.CreateInstance.<StateHeader>(); | |
var header2 = ScriptableObject.CreateInstance.<StateHeader>(); | |
AssetDatabase.CreateAsset(header1, "Assets/State1Set.asset"); | |
AssetDatabase.CreateAsset(header2, "Assets/State2Set.asset"); | |
var state1 = ScriptableObject.CreateInstance.<State1>(); |
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
import System.Runtime.InteropServices; | |
#if UNITY_IPHONE && !UNITY_EDITOR | |
@DllImportAttribute("__Internal") static private function _PluginFoo(arg : int) {} | |
#else | |
static private function _PluginFoo(arg : int) { | |
// iOS以外での代替処理。 |
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
#!/usr/bin/env python | |
import sys, os.path | |
install_path = sys.argv[1] | |
target_platform = sys.argv[2] | |
if target_platform != "iPhone": sys.exit() | |
info_plist_path = os.path.join(install_path, 'Info.plist') |
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
var rt : RenderTexture; | |
function Start() { | |
rt = new RenderTexture(4096, 4096, 24); | |
camera.targetTexture = rt; | |
} |
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
#pragma strict | |
static function BoolArray(a : int, b : int, c : int) { | |
return new boolean[a,b,c]; | |
} | |
static function IntArray (a : int, b : int, c : int) { | |
return new int[a,b,c]; | |
} | |
var testArray = IntArray(10, 10, 10); |
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
#pragma strict | |
var a = {"foo": {10: "bar"}}; | |
Debug.Log((a["foo"] as Hashtable)[10]); // prints "bar" |
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
#pragma strict | |
class StrIntArray { | |
private var table = new Hashtable(); | |
function Set(key1 : String, key2 : int, value : String) { | |
table[key1 + "/" + key2] = value; | |
} | |
function Get(key1 : String, key2 : int) : String { |
OlderNewer