Ejemplo n.º 1
0
 public static void Run(GameSpecification specification, GameCartridge gameCartridge, string devContentPath)
 {
     using (var game = new MachinaGame(specification, gameCartridge, new DesktopPlatformContext(), devContentPath))
     {
         game.Run();
     }
 }
Ejemplo n.º 2
0
        private void SetCursorBasedOnEdge(RectEdge edge)
        {
            if (edge == RectEdge.BottomLeftCorner || edge == RectEdge.TopRightCorner)
            {
                MachinaGame.SetCursor(MouseCursor.SizeNESW);
            }

            if (edge == RectEdge.TopLeftCorner || edge == RectEdge.BottomRightCorner)
            {
                MachinaGame.SetCursor(MouseCursor.SizeNWSE);
            }

            if (edge == RectEdge.Right || edge == RectEdge.Left)
            {
                MachinaGame.SetCursor(MouseCursor.SizeWE);
            }

            if (edge == RectEdge.Bottom || edge == RectEdge.Top)
            {
                MachinaGame.SetCursor(MouseCursor.SizeNS);
            }

            if (edge != RectEdge.None)
            {
                this.actor.scene.hitTester.AddCandidate(new HitTestResult(this.actor, (approval) => { }));
            }
        }
Ejemplo n.º 3
0
 public override void OnKey(Keys key, ButtonState state, ModifierKeys modifiers)
 {
     if (key == Keys.T && state == ButtonState.Pressed && modifiers.Control)
     {
         MachinaGame.Print("--");
         for (var i = 0; i < transform.ChildCount; i++)
         {
             MachinaGame.Print(transform.ChildAt(i).transform.LocalPosition);
         }
     }
 }
Ejemplo n.º 4
0
        public IEnumerator <ICoroutineAction> EndingSequence()
        {
            foreach (var text in LevelDialogue.Ending)
            {
                yield return(new WaitUntil(UntilTextCrawlIsFinished(text)));

                yield return(new WaitUntil(UntilTextCrawlIsClosed()));

                this.input.upward = true;
            }

            MachinaGame.Quit();
        }
Ejemplo n.º 5
0
        public static void Run(GameCartridge cartridge, GameSpecification spec, Activity activity)
        {
            GamePlatform.Set(PlatformType.Android, GetFilesAtContentDirectory_Android, ReadFileInContentDirectory_Android, ReadTextFile_Android);

            // I don't think I need these but they might be useful
            // activity.Window.AddFlags(WindowManagerFlags.Fullscreen);
            // activity.Window.AddFlags(WindowManagerFlags.LayoutInOverscan);

            var game = new MachinaGame(spec, cartridge, new AndroidPlatformContext());
            var view = game.Services.GetService(typeof(View)) as View;

            view.SystemUiVisibility =
                (StatusBarVisibility)(SystemUiFlags.LayoutStable | SystemUiFlags.LayoutHideNavigation | SystemUiFlags.LayoutFullscreen | SystemUiFlags.HideNavigation | SystemUiFlags.Fullscreen | SystemUiFlags.ImmersiveSticky);
            activity.SetContentView(view);
            game.Run();
        }
Ejemplo n.º 6
0
        public void StartNextLevel()
        {
            var levels = Level.All;

            MachinaGame.Print("Starting level", this.levelIndex, levels.Length);

            if (levels.Length > this.levelIndex)
            {
                var currentLevel = levels[this.levelIndex];

                for (int i = 0; i < currentLevel.FishCount; i++)
                {
                    var   camWidth = this.actor.scene.camera.ViewportWidth;
                    float randomX  = MachinaGame.Random.CleanRandom.Next(camWidth / 2, camWidth) * ((MachinaGame.Random.CleanRandom.NextDouble() < 0.5) ? -1f : 1f);
                    var   fishPos  = new Vector2(randomX, 0);

                    Game1.SpawnNewFish(
                        this.actor.scene, transform.Position + fishPos, RequireComponent <Player>(), currentLevel.FishStats);
                }

                foreach (var seaweedInfo in currentLevel.Seaweed)
                {
                    Game1.SpawnSeaweed(this.actor.scene, transform.Position, seaweedInfo, this);
                }

                for (int i = 0; i < currentLevel.JellyfishCount; i++)
                {
                    Game1.SpawnJellyfish(this.actor.scene, this);
                }
                this.levelIndex++;
            }
            else
            {
                MachinaGame.Print("Finished!");
            }

            WakeUp();
        }
Ejemplo n.º 7
0
 public void OnGameConstructed(MachinaGame machinaGame)
 {
 }
Ejemplo n.º 8
0
 public void OnGameConstructed(MachinaGame machinaGame)
 {
     MachinaClient.Graphics.IsFullScreen = true;
 }
Ejemplo n.º 9
0
 public AssetLibrary(MachinaGame game)
 {
     this.contentManager = game.Content;
 }