Exemple #1
0
        public GameSavedData(GameManager_Master gameManagerMaster, Player_Inventory playerInventory, TorchBehavior torch)
        {
            //---Save current scene index---//
            savedSceneIndex = gameManagerMaster.currentBuildIndex;

            playerPosition    = new float[3];
            playerPosition[0] = playerInventory.transform.position.x;
            playerPosition[1] = playerInventory.transform.position.y;
            playerPosition[2] = playerInventory.transform.position.z;

            playerY_Rotation = playerInventory.transform.rotation.y;

            torchEnergy = torch.energy;

            if (playerInventory.items.Count > 0)
            {
                itemsName = new string[playerInventory.items.Count];
            }
            else
            {
                itemsName = new string[1];
            }

            int currentIndex = 0;

            foreach (Item item in playerInventory.items)
            {
                itemsName[currentIndex] = item.itemName;
                currentIndex++;
            }
        }
 void SetInitialReferences()
 {
     gameManagerMaster = GetComponent <GameManager_Master>();
     if (inventoryObject == null)
     {
         Debug.LogWarning("Inventory Object not found!");
     }
     else
     {
         inventoryObject.SetActive(false);
     }
 }
 void SetInitialReferences()
 {
     gameManagerMaster = GetComponent <GameManager_Master>();
     if (player != null)
     {
         playerMaster     = player.GetComponent <Player_Master>();
         playerController = player.GetComponent <NewFirstPersonController>();
     }
     else
     {
         Debug.LogWarning("Player is not assigned on GameManager_PlayerControllerToggle");
     }
 }
Exemple #4
0
        public static void SaveGame(GameManager_Master gameManagerMaster, Player_Inventory playerInventory)
        {
            BinaryFormatter formatter = new BinaryFormatter();
            string          filePath  = string.Concat(Application.persistentDataPath, "/", savedFileName);
            FileStream      file      = new FileStream(filePath, FileMode.Create);

            TorchBehavior torch = playerInventory.gameObject.GetComponent <TorchBehavior>();

            GameSavedData data = new GameSavedData(gameManagerMaster, playerInventory, torch);

            formatter.Serialize(file, data);

            file.Close();
        }
Exemple #5
0
        void SetInitialReferences()
        {
            if (audioObject != null)
            {
                audioManager = audioObject.GetComponent <AudioManager>();
            }
            else
            {
                Debug.LogWarning("Please attach audioManager Gameobject");
            }

            if (game != null)
            {
                gameManagerMaster = game.GetComponent <GameManager_Master>();
            }
            else
            {
                Debug.LogWarning("Please attach GameManager Gameobject");
            }

            playerMaster = GetComponent <Player_Master>();
            torchMaster  = GetComponent <TorchBehavior>();
            soundOn      = true;
        }
 void SetInitialReferences()
 {
     gameManagerMaster = GetComponent <GameManager_Master>();
 }
 void SetInitialReferences()
 {
     gameManagerMaster = GetComponent <GameManager_Master>();
     isCursorShowing   = false;
 }
 void SetInitialReferences()
 {
     gameManagerMaster = GetComponent <GameManager_Master>();
     isPaused          = false;
 }
 void SetInitialReferences()
 {
     gameManagerMaster = GetComponent <GameManager_Master>();
     gameOverManu.SetActive(false);
 }
 void Awake()
 {
     instance = this;
 }