예제 #1
0
        private void LoadDirectionSprites()
        {
            // Loading all the direction sprites.
            DirectionSprite directionUp = new DirectionSprite(new Vector2(50, 0), 1);

            directionUp.sprite.texture = Content.Load <Texture2D>("DirectionSprites/arrow_up");
            directionManager.AddDirection(directionUp);
            DirectionSprite directionDown = new DirectionSprite(new Vector2(50, 0), 2);

            directionDown.sprite.texture = Content.Load <Texture2D>("DirectionSprites/arrow_down");
            directionManager.AddDirection(directionDown);
            DirectionSprite directionLeft = new DirectionSprite(new Vector2(50, 0), 3);

            directionLeft.sprite.texture = Content.Load <Texture2D>("DirectionSprites/arrow_left");
            directionManager.AddDirection(directionLeft);
            DirectionSprite directionRight = new DirectionSprite(new Vector2(50, 0), 4);

            directionRight.sprite.texture = Content.Load <Texture2D>("DirectionSprites/arrow_right");
            directionManager.AddDirection(directionRight);

            // Loading a random number so that one object appears at a time.
            Random randomGenerator = new Random();

            randomNumber = randomGenerator.Next(1, 5);
            switch (randomNumber)
            {
            case 1:
                directionUp.appearanceStatus = true;
                break;

            case 2:
                directionDown.appearanceStatus = true;
                break;

            case 3:
                directionLeft.appearanceStatus = true;
                break;

            case 4:
                directionRight.appearanceStatus = true;
                break;
            }
        }
예제 #2
0
 public void AddDirection(DirectionSprite direction)
 {
     directions.Add(direction);
 }