Example #1
0
 private void Reset(int DefaultWidth, int DefaultHeight)
 {
     this.Rectangle          = new Rectangle(0, 0, DefaultWidth, DefaultHeight);
     this.ID                 = "";
     this.Color              = Color.White;
     this.FlipVCounter       = 0;
     this.FlipHCounter       = 0;
     this.FlipV              = false;
     this.FlipH              = false;
     this.Visible            = true;
     this.VerticalVelocity   = 0;
     this.HorizontalVelocity = 0;
     this.TotalVelocity      = 0;
     this.Y = Rectangle.Location.Y;
     this.X = Rectangle.Location.X;
     //this.StretchedY = 0;
     //this.StretchedX = 0;
     this.DefaultHeight           = this.Height;
     this.DefaultWidth            = this.Width;
     this.VerticalVelocityLimit   = 50;
     this.HorizontalVelocityLimit = 50;
     this.Drag                   = 0;
     this.GForce                 = 0;
     this.vBouncingZone          = false;
     this.hBouncingZone          = false;
     this.FlickCount             = 0;
     this.Accel                  = 0;
     this.AccelMpS               = 0;
     this.CurrentMovingDirection = Enum.Direction.Still;
     this.Textures               = new List <Texture2D>();
     this.TexturesPaths          = new List <string>();
 }
    public Door(int x, int y, int z, int disX, int disY, int disZ, Enum.Direction dir)
    {
        Vector3 aux = new Vector3(0, 0, 0);

        if (dir == Enum.Direction.xUp)
        {
            aux = new Vector3(x + disX, y + (disY / 2.0f), z + (disZ / 2.0f));
        }
        else if (dir == Enum.Direction.xDown)
        {
            aux = new Vector3(x, y + (disY / 2.0f), z + (disZ / 2.0f));
        }
        else if (dir == Enum.Direction.yUp)
        {
            aux = new Vector3(x + (disX / 2.0f), y + disY, z + (disZ / 2.0f));
        }
        else if (dir == Enum.Direction.yDown)
        {
            aux = new Vector3(x + (disX / 2.0f), y, z + (disZ / 2.0f));
        }
        else if (dir == Enum.Direction.zUp)
        {
            aux = new Vector3(x + (disX / 2.0f), y + (disY / 2.0f), z + disZ);
        }
        else if (dir == Enum.Direction.zDown)
        {
            aux = new Vector3(x + (disX / 2.0f), y + (disY / 2.0f), z);
        }

        midPoint = aux;
        this.dir = dir;
    }
        public static bool IncludesHeading(this Enum.Direction direction, int heading)
        {
            var adjusted = (heading + 22) % 360;
            var adjMin   = (int)direction * 45;
            var adjMax   = adjMin + 44;

            return(adjusted >= adjMin && adjusted <= adjMax);
        }
Example #4
0
        /// <summary>
        /// Used to turn the robot
        /// </summary>
        /// <param name="direction">Used to determine if the robot should turn left or right</param>
        /// <returns></returns>
        public string ChangeDirection(Enum.Direction direction)
        {
            int offset = direction.Equals(Enum.Direction.LEFT) ? 3 : 1;

            orientation = (Enum.Orientation)(((int)orientation + offset) % 4);

            return(string.Empty);
        }
Example #5
0
        public static void ApplyStretch(Sprite sprite, Enum.Direction direction, float rate, int minimumSize, int maximumSize)
        {
            if (direction == Enum.Direction.Up)
            {
                sprite.Height = (int)(sprite.DefaultHeight * rate);

                if (sprite.Height < minimumSize)
                {
                    sprite.Height = minimumSize;
                }
                else if (sprite.Height > maximumSize)
                {
                    sprite.Height = maximumSize;
                }
            }
            else if (direction == Enum.Direction.Down)
            {
                sprite.Height = (int)(sprite.DefaultHeight * rate);

                if (sprite.Height * rate < minimumSize)
                {
                    sprite.Height = minimumSize;
                }
                else if (sprite.Height * rate > maximumSize)
                {
                    sprite.Height = maximumSize;
                }
            }
            else if (direction == Enum.Direction.Right)
            {
                sprite.Width = (int)(sprite.DefaultWidth * rate);

                if (sprite.Width < minimumSize)
                {
                    sprite.Width = minimumSize;
                }
                else if (sprite.Width > maximumSize)
                {
                    sprite.Width = maximumSize;
                }
            }
            else if (direction == Enum.Direction.Left)
            {
                sprite.Width = (int)(sprite.DefaultWidth * rate);

                if (sprite.Width < minimumSize)
                {
                    sprite.Width = minimumSize;
                }
                else if (sprite.Width > maximumSize)
                {
                    sprite.Width = maximumSize;
                }
            }
        }
