Ejemplo n.º 1
0
 // Update is called once per frame
 void Update()
 {
     if (Input.GetAxis("Mouse Y") != 0)
     {
         if (LetterTimeStamp < Time.time)
         {
             ChangeLetter();
         }
     }
     if (Input.GetKeyDown(KeyCode.C) || Input.GetKeyDown(KeyCode.V))
     {
         if (LetterIndex < 2)
         {
             LetterIndex++;
             currentLetter = 65;
             CurrentLetter.transform.position = new Vector3(CurrentLetter.transform.position.x + 2.5f, CurrentLetter.transform.position.y);
         }
         else
         {
             ScoreManaging.SetName(Letters[0].text + Letters[1].text + Letters[2].text);
             ScoreManaging.SaveScore();
             medals.gameObject.SetActive(true);
             gameObject.SetActive(false);
         }
     }
 }
Ejemplo n.º 2
0
    // Start is called before the first frame update
    void Start()
    {
        isFall           = false;
        scoreManager     = FindObjectOfType <ScoreManaging>();
        cameraControl    = FindObjectOfType <CameraControl>();
        characterControl = FindObjectOfType <CharacterControl>();
        basamakLocations = new Vector2[20];
        basamaklar       = new GameObject[20];
        collectibles     = new GameObject[20];


        //rigidbody = GetComponent<Rigidbody2D>();
        spawnPosition = new Vector2(0f, -4.16f);

        basamakLocations[0] = spawnPosition;

        firstStep     = true;
        basamaklar[0] = Instantiate(basamak, spawnPosition, Quaternion.identity);


        for (int i = 1; i < 20; i++)
        {
            spawnPosition.y += 3.5f;
            spawnPosition.x  = Random.Range(-1.5f, 1.5f);
            //spawnPosition.x = Random.Range(-1f, 1f);

            basamakLocations[i] = spawnPosition;

            basamaklar[i] = Instantiate(basamak, spawnPosition, Quaternion.identity);
        }
    }
Ejemplo n.º 3
0
 // Update is called once per frame
 void Update()
 {
     if (Input.GetKey(KeyCode.C))                                                                                                    //om någon knapp är tryckt
     {
         ScoreManaging.ResetScore();
         SceneManager.LoadScene("Main Game");                                                                                //starta spelet
     }
 }
Ejemplo n.º 4
0
 // Start is called before the first frame update
 void Start()
 {
     scoreManager      = FindObjectOfType <ScoreManaging>();
     objectGenerator   = FindObjectOfType <ObjectGenerator>();
     movingBlockObject = GameObject.Find("movingBlocks");
     if (movingBlockObject != null)
     {
         movingBlockEffect = movingBlockObject.GetComponent <AudioSource>();
     }
 }
Ejemplo n.º 5
0
 // Start is called before the first frame update
 void Start()
 {
     scoreManager     = FindObjectOfType <ScoreManaging>();
     characterControl = FindObjectOfType <CharacterControl>();
     objectGenerator  = FindObjectOfType <ObjectGenerator>();
     shieldObject     = GameObject.Find("shield");
     if (shieldObject != null)
     {
         shieldEffect = shieldObject.GetComponent <AudioSource>();
     }
 }
Ejemplo n.º 6
0
 // Start is called before the first frame update
 void Start()
 {
     scoreManager            = FindObjectOfType <ScoreManaging>();
     objectGenerator         = FindObjectOfType <ObjectGenerator>();
     objectGenerator.jetLock = false;
     jetBlockObject          = GameObject.Find("jetBlocks");
     if (jetBlockObject != null)
     {
         jetBlockEffect = jetBlockObject.GetComponent <AudioSource>();
     }
 }
Ejemplo n.º 7
0
 // Start is called before the first frame update
 void Start()
 {
     scoreManager     = FindObjectOfType <ScoreManaging>();
     objectGenerator  = FindObjectOfType <ObjectGenerator>();
     objectCoin       = FindObjectOfType <Object_Coin>();
     doubleCoinObject = GameObject.Find("doubleCoin");
     if (doubleCoinObject != null)
     {
         doubleCoinEffect = doubleCoinObject.GetComponent <AudioSource>();
     }
 }
Ejemplo n.º 8
0
 // Start is called before the first frame update
 void Start()
 {
     rb           = GetComponent <Rigidbody2D>();
     scoreManager = FindObjectOfType <ScoreManaging>();
     flyToMia     = false;
     isPowered    = false;
     obj          = GameObject.Find("AudioObject");
     if (obj != null)
     {
         aScorce = obj.GetComponent <AudioSource>();
     }
 }
Ejemplo n.º 9
0
    void Update()
    {
        if (SecondScore < Time.time && AssistantBehaviour.Tutorial == false)
        {
            ScoreManaging.AddScore(1);
            SecondScore = Time.time + 1;
        }
        if (ProgressBar.fillAmount < 0.60f)
        {
            Bar.color = Stage01;
        }
        if (ProgressBar.fillAmount > 0.60f && ProgressBar.fillAmount < 0.75f)
        {
            Bar.color = Stage02;
        }
        if (ProgressBar.fillAmount > 0.75f)
        {
            Bar.color = Stage03;
        }

        if (DEVSWITCH == false)
        {
            ProgressBar.fillAmount = ProgressPool;
            if (ProgressPool >= 1)
            {
                DestoryDisasters();
                ShakeBehaviour.StopShake();
                PlayerWin      = false;
                GameEnd        = true;
                Time.timeScale = 0;
                StartCoroutine(switchScene());
            }
            if (ProgressPool < 0)
            {
                DestoryDisasters();
                ShakeBehaviour.StopShake();
                if (added == false)
                {
                    ScoreManaging.AddScore(5000);
                    added = true;
                }
                PlayerWin      = true;
                GameEnd        = true;
                Time.timeScale = 0;
                StartCoroutine(switchScene());
            }
        }
    }
