예제 #1
0
    private void Update()
    {
        keepPos();
        healthBar.UpdateBar(currentHealth, maxHealth);
        shieldBar.UpdateBar(currentShield, maxShield);
        energyBar.UpdateBar(currentEnergy, maxEnergy);
        if (currentHealth <= 0)
        {
            explosion.transform.position = transform.position;
            explosion.SetActive(true);
            Destroy(player);
            PlayerPrefs.SetInt("BB8-HighScore", SumScore.HighScore);
            //SumScore.SaveHighScore();
            SumScore.Reset();
            //SceneManager.LoadScene(SceneManager.GetActiveScene().buildIndex);
            //SceneManager.LoadScene("menu");
            deathMenu.SetActive(true);
        }

        if (currentEnergy < maxEnergy)
        {
            currentEnergy += 10 * Time.deltaTime;
        }

        if (currentShield <= 0)
        {
            escudo[0].SetActive(false);
            escudo[1].SetActive(false);
        }
        else
        {
            escudo[0].SetActive(true);
            escudo[1].SetActive(true);
        }
    }
예제 #2
0
    void Update()
    {
        enemyArray = GameObject.FindGameObjectsWithTag("enemy");
        //find a target
        EnemyAStar enStar;

        foreach (GameObject enemy in enemyArray) //check everybody in array
        {
            enStar = (EnemyAStar)enemy.GetComponent(typeof(EnemyAStar));
            Vector2 enPos = enStar.fetchGridPosition();
            if (enPos == triggerZone)
            {
                foreach (Vector2 fireGrid in killZone)
                { //are they within range
                    if (fireGrid == enPos)
                    {
                        Destroy(enemy);
                        blewup = true;
                        SumScore.Add(5);
                    }
                }
            }
        }

        if (blewup == true)
        {
            //this.GetComponent<Renderer>().material.color = Color.white;
            this.GetComponent <TurnToWall> ().removeTile();
            //Destroy(this);
        }
    }
예제 #3
0
 /// <summary>Save if current score is greater than high score</summary>
 public void CheckHighScore()
 {
     if (SumScore.Score > SumScore.HighScore)
     {
         SumScore.SaveHighScore();
     }
 }
예제 #4
0
    void OnTriggerEnter2D(Collider2D col)
    {
        if (col.tag == "Boss" || col.tag == "Crit")
        {
            Target enemy = col.GetComponent <Target>();
            if (enemy != null)
            {
                cam.GetComponent <CameraShake>().shakecamera();
                enemy.TakeDamage(damage);
                SumScore.Add(5);
            }
        }

        if (col.tag == "Enemy")
        {
            TargetEnemy enemy = col.GetComponent <TargetEnemy>();
            if (enemy != null)
            {
                cam.GetComponent <CameraShake>().shakecamera();
                enemy.TakeDamage(damage);
                SumScore.Add(5);
            }
        }

        if (col.tag == "EnemyBullet")
        {
            SumScore.Add(1);
        }

        Destroy(gameObject);
    }
예제 #5
0
    void fire()
    {
        bool quota = false;

        enemyArray = GameObject.FindGameObjectsWithTag("enemy");
        EnemyAStar enStar;

        foreach (GameObject enemy in enemyArray)
        {
            enStar = (EnemyAStar)enemy.GetComponent(typeof(EnemyAStar));
            Vector2 enPos = enStar.fetchGridPosition();
            if (!quota)
            {
                foreach (Vector2 fireGrid in killZone)
                {
                    if (fireGrid == enPos)
                    {
                        quota = true;
                        //temporarily we will just reset the hasTarget bool when fire occurs, but later we need to do checks agains enemy health
                        EnemyHealth targetHP  = (EnemyHealth)enemy.GetComponent(typeof(EnemyHealth));
                        float       currentHP = targetHP.blast(10);
                        if (currentHP <= 0)
                        {
                            hasTarget = false;
                            Destroy(enemy);
                            GameObject  temp = GameObject.FindGameObjectsWithTag("GameMgr")[0];
                            GameManager gm   = (GameManager)temp.GetComponent(typeof(GameManager));
                            gm.credits += 25;
                            SumScore.Add(5);
                        }
                    }
                }
            }
        }
    }
예제 #6
0
    public void Black()
    {
        GetComponent <Renderer>().material.color = Color.black;

        SumScore.Add(1);
        SumScore.HighScore += 1;
    }
예제 #7
0
 private void SetPoints()
 {
     animator.SetTrigger(runningSanta);
     points += (level * 100);
     SumScore.Add(level * 100);
     level += 1;
 }
