Exemplo n.º 1
0
 void Awake()
 {
     if (instance == null)
     {
         instance = this;
     }
 }
Exemplo n.º 2
0
 public void TriggerClick()
 {
     InGamePanel.m_Score = 0;
     InGamePanel.m_Money = 0;
     FlyManager.s_Level  = 1;
     InGamePanel.ReturnToMainMenu();
 }
Exemplo n.º 3
0
    public void InitializeLevel()
    {
        //TODO Test için konuldu kaldırılacak
        //currentLevel = 19;

        if (currentLevel > maxLevelNumber)
        {
            int rand = Random.Range(0, maxLevelNumber);
            if (rand == PlayerPrefs.GetInt("LastLevel"))
            {
                rand = Random.Range(0, maxLevelNumber);
            }
            PlayerPrefs.SetInt("LastLevel", rand);
            currentLevelObject = Instantiate(Resources.Load("Level" + rand), new Vector3(0, 0, 0), Quaternion.identity) as GameObject;
        }
        else
        {
            Debug.Log("Level : " + currentLevel);
            currentLevelObject = Instantiate(Resources.Load("Level" + currentLevel), new Vector3(0, 0, 0), Quaternion.identity) as GameObject;
        }
        InGamePanel.SetActive(true);
        bestScore    = PlayerPrefs.GetInt("HighestScore");
        currentColor = currentLevel;
        ChangeColor(currentColor);
        currentTargetScore   = currentLevelObject.GetComponent <LevelObject>().targetScore;
        LevelSlider.maxValue = currentTargetScore;
        LevelText.text       = (currentLevel + 1).ToString();
        NextLevelText.text   = (currentLevel + 2).ToString();
    }
Exemplo n.º 4
0
    public override void OnStartLocalPlayer()
    {
        for (var i = 0; i < Characters.Length; i++)
        {
            _id = NetworkManager.singleton.numPlayers;
            Characters[i].OwnerId = _id;
            Characters[i].Owner   = this;
            Characters[i].Colorize(Color.blue);
        }

        _kind = NetworkManager.singleton.numPlayers == 1 ? PlayerKind.Defender : PlayerKind.Infiltrator;

        if (_kind == PlayerKind.Infiltrator)
        {
            var newCameraPosition = Camera.main.transform.position;
            newCameraPosition.z = -newCameraPosition.z;

            var newCameraRotation = Quaternion.Euler(61f, 180f, 0f);

            Camera.main.transform.position = newCameraPosition;
            Camera.main.transform.rotation = newCameraRotation;
        }

        _inGamePanel = FindObjectOfType <InGamePanel>();
        _inGamePanel.PlayerKind.text = _kind.ToString();
    }
Exemplo n.º 5
0
    void Update()
    {
        Scoremater.GetComponent <Text>().text = "Score : " + Score.ToString();

        if (Score >= 15)
        {
            medal(1);
        }

        if (Score >= 30)
        {
            medal(2);
        }

        if (Score >= 50)
        {
            medal(3);
        }

        if (GameOver)
        {
            if (PlayerPrefs.GetInt("HS") < Score)
            {
                PlayerPrefs.SetInt("HS", Score);
            }

            int hs = PlayerPrefs.GetInt("HS");
            HighScore.text  = "High Score\n" + hs.ToString();
            ScoreFinal.text = "Score\n" + Score.ToString();
            InGamePanel.SetActive(false);
            GameOverPanel.SetActive(true);
        }
    }
