Exemplo n.º 1
0
    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;
            }
        }
    }
Exemplo n.º 2
0
 public Vector2I( Vector2F a )
 {
     this.x = (int)a.x;
     this.y = (int)a.y;
 }
Exemplo n.º 3
0
 public bool IsInCircle( Vector2F centerPos, float radius )
 {
     return centerPos.IsInCircle( this, radius );
 }
Exemplo n.º 4
0
 public bool IsVertical( Vector2F b )
 {
     return this.dot( b ) <= 0.0001 && this.dot( b ) >= -0.0001;
 }
Exemplo n.º 5
0
 public float LengthSq( Vector2F b )
 {
     return ( this.x - b.x ) * ( this.x - b.x ) + ( this.y - b.y ) * ( this.y - b.y );
 }
Exemplo n.º 6
0
 public bool IsObtuse( Vector2F b )
 {
     return this.cross( b ) < 0;
 }
Exemplo n.º 7
0
 public bool IsParallel( Vector2F b )
 {
     return this.cross( b ) <= 0.0001 && this.cross( b ) >= -0.0001;
 }
Exemplo n.º 8
0
 public bool IsInCircle( Vector2F centerPos, float radius )
 {
     return ( this.LengthSq( centerPos ) < radius * radius );
 }
Exemplo n.º 9
0
 public bool IsAcute( Vector2F b )
 {
     return this.cross( b ) > 0;
 }
Exemplo n.º 10
0
 public float dot( Vector2F v )
 {
     return this.x * v.x + this.y * v.y;
 }
Exemplo n.º 11
0
 public float cross( Vector2F v )
 {
     return this.x * v.y - this.y * v.x;
 }
Exemplo n.º 12
0
 public static void Swap( ref Vector2F a, ref Vector2F b )
 {
     Vector2F hoge = a;
     a = b;
     b = hoge;
 }