예제 #8
0
    // Update is called once per frame
    void Update()
    {
        if (Input.GetMouseButtonUp(0) && SceneManager.GetActiveScene().buildIndex == 0)
        {
            loading.SetActive(true);
            StartCoroutine(LoadLevel(1));
        }

        if (player.GetComponent <playerTarget>().currentHealth <= 0 && SumScore.Score >= 5)
        {
            playerBar.SetActive(false);
            bossBar.SetActive(false);
            continueAgain.SetActive(true);
            SumScore.Subtract(5);
            StartCoroutine(LoadLevel(SceneManager.GetActiveScene().buildIndex));
        }
        else if (player.GetComponent <playerTarget>().currentHealth <= 0 && SumScore.Score < 5)
        {
            playerBar.SetActive(false);
            bossBar.SetActive(false);
            gameOver.SetActive(true);
            SumScore.Reset();
            StartCoroutine(LoadLevel(0));
        }

        if (stageTrigger == null)
        {
            playerBar.SetActive(false);
            bossBar.SetActive(false);
            stageClear.SetActive(true);
            //StartCoroutine(LoadLevel(1));
            LoadNextLevel();
        }
    }
예제 #9
0
    // Start is called before the first frame update
    private void OnTriggerEnter(Collider other)
    {
        Destroy(this.gameObject);

        SumScore.Add(10);

        SumScore.SaveHighScore();
    }
예제 #10
0
    public void GameOver()
    {
        SumScore.SaveHighScore();
        SceneManagerScript.Points   = points;
        SceneManagerScript.GameOver = true;

        LeanTween.alpha(fadeSprite, 0.5f, 0.2f).setOnComplete(() => SceneManager.LoadScene("Menu Scene", LoadSceneMode.Single));
    }
 public void RandomSceneSelectionForStartScreen()
 {
     SumScore.Reset();
     SoundManager.PlayUISound(fx_click, 100);
     noSceneRepeat();
     Sc_TimerBar.time = 10;
     SceneManager.LoadScene(randomSceneRange);
 }
예제 #12
0
 // Update is called once per frame
 private void Update()
 {
     if (playerTransf.position.x > (spawnerEmX - qtdeTilesNaTela * tileInicialLen))
     {
         GeradorTiles();
         LimpadorDeTiles();
     }
     SumScore.Add(Mathf.RoundToInt(Time.deltaTime * 10));
 }
예제 #13
0
 public void TakeDamage(float amount)
 {
     health -= amount;
     if (health <= 0f)
     {
         SumScore.Add(pointsToAdd: 1);
         Die();
     }
 }
예제 #14
0
 void Update()
 {
     if (timed)
     {
         // Use Time.deltaTime to create a steady addition of points.
         // This example would add 100 points per second
         SumScore.Add(Mathf.RoundToInt(Time.deltaTime * 100));
     }
 }
예제 #15
0
파일: C.cs 프로젝트: yazici/iFSM
    static void XXX_ResetBattleRegister(bool reset)
    {
        if (reset)
        {
            SumScore.ClearHighScore();
        }

        Debug.LogError("AS BATALHAS FORAM RESETADAS (Na interface o total de batalhas está mostrando o total pela ultima vez fotografe ou printe esse total!  O VALOR SERÁ RESETADO COMPLETAMENTE NA PRÓXIMA INICIALIZAÇÃO)");
    }
예제 #16
0
    // Start is called before the first frame update
    public void Start()
    {
        InitGame();
        HideGame();
        StartGame();
        SumScore.Reset();

        wrongCnt = 0;
    }
예제 #17
0
    public void TakeDamage(int amount)
    {
        health -= amount;
        SumScore.Add(amount);

        if (health <= 0)
        {
            Die();
        }
    }
예제 #18
0
    private void ClearMatch(Vector2[] paths)                       // 1
    {
        List <GameObject> matchingTiles = new List <GameObject>(); // 2

        for (int i = 0; i < paths.Length; i++)                     // 3
        {
            matchingTiles.AddRange(FindMatch(paths[i]));
        }
        if (matchingTiles.Count >= 3)                     // 4
        {
            for (int i = 0; i < matchingTiles.Count; i++) // 5
            {
                matchingTiles[i].GetComponent <SpriteRenderer>().sprite = null;
                if (matchingTiles.Count == 3)
                {
                    SumScore.Add(matchingTiles.Count);
                    SFXManager.instance.PlaySFX(Clip.Clear4);
                    Instantiate(whiteParticles, transform.position, Quaternion.identity);
                }
                if (matchingTiles.Count == 4)
                {
                    SumScore.Add(matchingTiles.Count);
                    SFXManager.instance.PlaySFX(Clip.Clear5);
                    Instantiate(whiteParticles, transform.position, Quaternion.identity);
                }
                if (matchingTiles.Count == 5)
                {
                    SumScore.Add(matchingTiles.Count);
                    BoardManager.instance.GetComponent <AudioSource>().volume = 0;
                    SFXManager.instance.PlaySFX(Clip.Clear6);

                    StartCoroutine(ShadowWaveNas());
                    Instantiate(whiteParticles, transform.position, Quaternion.identity);
                    StartCoroutine(HasNasSampleStoppedPlaying());
                }
                if (matchingTiles.Count >= 6)
                {
                    SumScore.Add(matchingTiles.Count);
                    BoardManager.instance.GetComponent <AudioSource>().volume = 0;

                    int index = Random.Range(0, samples.Length);
                    sampleClip       = samples[index];
                    audioSource.clip = sampleClip;
                    audioSource.Play();

                    StartCoroutine(TriggerWave(matchingTiles.Count));
                    StartCoroutine(ShadowWave());
                    StartCoroutine(FlipWaveY());
                    StartCoroutine(HasSoulSampleStoppedPlaying());
                }
            }
            matchFound = true;             // 6
        }
    }