Exemplo n.º 6
0
    private void Awake()
    {
        if (_instance != null && _instance != this)
        {
            Destroy(this.gameObject);
        }
        else
        {
            _instance = this;
        }
        if (PlayerPrefs.HasKey("LevelId"))
        {
            currentLevel = PlayerPrefs.GetInt("LevelId");
        }
        else
        {
            PlayerPrefs.SetInt("LevelId", currentLevel);
        }
        if (PlayerPrefs.HasKey("HighestScore"))
        {
            bestScore = PlayerPrefs.GetInt("HighestScore");
        }
        else
        {
            PlayerPrefs.SetInt("HighestScore", bestScore);
        }
        if (PlayerPrefs.GetInt("UseMenu").Equals(1) || !PlayerPrefs.HasKey("UseMenu"))
        {
            StartPanel.SetActive(true);
            PlayerPrefs.SetInt("UseMenu", 1);
        }
        else if (PlayerPrefs.GetInt("UseMenu").Equals(0))
        {
            InGamePanel.SetActive(true);
        }

        if (!PlayerPrefs.HasKey("VIBRATION"))
        {
            PlayerPrefs.SetInt("VIBRATION", 1);
            VibrationButton.GetComponent <Image>().sprite = on;
        }
        else
        {
            if (PlayerPrefs.GetInt("VIBRATION") == 1)
            {
                VibrationButton.GetComponent <Image>().sprite = on;
            }
            else
            {
                VibrationButton.GetComponent <Image>().sprite = off;
            }
        }
        if (SoundManager.Instance == null)
        {
            Instantiate(soundManager);
        }
        BestScoreText.text = currentScore.ToString();
        InitializeLevel();
    }
Exemplo n.º 7
0
    public void OpenInGameUI()
    {
        //reset in game variables
        LevelCountText.text = (GameManager.instance.LevelId + 1).ToString();
        //CoinCountText.text = GameManager.instance.Player.CollectedCoin.ToString();

        InGamePanel.SetActive(true);
    }
Exemplo n.º 8
0
    void Awake()
    {
        if (instance == null)
        {
            instance = this;
        }

        else if (instance != this)
        {
            Destroy(gameObject);
        }
    }
Exemplo n.º 9
0
 //Funcoes Estado do Jogo
 public static void MenuStart()
 {
     Time.timeScale = 1f;
     MenuStartPanel.SetActive(true);
     GameOverPanel.SetActive(false);
     InGamePanel.SetActive(false);
     C2.SetActive(true);
     C1.SetActive(true);
     InstancioadorInimigos.SetActive(false);
     CarroPossMenuStart(C1, C2);
     BestScore = SaveScript.LoadSave();
 }
Exemplo n.º 10
0
    private void OpenPanel(InGamePanel panelPrefab)
    {
        if (instantiatedPanel != null)
        {
            Destroy(instantiatedPanel.gameObject);
        }

        instantiatedPanel = Instantiate(panelPrefab, panelAnchor.position, Quaternion.identity, panelAnchor);
        instantiatedPanel.Init(this);

        Animator.SetBool(AnimatorOpenPanelBool, true);
    }
Exemplo n.º 11
0
 void FinishPanel()
 {
     Destroy(Apartment);
     InGamePanel.SetActive(false);
     finpanel.SetActive(true);
     PlayerPrefs.SetInt("Currentlevel", PlayerPrefs.GetInt("Currentlevel") + 1);
     if (PlayerPrefs.GetInt("Lastlevel") < PlayerPrefs.GetInt("Currentlevel"))
     {
         PlayerPrefs.SetInt("Lastlevel", PlayerPrefs.GetInt("Currentlevel"));
     }
     Time.timeScale = 0;
 }
Exemplo n.º 12
0
 private void OnTriggerEnter(Collider other)
 {
     if (other.transform.tag == "Weapon")
     {
         m_CurrentLife -= WeaponScript.m_CurrentWeaponDmg;
         ClickerScript.MakePointerBlink();
         m_DmgObject.SetActive(true);
         if (m_CurrentLife <= 0)
         {
             InGamePanel.updateScore(m_MaxLife);
             InGamePanel.addMoney(m_MaxLife);
             AudioSource.PlayClipAtPoint(m_DeathSound, transform.position, 0.25f);
             Destroy(gameObject);
         }
     }
 }
