void Awake()
 {
     if (s_instance == null) {
         s_instance = this;
     } else {
         Destroy(gameObject);
     }
 }
Exemplo n.º 2
0
        public PersonConditionsPanel(ISectorUiState uiState, int screenX, int screenY,
                                     IUiContentStorage uiContentStorage, IUiSoundStorage uiSoundStorage, SoundtrackManager soundtrackManager,
                                     GraphicsDevice graphicsDevice)
        {
            _uiState           = uiState;
            _screenX           = screenX;
            _screenY           = screenY;
            _uiContentStorage  = uiContentStorage;
            _uiSoundStorage    = uiSoundStorage;
            _soundtrackManager = soundtrackManager;
            _alertSoundEffect  = _uiSoundStorage.GetAlertEffect().CreateInstance();

            _alertTexture = CreateTexture(graphicsDevice, ICON_SIZE + ICON_SPACING * 2, ICON_SIZE + ICON_SPACING * 2,
                                          LastColors.Red);
            _alertedConditions = new List <IPersonCondition>();
        }
 void Awake()
 {
     s_instance = this;
     DontDestroyOnLoad (gameObject); //persist through scenes
 }
Exemplo n.º 4
0
 void Awake()
 {
     s_instance = this;
     DontDestroyOnLoad(gameObject);          //persist through scenes
 }
Exemplo n.º 5
0
 public void EnterFairyFountain()
 {
     SoundtrackManager.Get().ToggleSoundtrack(false);
     // SoundtrackManager.Get().ToggleSoundtrack(true, terrorSong);
 }
Exemplo n.º 6
0
	// Use this for initialization
	void Start () {
        _manager = GetComponentInParent<SoundtrackManager>();
        _collider = GetComponent<BoxCollider>();
	}
Exemplo n.º 7
0
        protected override void Update(GameTime gameTime)
        {
#if !DEBUG
            if (!IsActive)
            {
                return;
            }
#endif

            if (_wantsToQuit)
            {
                Exit();
            }

            SteamAPI.RunCallbacks();

            GameTime = gameTime;
            GameUpdateCalled?.Invoke();

            InputSystem.Update();

            _frameRateTimer += gameTime.ElapsedGameTime.TotalMilliseconds;
            if (_frameRateTimer > 1000f)
            {
                FPS             = _totalFrames;
                _totalFrames    = 0;
                _frameRateTimer = 0;
            }

            IsMouseVisible = false;

            Cursor.Update();
            SoundtrackManager.Update();

            MessageBox.Update();
            if (MessageBox.IsActive)
            {
                return;
            }

            TextInputBox.Update();
            if (TextInputBox.IsActive)
            {
                return;
            }

            GameDebug.Update();
            if (GameDebug.IsTyping)
            {
                return;
            }

            PauseMenu.Update();
            OptionsMenu.Update();
            if (OptionsMenu.IsActive)
            {
                return;
            }
            if (PauseMenu.IsActive)
            {
                return;
            }

            Dialog.Update();

            Overlay.Update();
            KeyPopUp.Update();

            Player player = GameWorld.GetPlayers()[0];

            Session.Update();

            //Update the game based on what GameState it is
            switch (CurrentGameState)
            {
            case GameState.MainMenu:
                MainMenu.Update();
                if (GameWorld.TileArray != null && GameWorld.TileArray.Length != 0)
                {
                    goto case GameState.GameWorld;
                }
                break;

            case GameState.LoadingScreen:
                LoadingScreen.Update();

                if (!IsLoadingContent)
                {
                    CurrentGameState = _desiredGameState;
                }
                break;

            case GameState.GameWorld:
                if (IsLoadingContent)
                {
                    return;
                }
                if (GameWorld.IsOnDebug)
                {
                    break;
                }
                GameWorld.TotalUpdateTimer.Start();
                if (!TimeFreeze.IsTimeFrozen())
                {
                    GameWorld.UpdateWorld();
                }
                GameWorld.UpdateVisual();
                GameWorld.TotalUpdateTimer.Measure();


                if (StoryTracker.IsInStoryMode)
                {
                    StoryTracker.Update();
                }
                break;
            }

            base.Update(gameTime);
        }
Exemplo n.º 8
0
        public static bool TryLoadFromFile(GameMode currentGameMode)
        {
            Overlay.FadeToBlack();
            Cursor.Hide();

            if (WorldData.IsTopDown)
            {
                SpriteSheet = ContentHelper.LoadTexture("Tiles/spritemap_level_select_1");
            }
            else
            {
                SpriteSheet = defaultSpriteSheet;
            }

            LoadingScreen.LoadingText = "Where did I put that file?";
            var tileIDs = WorldData.TileIDs;
            var wallIDs = WorldData.WallIDs;

            LoadingScreen.LoadingText = "Starting up world...";
            _clouds  = new List <Cloud>();
            Entities = new List <Entity>();

            var width  = WorldData.LevelWidth;
            var height = WorldData.LevelHeight;

            var maxClouds = width / 20;

            for (var i = 0; i < maxClouds; i++)
            {
                _clouds.Add(new Cloud(new Vector2(TMBAW_Game.DefaultResWidth, TMBAW_Game.DefaultResHeight), maxClouds, i));
            }

            LevelEditor.InteractableConnections.Clear();

            TileArray = new Tile[tileIDs.Length];
            WallArray = new Tile[tileIDs.Length];

            LoadingScreen.LoadingText = "Getting tiles from junkyard...";
            ConvertToTiles(TileArray, tileIDs);
            ConvertToTiles(WallArray, wallIDs, true);

            LoadingScreen.LoadingText = "Lighting up the world...";

            LoadingScreen.LoadingText = "Finding cardboard backgrounds...";
            Background.Load();

            LoadingScreen.LoadingText = "Wait, you are editing it???";
            if (currentGameMode == GameMode.Edit)
            {
                LevelEditor.Load();
            }
            try
            {
                ChunkManager.ConvertToChunks(WorldData.LevelWidth, WorldData.LevelHeight);
            }
            catch (ArgumentException e)
            {
                TMBAW_Game.MessageBox.Show(e.Message);
                return(false);
            }

            if (Session.IsHost)
            {
                Session.SendEntityUpdates();
            }

            Session.WaitForPlayers();

            SoundtrackManager.PlayTrack(WorldData.SoundtrackId, true);

            StoryTracker.OnLevelLoad();

            TMBAW_Game.Camera.ResetZoom();
            Overlay.FadeIn();

            // Start interpreting the script for this world.
            scriptManager.SetFilename(WorldData.LevelName);
            if (currentGameMode == GameMode.Play)
            {
                scriptManager.Start();
            }

            return(true);
        }