コード例 #1
0
 /// <summary>
 /// Constructor.
 /// </summary>
 public CalibrationMenuScreen()
     : base("Calibrate Kinect", Color.RoyalBlue)
 {
     instructions = new Text[2];
     instructions[0] = new Text("Move closer/farther away from the screen", new Vector2(Main.windowSize.X * 0.5f, Main.windowSize.Y - 300),1.0f, Color.Gold);
     instructions[1] = new Text("until your head approaches the top of the frame", new Vector2(Main.windowSize.X * 0.5f, Main.windowSize.Y - 200), 1.0f, Color.Gold);
     KinectDependencies.Add(KinectDependency.Color);
 }
コード例 #2
0
        public IconText(string t, Texture2D iconSprite, Vector2 iconSize, Vector2 position, float scale, Color color, TextAlignment alignment, TextEffect effect = TextEffect.None, float alpha = 1.0f)
            : base(position,new Vector2(0,-1),Vector2.Zero)
        {
            text = new Text(t,  position, scale, color, effect);
            icon = new DrawableAsset<Texture2D>(Vector2.Zero, new Vector2(0, -1), iconSize, iconSprite);

            this.alignment = alignment;
            UpdateAlignment();
        }
コード例 #3
0
 public override void Activate(InputState input)
 {
     base.Activate(input);
     AddMenuEntry("Replay", ReplayGame);
     AddMenuEntry("To Main Menu", ToMainMenu);
     AddMenuEntry("Quit Game", CheckQuitGame);
     SetHandCursor(Main.sprites["handCursor"]);
     SetSelectionSprite(Main.animatedSprites["load"]);
     Vector2 finalScorePos = new Vector2(Main.windowSize.X / 2, Entries[Entries.Count - 1].boundry.Bottom + TextSettings.CurrentFont.MeasureString("Final Score: " + previousScore.ToString()).Y / 2 * 2.0f);
     finalScoreText = new Text("Final Score: " + previousScore.ToString(), finalScorePos, 1.0f, Color.Goldenrod);
 }
コード例 #4
0
 public override void Activate(InputState input)
 {
     AddGestureOption(" - Hold Up Right Arm to Select Right", GestureTests.RightArmUp, OnRight, Main.sprites["confirmGesture"]);
     AddGestureOption(" - Hold Up Left Arm to Left Right", GestureTests.LeftArmUp, OnLeft, Main.sprites["cancelGesture"]);
     help = new Text("", gestureOptions[gestureOptions.Count - 1].Position + new Vector2(0, padding * 3), (Main.windowSize.X / 1920.0f) * 2.0f, Color.Goldenrod);
     armIndicator = new Text("", Main.windowSize * 0.5f, (Main.windowSize.X / 1920.0f) * 3.0f, Color.Lime);
     Vector2 selectionSize = new Vector2(Main.windowSize.X / 4.0f, Main.windowSize.X / 4.0f);
     selectionLoader = new DrawableAsset<Animation2D>(Main.windowSize * 0.5f, new Vector2(0, -1), selectionSize, Main.content.Load<Animation2D>("Content\\Images\\load"));
     if (input.Kinect.IsEnabled())
     {
         input.Kinect.EnableGestureTest(GestureTests.RightArmDown, OnRightDown);
         input.Kinect.EnableGestureTest(GestureTests.LeftArmDown, OnLeftDown);
     }
     base.Activate(input);
 }
コード例 #5
0
 public override void Activate(InputState input)
 {
     Vector2 screenDimensions = new Vector2(ScreenManager.GraphicsDevice.Viewport.Width, ScreenManager.GraphicsDevice.Viewport.Height);
     float scale = (screenDimensions.X / 1920.0f) * 2.0f;
     padding = (screenDimensions.Y / 1200.0f) * padding;
     title = new Text(menuTitle, new Vector2(screenDimensions.X * 0.5f, screenDimensions.Y * 0.15f), scale, titleColor);
     base.Activate(input);
 }
コード例 #6
0
        /// <summary>
        /// Constructor automatically includes the standard "A=ok, B=cancel"
        /// usage text prompt.
        /// </summary>
        public GesturePromptScreen(string title, Color titleColor)
        {
            this.KinectDependencies.Add(KinectDependency.Skeleton);
            this.gestureOptions = new List<GestureOptionEntry>();
            IsPopup = true;

            TransitionOnTime = TimeSpan.FromSeconds(0.2);
            TransitionOffTime = TimeSpan.FromSeconds(0.2);
            this.titleColor = titleColor;
            this.titleString = title;
            float scale = (Main.windowSize.X / 1920.0f) * 2.0f;
            padding = (Main.windowSize.Y / 1200.0f) * padding;
            this.title = new Text(titleString, new Vector2(Main.windowSize.X * 0.5f, 100), scale, titleColor);
        }
コード例 #7
0
 public new void LoadContent()
 {
     framerateString = new Text("", new Vector2(200, 100));
 }
