Esempio n. 1
0
 private void Start()
 {
     if (instance != null && instance != this)
     {
         Destroy(this.gameObject);
     }
     else
     {
         instance = this;
     }
 }
Esempio n. 2
0
        public Engine()
        {
            _gameLog.WriteLine($"[{DateTime.Now}] -- You have entered the game.");

            _loader = new XmlLoader(_gameLog);

            var player = new Character(_gameLog)
            {
                Name            = "Player",
                CharacterType   = CharacterType.Player,
                DefaultAttitude = Attitude.Neutral,
                Inventory       = new Inventory(),
                Stats           = new StatSet
                {
                    Level                    = 1,
                    Race                     = Race.Human,
                    Gender                   = Gender.Male,
                    Health                   = 30,
                    Mana                     = 50,
                    ActionPoints             = 12,
                    MaxHealth                = 30,
                    MaxMana                  = 50,
                    MaxActionPoints          = 12,
                    AvailableBaseSkillPoints = 50,
                    Strength                 = 5,
                    Perception               = 5,
                    Stamina                  = 5,
                    Charisma                 = 5,
                    Intelligence             = 5,
                    Agility                  = 10,
                }
            };

            player.FightComponent = new PlayerFightComponent(player);

            _currentCharacter = player;

            var scene = _loader.LoadScene(1);

            scene.Characters.Add(player);
            _currentCharacter.CurrentScene = scene;

            scene.InitializeScene();

            _currentState = GameState.World;

            _gameScreen = new GameScreen(_gameLog, _currentCharacter);
            _statScreen = new StatScreen(_currentCharacter);
        }
Esempio n. 3
0
        /// <summary>
        /// LoadContent will be called once per game and is the place to load
        /// all of your content.
        /// </summary>
        protected override void LoadContent()
        {
            spriteBatch = new SpriteBatch(GraphicsDevice);

            Global.Pixel = new Texture2D(GraphicsDevice, 1, 1);
            Global.Pixel.SetData <Color>(new Color[] { Color.White });

            HighScoreControl.Images = new System.Collections.Generic.Dictionary <ControlTypes, Texture2D>();
            HighScoreControl.Images.Add(ControlTypes.Tap, Content.Load <Texture2D>("Screen Images/Tap Asset"));
            HighScoreControl.Images.Add(ControlTypes.Swipe, Content.Load <Texture2D>("Screen Images/Swipe Asset"));

            TitleScreen         titleScreen     = new TitleScreen(GraphicsDevice, 1080, 1920);
            GameScreen          gameScreen      = new GameScreen(GraphicsDevice, 1080, 1920);
            GameOverScreen      gameOverScreen  = new GameOverScreen(GraphicsDevice, 1080, 1920);
            OptionScreen        optionScreen    = new OptionScreen(GraphicsDevice, 1080, 1920);
            ControlSelectScreen controlScreen   = new ControlSelectScreen(GraphicsDevice, 1080, 1920);
            StatScreen          highScoreScreen = new StatScreen(GraphicsDevice, 1080, 1920);

            ScreenManager.Add(gameScreen);
            ScreenManager.Add(titleScreen);
            ScreenManager.Add(optionScreen);
            ScreenManager.Add(controlScreen);
            ScreenManager.Add(highScoreScreen);
            ScreenManager.Add(gameOverScreen);

            ScreenManager.Load(Content);


            Global.ElapsedGameTime = TimeSpan.Zero;

            Vector2 currentScale = new Vector2(GraphicsDevice.Viewport.Width / 1080f, GraphicsDevice.Viewport.Height / 1920f);

#if WINDOWS
            MouseManager.Instance.Scale = currentScale;
#else
            //Global.ShowAds(true);
#endif

            ScreenManager.Scale(currentScale);
            ScreenManager.MainScreen = "Title";
        }