예제 #19
0
    void Update()
    {
        if (timed)
        {
            // Use Time.deltaTime to create a steady addition of points.
            // This example would add 100 points per second
            SumScore.Add(Mathf.RoundToInt(Time.deltaTime * 1));
        }


        //if (Input.GetKeyDown(KeyCode.P))
        //    AddPoints(1);
    }
예제 #20
0
파일: PlayerShip.cs 프로젝트: pecavi/TFG
 // Update is called once per frame
 void Update()
 {
     healthBar.UpdateBar(currentHealth, maxHealth);
     shieldBar.UpdateBar(currentShield, maxShield);
     if (currentHealth <= 0)
     {
         SumScore.SaveHighScore();
         SumScore.Reset();
         //SceneManager.LoadScene(SceneManager.GetActiveScene().buildIndex);
         //Exit();
         deathMenu.SetActive(true);
         Time.timeScale = 0;
     }
 }
예제 #21
0
 private void GameOver()
 {
     if (currentGridPosition.x == endGridPosition.x)
     {
         SumScore.SaveHighScore();
         Time.timeScale = 0;
         if (!over)
         {
             GameObject nb = (GameObject)GameObject.Instantiate(GameOverScreen);
             nb.SetActive(true);
             over = !over;
         }
     }
 }
예제 #22
0
파일: EnemyShip.cs 프로젝트: pecavi/TFG
 void OnTriggerEnter(Collider other)
 {
     if (other.name == "disparo(Clone)")
     {
         currentHealth -= 100;
         //Debug.Log("Vida enemigo" + currentHealth);
         if (currentHealth <= 0)
         {
             explosion.Play();
             tie.SetActive(false);
             ShipsManager.contShips--;
             SumScore.Add(100);
             Invoke("Death", 1);
         }
     }
 }
예제 #23
0
    void OnTriggerEnter2D(Collider2D other)
    {
        if (other.tag == "gundam" || other.tag == "Boss")
        {
            currentHealth = 0;
            healthBar.SetHealth(currentHealth);
        }

        if (other.tag == "health")
        {
            currentHealth += pickHealthValue;
            healthBar.SetHealth(currentHealth);
        }

        if (other.tag == "star")
        {
            SumScore.Add(1);
        }

        if (other.tag == "pickup" && girlCalled == false && robotCalled == false && alienCalled == false)
        {
            girl.GetComponent <SmoothFollow>().enabled   = true;
            girl.GetComponent <NPC>().enabled            = true;
            girl.GetComponent <SmoothFallback>().enabled = false;
            girlCalled = true;
        }

        if (other.tag == "pickup2" && girlCalled == true && robotCalled == false && alienCalled == false)
        {
            robot.GetComponent <SmoothFollow>().enabled   = true;
            robot.GetComponent <NPC>().enabled            = true;
            robot.GetComponent <SmoothFallback>().enabled = false;
            robotCalled = true;
            girlCalled  = true;
        }

        if (other.tag == "pickup3" && girlCalled == true && robotCalled == true && alienCalled == false)
        {
            alien.GetComponent <SmoothFollow>().enabled   = true;
            alien.GetComponent <NPC>().enabled            = true;
            alien.GetComponent <SmoothFallback>().enabled = false;
            alienCalled = true;
            robotCalled = true;
            girlCalled  = true;
        }
    }
    void Start()
    {
        sR = GetComponent <SpriteRenderer> ();

        //If got out
        if (tempRemLife != remLife)
        {
            SoundManager.PlaySound(fx_OhNo);
            policeMen_Animator.SetBool("Out", true);
            Invoke("OutMethod", 1f);
            tempRemLife = remLife;


            if (remLife == 3)
            {
                sR.sprite = sprite_remLife [0];
            }
            if (remLife == 2)
            {
                sR.sprite = sprite_remLife [0];
            }
            if (remLife == 1)
            {
                sR.sprite = sprite_remLife [1];
            }
        }
        else
        {
            SumScore.Add(1);
            SumScore.SaveHighScore();
            SoundManager.PlaySound(fx_Yeayi);
            OutMethod();
        }



        //policeman Gameover animation and randomScene Start
        if (remLife > 0)
        {
            Invoke("RandomScene", 1.3f);
        }
        else
        {
            policeMen_Animator.SetBool("GameOver", true);
        }
    }
    // Use this for initialization
    void Start()
    {
        LeanTween.alpha(fadeSprite, 0, 0.2f);
        playAgainText.GetComponent <Renderer>().sortingLayerName = "TopMenuTextContent";
        SumScore.Add(SceneManagerScript.Points);

        tapGesture = new TapGestureRecognizer();
        tapGesture.AllowSimultaneousExecutionWithAllGestures();
        tapGesture.StateUpdated += TapGesture_StateUpdated;
        FingersScript.Instance.AddGesture(tapGesture);
        if (SceneManagerScript.GameOver)
        {
            GameOver();
        }
        else
        {
            StartingView();
        }
    }
