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 System.Collections.Generic; | |
using UnityEngine; | |
using System.Collections; | |
public class BlurTest : MonoBehaviour { | |
private SpriteRenderer _spriteRenderer; | |
private Dictionary<Sprite, Sprite> _blurSprites = new Dictionary<Sprite, Sprite>(); | |
private SpriteRenderer _blurSpriteRenderer; | |
private Texture2D _blurTexture; |
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 MyMonoBehaviour : MonoBehaviour{ | |
private Rigidbody _rigidbody; | |
public Rigidbody rigidbody { | |
get { return _rigidbody ?? (_rigidbody = GetComponent<Rigidbody>()); } | |
} | |
private Rigidbody2D _rigidbody2D; | |
public Rigidbody2D rigidbody2D { |
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 static class TransformExtension{ | |
public static void SetPosition(this Transform t, float? x = null, float? y = null, float? z = null) { | |
var pos = t.transform.localPosition; | |
if (x.HasValue) pos.x = x.Value; | |
if (y.HasValue) pos.y = y.Value; | |
if (z.HasValue) pos.z = z.Value; | |
t.transform.localPosition = pos; | |
} | |
public static void AddPosition(this Transform t, float? x = null, float? y = null, float? z = null) { | |
var pos = t.transform.localPosition; |
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 GearVRHelper : MonoBehaviour{ | |
//タップ・フリック検出用の | |
public delegate void TrackPad(float x, float y); | |
//戻るボタンの短押しと、長押し用 | |
public delegate void Trigger(); | |
//戻るボタンの長押し検出時間 |
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 TouchEventTest : MonoBehaviour { | |
void Start () { | |
GearVRHelper.OnBackHold += () => { | |
Debug.Log("BACK HOLD!"); | |
}; | |
GearVRHelper.OnBackPush += () => { | |
Debug.Log("BACK PUSH!"); | |
}; |
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 longClickStream = UpdateAsObservable().Select(_ => Input.GetMouseButton(0)).DistinctUntilChanged().Throttle(TimeSpan.FromMilliseconds(1000)).Where(b => b); |
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 btnDownTrigger = button.gameObject.AddComponent<ObservableButtonDownTrigger>(); | |
btnDownTrigger.OnButtonDown.DistinctUntilChanged().Throttle(TimeSpan.FromMilliseconds(1000)).Where(b => b).Subscribe(b => { | |
Debug.Log("1秒押された"); | |
}); |
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 System; | |
using System.Collections; | |
using System.Collections.Generic; | |
using System.Linq; | |
using UnityEngine; | |
namespace GameUtil | |
{ | |
public class TaskScheduler : MonoBehaviour | |
{ |
OlderNewer