Exemplo n.º 13
0
 public static void PurchaseWeapon(GameObject i_Container, GameObject i_TheWeapon, int i_Price, int i_Dmg)
 {
     if (i_Container.activeInHierarchy)
     {
         if (InGamePanel.m_Money >= i_Price)
         {
             InGamePanel.m_Money -= i_Price;
             InGamePanel.displayNewMoneyValue();
             i_Container.SetActive(false);
             WeaponScript.EquipWeapon(i_TheWeapon);
             WeaponScript.m_CurrentWeaponDmg = i_Dmg;
             s_BuySound.Play();
         }
     }
     else
     {
         WeaponScript.EquipWeapon(i_TheWeapon);
         WeaponScript.m_CurrentWeaponDmg = i_Dmg;
     }
 }
Exemplo n.º 14
0
    void Awake()
    {
        if (instance != null)
        {
            Destroy(gameObject);
        }
        else
        {
            instance = this;
            DontDestroyOnLoad(gameObject);
        }

        allPanels = new List <GameObject>();
        allPanels.Add(MainMenuPanel);
        allPanels.Add(LevelSelectPanel);
        allPanels.Add(InGamePanel);

        MainMenu    = MainMenuPanel.GetComponent <MainMenu>();
        LevelSelect = LevelSelectPanel.GetComponent <LevelSelect>();
        InGame      = InGamePanel.GetComponent <InGame>();
    }
Exemplo n.º 15
0
    IEnumerator WaitAndGameWin()
    {
        Confetties.SetActive(true);
        cubeManager.PlaceFinalObject();
        SoundManager.Instance.StopAllSounds();
        SoundManager.Instance.playSound(SoundManager.GameSounds.Win);
        yield return(new WaitForSeconds(1));

        if (PlayerPrefs.GetInt("VIBRATION") == 1)
        {
            TapticManager.Impact(ImpactFeedback.Light);
        }
        currentLevel++;
        if (Particle != null)
        {
            Particle.SetActive(true);
        }
        PlayerPrefs.SetInt("LevelId", currentLevel);
        cubeManager.CloseAllCubeScripts();
        WinPanel.SetActive(true);
        InGamePanel.SetActive(false);
    }
Exemplo n.º 16
0
 public void GameLose()
 {
     if (currentBestScore > PlayerPrefs.GetInt("HighestScore"))
     {
         PlayerPrefs.SetInt("HighestScore", currentBestScore);
     }
     InGamePanel.SetActive(false);
     BestScoreText.text    = currentBestScore.ToString();
     currentBestScore      = 0;
     highestScoreText.text = "Best : " + PlayerPrefs.GetInt("HighestScore");
     SoundManager.Instance.StopAllSounds();
     SoundManager.Instance.playSound(SoundManager.GameSounds.Lose);
     //NextLevelText.GetComponentInParent<Image>().color = grayColor;
     currentScore = 0;
     Debug.Log("Game Lose");
     GameLosePanel.SetActive(true);
     isGameOver    = true;
     isGameStarted = false;
     if (PlayerPrefs.GetInt("VIBRATION") == 1)
     {
         TapticManager.Impact(ImpactFeedback.Light);
     }
 }
Exemplo n.º 17
0
 public static void StartGame()
 {
     MenuStartPanel.SetActive(false);
     InGamePanel.SetActive(true);
 }
Exemplo n.º 18
0
 public static void SGameOver()
 {
     GameOverPanel.SetActive(true);
     InGamePanel.SetActive(false);
 }
Exemplo n.º 19
0
 public void LoadInGamePanel()
 {
     CloseAllPanels();
     InGamePanel.SetActive(true);
 }
Exemplo n.º 20
0
 void Awake()
 {
     Instance = this;
     InforPanel.gameObject.SetActive(false);
 }
Exemplo n.º 21
0
 public void GameOver()
 {
     InGamePanel.SetActive(false);
     GameOverPanel.SetActive(true);
     Time.timeScale = 0;
 }