예제 #26
0
 public IEnumerator TriggerWave(int clearedCount)
 {
     for (int x = 0; x < BoardManager.instance.xSize; x++)
     {
         for (int y = 0; y < BoardManager.instance.ySize; y++)
         {
             if (BoardManager.instance.tiles[x, y].GetComponent <SpriteRenderer>().sprite == render.sprite)
             {
                 BoardManager.instance.tiles[x, y].GetComponent <SpriteRenderer>().sprite = null;
                 Instantiate(whiteParticles, BoardManager.instance.tiles[x, y].transform.position, Quaternion.identity);
                 StartCoroutine(BoardManager.instance.FindNullTiles());
                 SFXManager.instance.PlaySFX(Clip.Scratch);
                 SumScore.Add(clearedCount);
                 yield return(StartCoroutine(HalfSecondDelay()));
             }
         }
     }
     StopCoroutine(BoardManager.instance.FindNullTiles());
     StartCoroutine(BoardManager.instance.FindNullTiles());
 }
예제 #27
0
    // Update is called once per frame
    void Update()
    {
        if (Time.time < startAnimacao)
        {
            controller.Move(Vector3.right * 0 * Time.deltaTime);
            return;
        }

        vetorMovimento = Vector3.zero;

        bool chao = controller.isGrounded;

        Debug.Log(chao);
        if (controller.isGrounded)
        {
            onTheGround = true;
            if (Input.GetButton("Jump") && onTheGround)
            {
                onTheGround        = false;
                velocidadeVertical = velocidadePulo;
                transform.Translate(Vector3.up * velocidadePulo * Time.deltaTime);
            }
            //velocidadeVertical = 0.0f;
        }
        else
        {
            onTheGround         = false;
            velocidadeVertical -= gravidade * Time.deltaTime;
        }


        //Mover direita ou esquerda
        vetorMovimento.z = Input.GetAxisRaw("Horizontal") * (-velocidadeDirecionada);
        vetorMovimento.y = velocidadeVertical;
        vetorMovimento.x = velocidade;
        controller.Move(vetorMovimento * velocidade * Time.deltaTime);

        SumScore.Add(Mathf.RoundToInt(Time.deltaTime * 10 * velocidade));

        checaPontuacao(SumScore.Score);
    }
예제 #28
0
    void Start()
    {
        SumScore.Reset(); // Ensure score is 0 when object loads
        if (initialScore != 0)
        {
            SumScore.Add(initialScore);  // Set initial score
        }
        if (storeHighScore)
        {
            if (PlayerPrefs.HasKey("sumHS"))
            {
                // Set high score value and tell manager
                SumScore.HighScore = PlayerPrefs.GetInt("sumHS");
                UpdatedHS();
            }
            else
            {
                SumScore.HighScore = 0;
            }
        }

        Updated(); // Set initial score in UI
    }
예제 #29
0
 void OnCollisionEnter(Collision collision)
 {
     // other object is close
     if (collision.collider.tag == "apple")
     {
         audioSource.Play();
         SumScore.Add(10);
         Destroy(apple);
         SpawnApple();
     }
     if (collision.collider.tag == "strawberry")
     {
         audioSource.Play();
         SumScore.Add(10);
         Destroy(strawberry);
     }
     if (collision.collider.tag == "kiwi")
     {
         audioSource.Play();
         SumScore.Add(10);
         Destroy(kiwi);
     }
 }
예제 #30
0
 /// <summary>Resets high score to zero</summary>
 /// <remarks>Can call from button in inspector</remarks>
 public void ClearHighScore()
 {
     SumScore.ClearHighScore();
 }