Example #6
0
        public static bool CollideBorder(Sprite sprite, Enum.Direction direction, int collisionPoint)
        {
            bool collided = false;

            if (direction == Enum.Direction.Down)
            {
                if (sprite.Vertex3.Y >= collisionPoint)
                {
                    collided = true;
                }
            }

            return(collided);
        }
 public Door(Vector3 midPoint, Enum.Direction dir)
 {
     this.midPoint = midPoint;
     this.dir      = dir;
 }
 public Door(int x, int y, int z, Enum.Direction dir)
 {
     midPoint = new Vector3(x, y, z);
     this.dir = dir;
 }
 public static string GetSuffix(this Enum.Direction direction)
 {
     return(mapping[direction]);
 }
Example #10
0
        /// <summary>
        /// Estica um sprite de acordo com a direção e taxa informada.
        /// </summary>
        /// <param name="sprite">Sprite a ser esticado.</param>
        /// <param name="direction">Direção em que o sprite deve ser esticado.</param>
        /// <param name="rate">Taxa de esticamento, que será multiplicada pelo tamanho. Valor 1 mantém o tamanho original.</param>
        /// <param name="minimumSize">Tamanho mínimo em pixels que o sprite deve atingir.</param>
        /// <param name="maximumSize">Tamanho máximo em pixels que o sprite deve atingir.</param>
        /// <remarks>É necessário chamar a função MoveSprite após esta para o mesmo sprite, para finalmente aplicar o esticamento corretamente.</remarks>
        public static void ApplyStretch(Sprite sprite, Enum.Direction direction, float rate, int minimumSize, int maximumSize)
        {
            if (direction == Enum.Direction.Up && rate != previousRateUp)
            {
                previousRateUp = rate;

                if (sprite.PictureBoxMain.Size.Height < minimumSize)
                {
                    sprite.PictureBoxMain.Size = new Size(sprite.PictureBoxMain.Size.Width, minimumSize);
                }
                else if (sprite.PictureBoxMain.Size.Height > maximumSize)
                {
                    sprite.PictureBoxMain.Size = new Size(sprite.PictureBoxMain.Size.Width, maximumSize);
                }
                else
                {
                    sprite.PictureBoxMain.Size = new Size(sprite.DefaultWidth, (int)(sprite.DefaultHeight * rate));
                }

                sprite.StretchedY = sprite.PictureBoxMain.Size.Height - sprite.DefaultHeight;
            }
            else if (direction == Enum.Direction.Down && rate != previousRateDown)
            {
                previousRateDown = rate;

                if (sprite.PictureBoxMain.Size.Height * rate < minimumSize)
                {
                    sprite.PictureBoxMain.Size = new Size(sprite.PictureBoxMain.Size.Width, minimumSize);
                }
                else if (sprite.PictureBoxMain.Size.Height * rate > maximumSize)
                {
                    sprite.PictureBoxMain.Size = new Size(sprite.PictureBoxMain.Size.Width, maximumSize);
                }
                else
                {
                    sprite.PictureBoxMain.Size = new Size(sprite.DefaultWidth, (int)(sprite.DefaultHeight * rate));
                }
            }
            else if (direction == Enum.Direction.Right && rate != previousRateRight)
            {
                previousRateRight = rate;

                if (sprite.PictureBoxMain.Size.Width < minimumSize)
                {
                    sprite.PictureBoxMain.Size = new Size(minimumSize, sprite.PictureBoxMain.Size.Height);
                }
                else if (sprite.PictureBoxMain.Size.Width > maximumSize)
                {
                    sprite.PictureBoxMain.Size = new Size(maximumSize, sprite.PictureBoxMain.Size.Height);
                }
                else
                {
                    sprite.PictureBoxMain.Size = new Size((int)(sprite.DefaultWidth * rate), sprite.DefaultHeight);
                }
            }
            else if (direction == Enum.Direction.Left && rate != previousRateLeft)
            {
                previousRateLeft = rate;

                if (sprite.PictureBoxMain.Size.Width < minimumSize)
                {
                    sprite.PictureBoxMain.Size = new Size(minimumSize, sprite.PictureBoxMain.Size.Height);
                }
                else if (sprite.PictureBoxMain.Size.Width > maximumSize)
                {
                    sprite.PictureBoxMain.Size = new Size(maximumSize, sprite.PictureBoxMain.Size.Height);
                }
                else
                {
                    sprite.PictureBoxMain.Size = new Size((int)(sprite.DefaultWidth * rate), sprite.DefaultHeight);
                }

                sprite.StretchedX = sprite.PictureBoxMain.Size.Width - sprite.DefaultWidth;
            }
        }
Example #11
0
 public override Enum.Direction AICheckKeys(Enum.Direction aiInput)
 {
     throw new NotImplementedException();
 }
Example #12
0
 public static Coordinate GetDirectionStep(Enum.Direction direction)
 {
     return(mapDirectionCoordinate[direction]);
 }