Skip to content

Instantly share code, notes, and snippets.

@nopitech
nopitech / MoveTo.cs
Last active October 30, 2017 13:08
iTween.MoveTo パターン2
public class iTweenMethod : MonoBehaviour
{
void Start()
{
// パターン2 Addで追加していき、最後に適用することもできる。
Hashtable moveHash = new Hashtable();
moveHash.Add("x", 3f);
moveHash.Add("delay", 1f);
iTween.MoveTo(gameObject, moveHash);
@nopitech
nopitech / MoveTo.cs
Created October 21, 2017 11:03
iTween.MoveTo
public class iTweenMethod : MonoBehaviour
{
void Start()
{
// positionを指定して移動
iTween.MoveTo(gameObject, iTween.Hash("position", new Vector3(3f, 2f, -3f), "delay", 1f));
}
}
@nopitech
nopitech / iTween.MoveTo.cs
Created October 21, 2017 11:14
iTween.MoveTo easetype
public class iTweenMethod : MonoBehaviour
{
void Start()
{
// アニメーションに緩急をつけるeasetype
iTween.MoveTo(gameObject, iTween.Hash("x", 2f, "easetype", "easeInOutElastic", "delay", 1f));
}
}
@nopitech
nopitech / MoveBy.cs
Created October 21, 2017 11:23
iTween.MoveBy
public class iTweenMethod : MonoBehaviour
{
void Start()
{
// 相対的に動くMoveBy
iTween.MoveBy(gameObject, iTween.Hash("x", 2f, "delay", 1f));
}
}
@nopitech
nopitech / iTween.callback.cs
Created October 21, 2017 11:37
iTweenのコールバック
public class iTweenMethod : MonoBehaviour
{
void Start()
{
Hashtable hash = new Hashtable();
hash.Add("x", 2f);
hash.Add("delay", 1f);
hash.Add("oncompletetarget", gameObject); // メソッドがあるオブジェクトを指定
hash.Add("oncomplete", "EndAnimation"); // 実行するタイミング、実行するメソッド名
iTween.MoveTo(gameObject, hash);
@nopitech
nopitech / looptype.cs
Created October 21, 2017 11:54
looptypeの使い方
public class iTweenMethod : MonoBehaviour
{
void Start()
{
Hashtable hash = new Hashtable();
hash.Add("x", 2f);
hash.Add("loopType", "loop");
iTween.MoveTo(gameObject, hash);
}
}
@nopitech
nopitech / loop.cs
Created October 21, 2017 12:30
iTweenループ(pingPong)
public class iTweenMethod : MonoBehaviour
{
void Start()
{
Hashtable hash = new Hashtable();
hash.Add("x", 2f);
hash.Add("loopType", "pingPong");
iTween.MoveTo(gameObject, hash);
}
}
@nopitech
nopitech / path.cs
Created October 21, 2017 12:40
iTweenパス指定してカーブ移動
public class iTweenMethod : MonoBehaviour
{
void Start()
{
Hashtable hash = new Hashtable();
Vector3[] _path = new Vector3[3];
_path[0] = new Vector3(2f, 1f, -3f);
_path[1] = new Vector3(2f, 4f, -3f);
_path[2] = new Vector3(0f, 2f, -3f);
@nopitech
nopitech / PostEffectController.cs
Last active October 30, 2017 13:06
PostProcessingをスクリプトで操作する
public class PostEffectController : MonoBehaviour {
// 「using UnityEngine.PostProcessing」の追加を忘れずに
void Start () {
var behaviour = GetComponent<PostProcessingBehaviour>();
var Settings = behaviour.profile.bloom.settings;
Settings.bloom.intensity = 10f;
behaviour.profile.bloom.settings = Settings;
}
@nopitech
nopitech / Bloom_intensity.cs
Created October 28, 2017 10:59
Bloomのintensityをゲーム実行中に操作する
public float intensity;
PostProcessingBehaviour behaviour;
BloomModel.Settings bloomSettings;
void Start () {
behaviour = GetComponent<PostProcessingBehaviour>();
}