예제 #1
0
    // Update is called once per frame
    void Update()
    {
        if (playServices == null)
        {
            playServices = FindObjectOfType <PlayServicesController>();
        }
        if (camera == null)
        {
            camera = FindObjectOfType <CameraController>();
        }
        if (player == null)
        {
            player = FindObjectOfType <FighterController>();
        }
        if (enemySpawner == null)
        {
            enemySpawner = FindObjectOfType <EnemySpawner>();
        }
        if (gameManager == null)
        {
            gameManager = FindObjectOfType <GameManager>();
        }
        if (soundManager == null)
        {
            soundManager = FindObjectOfType <SoundManager>();
        }

        if (codeText == null)
        {
            codeText = FindObjectOfType <CodeTextController>();
        }
    }
예제 #2
0
    void Awake()
    {
        //Check if instance already exists
        if (Instance == null)
        {
            //if not, set instance to this
            Instance = this;
        }
        //If instance already exists and it's not this:
        else if (Instance != this)
        {
            //Then destroy this. This enforces our singleton pattern, meaning there can only ever be one instance of a GameManager.
            Destroy(gameObject);
        }

        //Sets this to not be destroyed when reloading scene
        DontDestroyOnLoad(gameObject);
    }
    private void SaveBestScoreAndEditLevelCompletedPanel(string selectedGameMode)
    {
        levelCompletedScoreText.text = currentScore.ToString();
        int bestScore;

        if (selectedGameMode == "Zamana Karşı")
        {
            bestScore = int.Parse(EncryptionController.Decrypt(PlayerPrefs.GetString("bestScoreOfAgainstTime")));
        }
        else
        {
            bestScore = int.Parse(EncryptionController.Decrypt(PlayerPrefs.GetString("bestScoreOfNormal")));
        }
        if (currentScore > bestScore)
        {
            recordOldAreaForLevelCompletedArea.SetActive(false);
            recordNewAreaForLevelCompletedArea.SetActive(true);
            if (selectedGameMode == "Zamana Karşı")
            {
                PlayerPrefs.SetString("bestScoreOfAgainstTime", EncryptionController.Encrypt(currentScore.ToString()));
                if (EncryptionController.Decrypt(PlayerPrefs.GetString("removeAdsPurchased")) == "No")
                {
                    StartCoroutine(AdsAdMobController.InstanceAdsAdMobController.LoadInterstitialAd());
                } // Show InterstitialAd
                PlayServicesController.AddScoreToLeaderboard(GPGSIds.leaderboard_lider_tablosu__zamana_kar, currentScore);
            }
            else
            {
                PlayerPrefs.SetString("bestScoreOfNormal", EncryptionController.Encrypt(currentScore.ToString()));
                if (EncryptionController.Decrypt(PlayerPrefs.GetString("removeAdsPurchased")) == "No")
                {
                    StartCoroutine(AdsAdMobController.InstanceAdsAdMobController.LoadInterstitialAd());
                } // Show InterstitialAd
                PlayServicesController.AddScoreToLeaderboard(GPGSIds.leaderboard_lider_tablosu__normal_mod, currentScore);
            }
        }
        else
        {
            recordOldAreaForLevelCompletedArea.SetActive(true);
            recordNewAreaForLevelCompletedArea.SetActive(false);
            recordOldAreaForLevelCompletedArea.GetComponent <Text>().text = "Rekorunuz : " + bestScore.ToString();
        }
    }
 void Start()
 {
     if (instance == null)
     {
         instance = this;
         DontDestroyOnLoad(gameObject);
     }
     if (instance != this)
     {
         Destroy(gameObject);
     }
     if (!signined)
     {
         PlayGamesClientConfiguration config = new PlayGamesClientConfiguration.Builder().Build();
         PlayGamesPlatform.InitializeInstance(config);
         PlayGamesPlatform.Activate();
         SignIn();
         signined = true;
     }
 }