Ejemplo n.º 1
0
        public void LoadContent(MainPlayScreen screen)
        {
            this.screen = screen;
            var animationSpriteSheet = CONTENT_MANAGER.Sprites["animation"];

            font = MainPlayScreen.font;
            var frames    = JsonConvert.DeserializeObject <List <KeyValuePair <string, Rectangle> > >(File.ReadAllText(@"Content/sprite/animation.json"));
            var anims     = new List <Animation>();
            var animnames = Enum.GetNames(typeof(AnimationName));

            foreach (var an in animnames)
            {
                anims.Add(LoadAnimation(an, frames));
            }

            animatedEntity = new AnimatedEntity(IsoPos, VT2.Zero, Color.White, 0.4f, Constant.SCALE);
            animatedEntity.LoadContent(animationSpriteSheet);
            animatedEntity.AddAnimation(anims);
            animatedEntity.PlayAnimation(AnimationName.idle_right.ToString());

            walksfx                = CONTENT_MANAGER.Sounds["footstep"].CreateInstance();
            walksfx.Volume         = 0f;
            leversfx               = CONTENT_MANAGER.Sounds["lever"].CreateInstance();
            floorswitchpressedsfx  = CONTENT_MANAGER.Sounds["switch_pressed"].CreateInstance();
            floorswitchreleasedsfx = CONTENT_MANAGER.Sounds["switch_released"].CreateInstance();

            timer = new Timer();
        }
Ejemplo n.º 2
0
        private static Behaviour ShowDialog(string content)
        {
            MainPlayScreen mainPlayScreen = (MainPlayScreen)SCREEN_MANAGER.GetScreen("MainPlayScreen");

            return((activator, self) => {
                mainPlayScreen.timer.Stop();
                mainPlayScreen.msgbox.Show(content.ProcessAnnotation());
                mainPlayScreen.gameStates.Push(GameState.ShowDialog);
            });
        }
Ejemplo n.º 3
0
        private static Behaviour ExitGame()
        {
            MainPlayScreen mainPlayScreen = (MainPlayScreen)SCREEN_MANAGER.GetScreen("MainPlayScreen");

            return((a, s) => {
                mainPlayScreen.isExit = true;
                mainPlayScreen.CurrentGameState = GameState.Exit;
                mainPlayScreen.msgbox.Show("Exitting game.", "OK");
            });
        }
Ejemplo n.º 4
0
        private static Behaviour Win(string nextlvl = null)
        {
            MainPlayScreen mainPlayScreen = (MainPlayScreen)SCREEN_MANAGER.GetScreen("MainPlayScreen");

            return((activator, self) => {
                mainPlayScreen.isWin = true;

                if (!string.IsNullOrEmpty(nextlvl))
                {
                    mainPlayScreen.isBehaviourChangeMap = true;
                    mainPlayScreen.MapName = nextlvl;
                }
            });
        }
Ejemplo n.º 5
0
        private static Behaviour ShowDialog()
        {
            MainPlayScreen mainPlayScreen = (MainPlayScreen)SCREEN_MANAGER.GetScreen("MainPlayScreen");

            return((activator, self) => {
                if (self.Memory.Count == 0)
                {
                    return;
                }

                mainPlayScreen.timer.Stop();
                var content = self.Memory.Pop();
                mainPlayScreen.msgbox.Show(content.ProcessAnnotation());
                mainPlayScreen.gameStates.Push(GameState.ShowDialog);
            });
        }
        private void InitScreen()
        {
            var playscreen = new MainPlayScreen(GraphicsDevice)
            {
                MapName = CONTENT_MANAGER.MapName ?? "menu"
            };

            TransitionScreen transitionScreen = new TransitionScreen(GraphicsDevice)
            {
                StartingDirectory = Path.Combine(CONTENT_MANAGER.LocalRootPath, "map"),
                SearchPattern     = "*.tmx",
                CallBack          = x => {
                    playscreen.MapName = x;
                    SCREEN_MANAGER.GotoScreen("MainPlayScreen");
                }
            };

            SCREEN_MANAGER.AddScreen(playscreen);
            SCREEN_MANAGER.AddScreen(transitionScreen);

            SCREEN_MANAGER.GotoScreen("MainPlayScreen");

            SCREEN_MANAGER.Init();
        }
 public void LoadContent(MainPlayScreen screen)
 {
     spritesheet = MainPlayScreen.spritesheet;
 }