DetermineMoveDirection() protected static method

Given an input movement, determine the best MoveDirection.

protected static DetermineMoveDirection ( float x, float y ) : MoveDirection
x float X movement.
y float Y movement.
return MoveDirection
コード例 #1
0
 /// <summary>
 ///
 /// <para>
 /// Given some input data generate an AxisEventData that can be used by the event system.
 /// </para>
 ///
 /// </summary>
 /// <param name="x">X movement.</param><param name="y">Y movement.</param><param name="moveDeadZone">Dead Zone.</param>
 protected virtual AxisEventData GetAxisEventData(float x, float y, float moveDeadZone)
 {
     if (this.m_AxisEventData == null)
     {
         this.m_AxisEventData = new AxisEventData(this.eventSystem);
     }
     this.m_AxisEventData.Reset();
     this.m_AxisEventData.moveVector = new Vector2(x, y);
     this.m_AxisEventData.moveDir    = BaseInputModule.DetermineMoveDirection(x, y, moveDeadZone);
     return(this.m_AxisEventData);
 }
コード例 #2
0
 protected virtual AxisEventData GetAxisEventData(float x, float y, float moveDeadZone)
 {        /*	used in StandaloneInputModule.SendMoveEventToSelectedObject()
           *     create new AxisEventData and assign m_AxisEventData to it
           *     update its fields
           */
     if (this.m_AxisEventData == null)
     {
         this.m_AxisEventData = new AxisEventData(this.eventSystem);
     }
     this.m_AxisEventData.Reset();
     this.m_AxisEventData.moveVector = new Vector2(x, y);
     this.m_AxisEventData.moveDir    = BaseInputModule.DetermineMoveDirection(x, y, moveDeadZone);
     return(this.m_AxisEventData);
 }
コード例 #3
0
 /// <summary>
 ///
 /// <para>
 /// Given an input movement, determine the best MoveDirection.
 /// </para>
 ///
 /// </summary>
 /// <param name="x">X movement.</param><param name="y">Y movement.</param><param name="deadZone">Dead zone.</param>
 protected static MoveDirection DetermineMoveDirection(float x, float y)
 {
     return(BaseInputModule.DetermineMoveDirection(x, y, 0.6f));
 }