コード例 #1
0
ファイル: AstmStart.cs プロジェクト: adriangumula/CGM.NET
        public override string ToString()
        {
            string commandName = "";
            var    signes      = Command.Where(e => e >= 0x30);

            if (signes.Count() > 0)
            {
                commandName = System.Text.Encoding.ASCII.GetString(signes.ToArray());
            }
            var signes2 = Command.Where(e => Enum.IsDefined(typeof(AstmAscii), e)).Select(e => (AstmAscii)e);

            if (signes2.Count() > 0)
            {
                commandName = signes2.First().ToString();
            }


            string returnStr = string.Format("{0} ({1})", DirectionName.ToString(), commandName);

            if (Message2 != null)
            {
                returnStr += Message2.ToString();
            }
            return(returnStr);
        }
コード例 #2
0
 public static DirectionName TurnRight(DirectionName facing)
 {
     if (facing == DirectionName.NORTH)
     {
         return(DirectionName.EAST);
     }
     return(--facing);
 }
コード例 #3
0
 public static DirectionName TurnLeft(DirectionName facing)
 {
     if (facing == DirectionName.EAST)
     {
         return(DirectionName.NORTH);
     }
     return(++facing);
 }
コード例 #4
0
    public float Swipe(DirectionName direction)
    {
        swipeVector = (endPressPos - startPressPos);//.normalized;

        return(direction switch
        {
            DirectionName.Vertical => swipeVector.y,
            DirectionName.Horizontal => swipeVector.x,
            _ => 0f,
        });
コード例 #5
0
 private void ChangeVisible(bool x)
 {
     if (x)
     {
         Task.WhenAll(
             DirectionName.FadeTo(1),
             Groups.FadeTo(1));
     }
     else
     {
         Task.WhenAll(
             DirectionName.FadeTo(0),
             Groups.FadeTo(0));
     }
 }
コード例 #6
0
ファイル: MainScene.cs プロジェクト: hirenjak/KineFigu
        /// <summary> 逆三角関数を使って角度を算出する </summary>
        private void DirectionConputing(Vector2PLUS[] rightHandPosi)
        {
            Vector2PLUS tempVect = rightHandPosi[0] - rightHandPosi[1];
            float       offset   = 0.01f;

            if (tempVect.X < offset && tempVect.X > -offset && tempVect.Y < offset && tempVect.Y > -offset)
            {
                direction = 0; nowDirectionName = DirectionName.Center;
            }
            else
            {
                float tempValue = (float)Math.Atan((tempVect.Y / tempVect.X));

                direction = MathHelper.ToDegrees(tempValue);

                if (tempVect.X < 0)
                {
                    direction += 180;
                }
                else if (tempVect.Y < 0)
                {
                    direction += 360;
                }

                if (direction >= 337.5f || direction < 22.5f)
                {
                    nowDirectionName = DirectionName.Right;
                }
                // else if (direction >= 22.5f && direction < 67.5f) { nowDirectionName = DirectionName.TopRight; }
                else if (direction >= 67.5f && direction < 112.5f)
                {
                    nowDirectionName = DirectionName.Top;
                }
                // else if (direction >= 112.5f && direction < 157.5f) { nowDirectionName = DirectionName.TopLeft; }
                else if (direction >= 157.5f && direction < 202.5f)
                {
                    nowDirectionName = DirectionName.Left;
                }
                // else if (direction >= 202.5f && direction < 247.5f) { nowDirectionName = DirectionName.BottomLeft; }
                else if (direction >= 247.5f && direction < 292.5f)
                {
                    nowDirectionName = DirectionName.Bottom;
                }
                // else if (direction >= 292.5f && direction < 337.5f) { nowDirectionName = DirectionName.BottomRight; }
            }
        }
コード例 #7
0
 public StepCountedDirection(DirectionName direction, int steps)
 {
     NextDirection = direction;
     Steps         = steps;
 }