Example #1
0
        static bool Unload(UnityModManager.ModEntry modEntry)
        {
            UserInterfaceHelper.DestroyObjectDropperButton();
            SpawnableManager.DisposeLoadedAssets();

            Harmony?.UnpatchAll();
            return(true);
        }
 public GameWinGameState(Game1 game, IGameState oldRoomState)
 {
     Game = game;
     roomStatePreserved = (RoomGameState)oldRoomState;
     spawnableManager   = (SpawnableManager)roomStatePreserved.SpawnableManager;
     curtain            = new Curtain(game.SpriteBatch);
     win    = SoundFactory.Instance.CreateWinSound();
     refill = SoundFactory.Instance.CreateRefillSound();
 }
Example #3
0
 public void OnCollisionEnter2D(Collision2D collision)
 {
     // We have collider with the player
     if (collision.gameObject.GetComponent <TopDownEnemy>() != null)
     {
         // Let the spawn manager know that this enemy has dies
         SpawnableManager.informSpawnableDestroyed(collision.gameObject, true);
     }
 }
Example #4
0
        public SecretRoom(List <IPlayer> playerList, Game1 game)
        {
            Game       = game;
            AllObjects = new SpawnableManager(playerList, Game);

            roomDictionary        = new Dictionary <Constants.Direction, IRoom>();
            roomDoors             = new Dictionary <Constants.Direction, IDoor>();
            roomConnectionStrings = new Dictionary <Constants.Direction, string>();

            collisionManager = new CollisionManager(AllObjects);
            RoomType         = 0;
            Visiting         = false;
            SpawnWalls();
        }
 private static void OnToggle(bool enabled)
 {
     if (enabled)
     {
         if (AccessTools.TypeByName(nameof(XLObjectDropper.Settings)) != null)
         {
             SpawnableManager.DeleteSpawnedObjects();
         }
         else
         {
             HandleFailure();
         }
     }
 }
        public GameLoseGameState(Game1 game, IGameState oldRoomState)
        {
            Game = game;
            roomStatePreserved = (RoomGameState)oldRoomState;
            spawnableManager   = (SpawnableManager)roomStatePreserved.SpawnableManager;
            link_die           = SoundFactory.Instance.CreateLinkDieSound();
            game_over          = SoundFactory.Instance.CreateGameOverSound();
            gameOverSprite     = GameStateSpriteFactory.Instance.CreateGameOverSprite();
            redOverlaySprite   = GameStateSpriteFactory.Instance.CreateRedOverlaySprite();

            GameLoseMenu = new GameLoseMenu(Game);

            controllerList = GetControllerList(GameLoseMenu.Buttons);
        }
Example #7
0
        private void ClearAllClicked()
        {
            if (SpawnableManager.SpawnedObjects == null || !SpawnableManager.SpawnedObjects.Any())
            {
                return;
            }

            // Should we maybe show an 'are you sure?' dialog
            var gameObjects             = SpawnableManager.SpawnedObjects.Select(x => x.SpawnedInstance).ToList();
            var batchObjectDeletedEvent = new BatchObjectDeletedEvent(gameObjects);

            batchObjectDeletedEvent.AddToUndoStack();

            SpawnableManager.DeleteSpawnedObjects();
        }
            static void Prefix(LevelManager __instance, LevelInfo level)
            {
                if (level.Equals(LevelManager.Instance.currentLevel) || GameStateMachine.Instance.IsLoading)
                {
                    return;
                }

                // Display Dialog here
                // If yes, save out objects
                //var test = UnityEngine.Object.Instantiate(original: AssetBundleHelper.UnsavedChangesDialogPrefab);
                //test.SetActive(true);


                //Utilities.SaveManager.Instance.SaveCurrentSpawnables();

                SpawnableManager.DeleteSpawnedObjects();

                return;
            }
        public void LoadSave(LevelSaveData levelSave)
        {
            if (string.IsNullOrEmpty(levelSave.filePath) || !File.Exists(levelSave.filePath))
            {
                return;
            }
            if (levelSave.gameObjects == null || !levelSave.gameObjects.Any())
            {
                return;
            }

            SpawnableManager.DeleteSpawnedObjects();

            foreach (var savedGameObject in levelSave.gameObjects)
            {
                savedGameObject.Instantiate();
            }

            SaveLoaded?.Invoke();
        }
Example #10
0
        private void Cmd_takeHit(int objectID)
        {
            foreach (NetworkIdentity identity in Component.FindObjectsOfType <NetworkIdentity>())
            {
                if (identity.netId.Value == objectID)
                {
                    // Try to get the ai script
                    TargetAI ai = identity.GetComponentInChildren <TargetAI>();

                    // Check for the target AI component
                    if (ai != null)
                    {
                        // Inform the enemy manager that an enemy has died
                        SpawnableManager.informSpawnableDestroyed(identity.gameObject, true);
                    }

                    break;
                }
            }
        }
Example #11
0
        private void takeHit(RaycastHit hit)
        {
            // Get the game object
            GameObject hitObject = hit.collider.gameObject;

            // Find the highest level transform
            Transform hitRoot = hitObject.transform.root;

#if ULTIMATE_SPAWNER_NETWORKED == true
            NetworkIdentity id = hitRoot.GetComponent <NetworkIdentity>();

            // We have hit a static scene object
            if (id == null)
            {
                return;
            }

            // We have hit a non-enemy object (Another player)
            if (id.GetComponent <TargetAI>() == null)
            {
                return;
            }

            // Kill the enemy
            Cmd_takeHit((int)id.netId.Value);
#else
            // Try to get the ai script
            TargetAI ai = hitRoot.GetComponentInChildren <TargetAI>();


            // Check for the target AI component
            if (ai != null)
            {
                // Inform the enemy manager that an enemy has died
                SpawnableManager.informSpawnableDestroyed(hitRoot.gameObject, true);
            }
#endif
        }