Ejemplo n.º 10
0
    void Awake()
    {
        LeaderBoards = ScoreManaging.GetHighScores();
        string tmpString;

        for (int i = 0; i < LeaderBoards.Length; i++)
        {
            tmpString      = LeaderBoards[i].Replace('&', ' ');
            tmpString      = tmpString.Insert(tmpString.IndexOf(' '), "  ");
            scores[i].text = tmpString;
        }
        if (SceneManager.GetActiveScene().name == "HighScore")
        {
            Invoke("SwitchScene", 8);
        }
    }
Ejemplo n.º 11
0
 private void Awake()
 {
     Time.timeScale   = 1;
     Cursor.lockState = CursorLockMode.Locked;
     Cursor.visible   = false;
     LetterIndex      = 0;
     for (int i = 0; i < Letters.Length; i++)
     {
         Letters[i].text = ((char)currentLetter).ToString();
     }
     MusicPlayer.Instance.Stop();
     if (ScoreManaging.GetScore() < ScoreManaging.GetLowestHighscore())
     {
         medals.gameObject.SetActive(true);
         gameObject.SetActive(false);
     }
 }
Ejemplo n.º 12
0
 private void SwitchState()
 {
     if (Alive.gameObject.activeSelf == true)
     {
         Alive.gameObject.SetActive(false);
         Dead.gameObject.SetActive(true);
         var clone = Instantiate(FloatingScore, Camera.main.WorldToScreenPoint(transform.position), Quaternion.identity, GameObject.Find("GameUI").transform);
         clone.GetComponent <floatingScore>().setParent(transform);
         clone.GetComponent <Text>().text  = "-" + RemoveFromScore.ToString();
         clone.GetComponent <Text>().color = Color.red;
         ScoreManaging.RemoveScore(RemoveFromScore);
     }
     else
     {
         Alive.gameObject.SetActive(true);
         Dead.gameObject.SetActive(false);
     }
 }
Ejemplo n.º 13
0
 void Awake()
 {
     if (Instance != this)
     {
         if (Instance == null)
         {
             instance = this;
         }
         else
         {
             Destroy(gameObject);
             return;
         }
     }
     instance     = this;
     CurrentScore = 0;
     Highscore    = new List <Score>();
     DontDestroyOnLoad(gameObject);
     path = Application.persistentDataPath + "Assets";
     ReadFile();
 }
Ejemplo n.º 14
0
 // Update is called once per frame
 void Update()
 {
     score          = ScoreManaging.GetScore();
     scoreText.text = score.ToString();
 }
Ejemplo n.º 15
0
 // Start is called before the first frame update
 void Start()
 {
     score          = ScoreManaging.GetScore();
     scoreText.text = score.ToString();
 }
Ejemplo n.º 16
0
 private void AliveUpdate()
 {
     if (CurrentHealth <= 0)                                                                                                          //om stadens health är mindre eller likamed 0 byt till död
     {
         if (AssistantBehaviour.Tutorial == false)
         {
             if (CurrentLevel == 1)
             {
                 if (EndGame.CommenceTheEndGaame == false)
                 {
                     if (CitiesAlive.CitiesAlive > 8)
                     {
                         AddToScore         = 75;
                         Pool.ProgressPool -= 0.033f;
                     }
                     else
                     {
                         AddToScore         = 50;
                         Pool.ProgressPool -= 0.037f;
                     }
                 }
                 else
                 {
                     Pool.ProgressPool -= 0.1f;
                 }
             }
             else if (CurrentLevel == 2)
             {
                 if (EndGame.CommenceTheEndGaame == false)
                 {
                     if (CitiesAlive.CitiesAlive > 8)
                     {
                         AddToScore         = 150;
                         Pool.ProgressPool -= 0.045f;
                     }
                     else
                     {
                         AddToScore         = 100;
                         Pool.ProgressPool -= 0.065f;
                     }
                 }
                 else
                 {
                     Pool.ProgressPool -= 0.125f;
                 }
             }
             else if (CurrentLevel == 3)
             {
                 if (EndGame.CommenceTheEndGaame == false)
                 {
                     if (CitiesAlive.CitiesAlive > 8)
                     {
                         AddToScore         = 300;
                         Pool.ProgressPool -= 0.1f;
                     }
                     else
                     {
                         AddToScore         = 200;
                         Pool.ProgressPool -= 0.114f;
                     }
                 }
                 else
                 {
                     Pool.ProgressPool -= 0.15f;
                 }
             }
         }
         ScoreManaging.AddScore(AddToScore);
         citySoundPlayer.clip = citySoundClips[1];
         citySoundPlayer.Play();
         SwitchState();
         CitiesAlive.CitiesAlive--;
         return;
     }
     UpgradeCity();                                                                                                                  //callar funktionen upgradecity
 }