TouchUtil.TouchInfo GetTouch() { Vector2F touchPos = new Vector2F( TouchUtil.GetTouchWorldPosition(Camera.main) ); if( touchPos.IsInCircle( this.transform.position, TouchRadius ) && TouchUtil.GetTouch_Bool() ) { if( flag_IsTouched ) { return TouchUtil.TouchInfo.Stationary; } else { //フレームに1回だけ更新 if( time_IsTouched != Time.time ) flag_IsTouched = true; return TouchUtil.TouchInfo.Began; } } else { if( flag_IsTouched ) { //フレームに1回だけ更新 if( time_IsTouched != Time.time ) flag_IsTouched = false; return TouchUtil.TouchInfo.Ended; } else { return TouchUtil.TouchInfo.None; } } }
public Vector2I( Vector2F a ) { this.x = (int)a.x; this.y = (int)a.y; }
public bool IsInCircle( Vector2F centerPos, float radius ) { return centerPos.IsInCircle( this, radius ); }
public bool IsVertical( Vector2F b ) { return this.dot( b ) <= 0.0001 && this.dot( b ) >= -0.0001; }
public float LengthSq( Vector2F b ) { return ( this.x - b.x ) * ( this.x - b.x ) + ( this.y - b.y ) * ( this.y - b.y ); }
public bool IsObtuse( Vector2F b ) { return this.cross( b ) < 0; }
public bool IsParallel( Vector2F b ) { return this.cross( b ) <= 0.0001 && this.cross( b ) >= -0.0001; }
public bool IsInCircle( Vector2F centerPos, float radius ) { return ( this.LengthSq( centerPos ) < radius * radius ); }
public bool IsAcute( Vector2F b ) { return this.cross( b ) > 0; }
public float dot( Vector2F v ) { return this.x * v.x + this.y * v.y; }
public float cross( Vector2F v ) { return this.x * v.y - this.y * v.x; }
public static void Swap( ref Vector2F a, ref Vector2F b ) { Vector2F hoge = a; a = b; b = hoge; }