コード例 #8
0
        public void PlaceAnimal(int quadrant)
        {
            Rectangle quad = Utilities.QuadrantToRect(quadrant);

            Rectangle placementRect = new Rectangle(quad.Left, quad.Top, 160, 160);
            Vector2 dirToRect = new Vector2(placementRect.Center.X - this.snake.head.Position.X, placementRect.Center.Y - this.snake.head.Position.Y);
            while (!grid.GridsEmpty(placementRect) ||
                (quad.Contains(new Point((int)snake.head.Position.X, (int)snake.head.Position.Y)) && Utilities.AngleBetween(dirToRect, this.snake.head.Direction) < Math.PI / 3.0))
            {
                placementRect.X = Main.numGenerator.Next(quad.Left, quad.Right-100);
                placementRect.Y = Main.numGenerator.Next(quad.Top, quad.Bottom - 100);
                dirToRect = new Vector2(placementRect.Center.X - this.snake.head.Position.X, placementRect.Center.Y - this.snake.head.Position.Y);
            }

            animals.Add(new Mouse(grid, new Vector2(placementRect.Center.X, placementRect.Center.Y), this.mouseSpeed));

            if (animalTextDraw != AnimalText.None)
            {

                string str = "";
                if (this.animalTextDraw == AnimalText.Quadrant)
                {
                    str = quadrantTarget.ToString();
                    foreach (Text t in animalText)
                        t.String = str;
                }

                else if (this.animalTextDraw == AnimalText.Position)
                {
                    str = Utilities.QuadrantToPolarity(quadrantTarget);
                    foreach (Text t in animalText)
                        t.String = str;
                }

                Text newText = new Text(str, animals[animals.Count - 1].Position, Main.windowSize.X / 1920.0f , Color.Cyan, TextEffect.None);
                newText.SetAlternateColor(Color.DarkCyan);
                animalText.Add(newText);

            }

            animals[animals.Count - 1].ScheduleCollisionHandling();

            landscape.AddComponent(animals[animals.Count - 1] as IRenderableAsset);
        }
コード例 #9
0
        /// <summary>
        /// Load graphics content for the game.
        /// </summary>
        /// 
        public override void Activate(InputState input)
        {
            grid = new DrawableGrid(3);
            landscape = new Landscape();
            effectSprites = new List<EffectSprite>();
            //for (int i = 0; i < Main.backgroundLoops.Count; i++)
            //Main.backgroundLoops[i].Play();
            scoreText = new IconText("", Main.sprites["points"], new Vector2(Main.windowSize.X / 15.0f, Main.windowSize.X / 15.0f), new Vector2(Main.windowSize.X / 6.0f, 100.0f), 0.5f, Color.Goldenrod, TextAlignment.Right);

            quadrantTarget = Main.numGenerator.Next() % 4 + 1;
            if (currentExcercise == QuadrantExcercises.PolarityOne || currentExcercise == QuadrantExcercises.PolarityTwo)
                quadrantCommand = new IconText(Utilities.QuadrantToPolarity(quadrantTarget), Main.sprites["quadrant"], new Vector2(Main.windowSize.X / 10.0f, Main.windowSize.X / 10.0f), new Vector2(Main.windowSize.X / 3.0f, 100), 1.0f, Color.Azure, TextAlignment.Right, TextEffect.Bubble);

            else
                quadrantCommand = new IconText(quadrantTarget.ToString(), Main.sprites["quadrant"], new Vector2(Main.windowSize.X / 10.0f, Main.windowSize.X / 10.0f), new Vector2(Main.windowSize.X / 3.0f, 100), 1.0f, Color.Azure, TextAlignment.Right, TextEffect.Bubble);
            resultText = new Text("", new Vector2(Main.windowSize.X / 2.0f, Main.windowSize.X / 10.0f), Main.windowSize.X / 1920.0f, Color.Red, TextEffect.Fade);

            this.lives = 5;
            lifeSprites = new List<DrawableAsset<Texture2D>>();
            Vector2 lifeSpriteSize = new Vector2(Main.windowSize.X / 15.0f, Main.windowSize.X / 15.0f);
            for (int i = 0; i < lives; i++)
                lifeSprites.Add(new DrawableAsset<Texture2D>(new Vector2(Main.windowSize.X - (i + 1) * lifeSpriteSize.X, lifeSpriteSize.Y), new Vector2(0, -1), lifeSpriteSize, Main.sprites["snakeBody"]));

            landscape.AddStain(new CoordinateSystem(coordinateType));
            snake = new Snake(grid, Main.windowSize * 0.5f,  this.snakeSpeed, this.startSnakeLength);
            landscape.AddComponent(snake);

            animals = new List<IDrawableGridAsset>();
            for (int i = 0; i < 4; i++)
                this.PlaceAnimal(i + 1);

            List<Type> snakeConditions = new List<Type>();
            snakeConditions.Add(typeof(Mouse));
            snakeConditions.Add(typeof(Rabbit));

            snake.ScheduleCollisionHandling(snakeConditions);
            //ScreenManager.Game.ResetElapsedTime();

            base.Activate(input);
        }