Skip to content

Instantly share code, notes, and snippets.

if (Physics.Raycast(ray, out hit) && !UnityEngine.EventSystems.EventSystem.current.IsPointerOverGameObject()){}
iTween.MoveTo(gameObject,iTween.Hash("path",iTweenPath.GetPath("New Path 2"),"time",10f, "orienttopath", true));
using UnityEngine;
using DG.Tweening;
public static class TransformExtensions
{
public static void SmoothLookAt(this Transform self, Vector3 pos, float time)
{
self.DORotate (Quaternion.LookRotation (pos).eulerAngles, time);
}
}
@peroon
peroon / gist:9edce7942fc29c663f9a
Created June 12, 2015 11:34
Orbit Camera マウスでグリグリできる。タッチは未検証
using UnityEngine;
using System.Collections;
// http://twiik.net/articles/realtime-reflections-in-unity-5
public class OrbitCamera : MonoBehaviour {
public Transform target;
public float rotateSpeed = 3.0f;
@peroon
peroon / gist:6d2bcea2c2804bcafe9d
Created June 14, 2015 12:44
Smooth Follow Camera #unity
Import Utility/SmoothFollow.cs
@peroon
peroon / gist:53800fa4c0c04c58c5aa
Created June 15, 2015 12:44
Tweenさせて元に戻す DOTween
transform.DOScale(targetScale * 2, 1.0f).SetLoops(2, LoopType.Yoyo);
@peroon
peroon / gist:2e5c3eea47238cac7268
Created June 16, 2015 15:26
ピンチインカメラ(エディタではなく端末向け)
using UnityEngine;
using System.Collections;
public class PinchInCamera : MonoBehaviour {
public float minHeight = 1.0f;
public float maxHeight = 10.0f;
private float touchDistance = 0.0f;
private float scaleSpeed = 0.1f;
@peroon
peroon / gist:4b217b16a32a427ab0b4
Created June 17, 2015 07:16
カラーバスシェーダ。赤が強いところだけカラーにする
Shader "Custom/ColorBathRed" {
Properties {
_MainTex ("Base (RGB)", 2D) = "white" {}
_Threshold( "Threshold", Range(0.0, 1.0) ) = 0.5 // added
}
SubShader {
Tags { "RenderType"="Opaque" }
LOD 200
Pass {
CGPROGRAM
@peroon
peroon / gist:ffe032de2c1c013dab07
Created June 18, 2015 06:45
UIを左右に揺らす。ダメージ表現によさそう
this.GetComponent<RectTransform> ().DOPunchPosition (Vector3.right * 100, 1.0f);
@peroon
peroon / gist:bf215c73bc9da2470759
Last active August 29, 2015 14:23
DOTween 横にスケールしながら縦は0スケールで消える演出
using UnityEngine;
using UnityEngine.UI;
using System.Collections;
using System.Collections.Generic;
using DG.Tweening;
public class DOTweenText : MonoBehaviour {
void Start () {
// stretch vertically