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