Exemplo n.º 1
0
 // INVERTER MUNDO
 public void InvertWorld(bool sel)
 {
     invertWorld = sel;
     if (!currentSceneName.Equals("GameOver") && !currentSceneName.Equals("MainMenu") && !currentSceneName.Equals("Credits"))
     {
         if (colorCamera == null)
         {
             colorCamera = GameObject.Find("MainCamera").GetComponent <UnityStandardAssets.ImageEffects.ColorCorrectionLookup>();
         }
         colorCamera.enabled = invertWorld;
     }
 }
Exemplo n.º 2
0
        // CRIAÇÃO JOGO
        public void Awake()
        {
            if (instance == null)
            {
                DontDestroyOnLoad(gameObject);
                instance = this;

                currentSceneName  = SceneManager.GetActiveScene().name;
                previousSceneName = currentSceneName;

                hud = GameObject.Find("HUDCanvas").gameObject;

                levelImage = hud.transform.Find("LevelImage").gameObject;
                levelText  = levelImage.transform.Find("LevelText").GetComponent <Text>();

                tampaProtectionObject  = tampa.GetComponent <ProtectionObject>();
                escudoProtectionObject = escudo.GetComponent <ProtectionObject>();

                player         = GetComponent <Player>();
                rendererPlayer = GetComponent <Renderer>();
                colorCamera    = GameObject.Find("MainCamera").GetComponent <UnityStandardAssets.ImageEffects.ColorCorrectionLookup>();

                currentMission = PlayerPrefs.GetInt("Mission");
                // Salva o jogo somente quando jogar através do New Game ou Continue
                if (currentMission == -1 || currentMission == 0)
                {
                    PlayerPrefs.SetInt("SaveGame", 0);
                }
                else
                {
                    PlayerPrefs.SetInt("SaveGame", 1);
                }

                if (currentMission == -1)
                {
                    currentMission = 1;

                    Inventory.SetInventory(null);
                    tampaProtectionObject.life  = 80;
                    escudoProtectionObject.life = 120;

                    Book.pageQuantity = 0;
                    sideQuests        = 0;

                    pathBird = 0;
                    pathCat  = 0;

                    mission1AssustaGato   = false;
                    mission2ContestaMae   = false;
                    mission4QuebraSozinho = false;
                    mission10BurnCorredor = false;

                    SetMission(currentMission);
                    SaveGame(1, -1);
                }
                else
                {
                    LoadGame(currentMission);
                }

                rpgTalk.OnChoiceMade += OnChoiceMade;
            }
            else if (instance != this)
            {
                Destroy(gameObject);
            }
        }