Exemple #1
0
    public void takeHit()
    {
        bar.localScale = new Vector3(bar.localScale.x - 0.025f, 1f);

        if (bar.localScale.x <= 0)
        {
            gameOverScreen.Setup();
        }
    }
Exemple #2
0
 void GameOver()
 {
     Debug.Log("Game Over!!!");
     isGameOver = true;
     GameObject[] allPlayers = GameObject.FindGameObjectsWithTag("NormalAgent");
     foreach (GameObject i in allPlayers)
     {
         i.SetActive(false);
     }
     gameOverScreen.Setup(playerScore > highestScore);
 }
Exemple #3
0
    public void GameOver(int endScore)
    {
        Cursor.lockState       = CursorLockMode.None;
        gun.gunEnabled         = false;
        mouseLook.mouseEnabled = false;
        player.playerEnabled   = false;
        init = true;

        //Show game over screen
        gameOverScreen.Setup(endScore);
    }
Exemple #4
0
 void PlayerDeathCheck()
 {
     if (health <= 0)
     {
         isDead  = true;
         health += 50;
         healthBar.SetMaxHealth(maxHealth);
         lives -= 1;
     }
     if (lives <= 0)
     {
         gameOverScreen.Setup(Status.getScore());
     }
     else if (isDead)
     {
         isDead             = false;
         transform.position = spawnPoint.position;
     }
 }
Exemple #5
0
 // Start is called before the first frame update
 public void GameOver()
 {
     gameOverScreen.Setup();
 }
Exemple #6
0
 public void Victory()
 {
     victoryScreen.Setup();
 }
 public void GameOver()
 {
     GameOverScreen.Setup(maxPlatform);
 }
Exemple #8
0
 void Death()
 {
     // Animation or something here
     GameOverScreen.Setup();
 }
Exemple #9
0
 public void LoadGameOverScreen(bool activateDelay)
 {
     gameOverScreen.Setup(FindObjectOfType <PlayerScore>().GetScore(), timer, activateDelay);
 }
Exemple #10
0
 public void GameOver()
 {
     GetComponent <AudioSource>().Stop();
     GameOverScreen.Setup(score);
     Debug.Log("Game over Method");
 }
Exemple #11
0
 void gameOver()
 {
     gameOverScreen.Setup(GameObject.Find("Score").GetComponent <ScoreHandler>().GetGameOverScore());
 }
Exemple #12
0
    void Update()
    {
        isGrounded = Physics2D.OverlapBox(new Vector2(transform.position.x + 0.01f, transform.position.y - 0.5f), new Vector2(0.39f, 0.01f), 0f, ground);

        float xRaw = Input.GetAxisRaw("Horizontal");
        float yRaw = Input.GetAxisRaw("Vertical");

        dir = new Vector2(xRaw, yRaw);

        //Coyote jump
        hangCounter -= Time.deltaTime;
        if (isGrounded)
        {
            hangCounter = hangTime;
        }

        //Jump buffer
        jumpBufferCount -= Time.deltaTime;
        if (Input.GetButtonDown("Jump"))
        {
            jumpBufferCount = jumpBufferLength;
        }

        //Jump
        if (jumpBufferCount > 0 && hangCounter > 0)
        {
            hangCounter = 0;
            jumpRequest = true;
            CreateDust();
        }

        //Animation
        if (dir.x != 0)
        {
            isRunning = true;
        }
        else
        {
            isRunning = false;
        }

        UpdateAnimations();

        //Dust effect before jump
        if (!wasOnGround && isGrounded)
        {
            CreateDust();
        }

        wasOnGround = isGrounded;

        //Bleeding
        currentBlood = maxBlood - bloodAmount.time;
        bloodBar.SetBlood(currentBlood);

        //Усталость
        if (currentBlood < 30f)
        {
            moveSpeed = 4.5f;
            jumpForce = 6.4f;
        }

        if (currentBlood < 5f)
        {
            moveSpeed = 2.5f;
            jumpForce = 3.4f;
        }


        //Смерть
        if (bloodAmount.time == maxBlood || isCharacterDead == true)
        {
            CinemachineShake.Instance.ShakeCamera(5f, .1f);
            Destroy(this.gameObject);
            gameOverScreen.Setup();
        }
    }
Exemple #13
0
    public void GameOver()
    {
        float zeroLives = liveController.playerHealth;

        gameOverScreen.Setup(zeroLives);
    }
 public void GameOver()
 {
     GameOverScreen.Setup(countCollision);
 }
 public void GameOver()
 {
     gameOverScreen.Setup(this.score);
 }
 private void OnTriggerEnter2D(Collider2D collision)
 {
     if (collision.tag == "Collectables")
     {
         SoundManager.PlaySound("Gem");
         Destroy(collision.gameObject);
         gem         += 1;
         gemText.text = gem.ToString();
     }
     if (this.anim.GetCurrentAnimatorStateInfo(0).IsName("Roll") && collision.CompareTag("EnemySword"))
     {
         health -= 0f;
         //anim.SetTrigger("gethit");
     }
     if (!this.anim.GetCurrentAnimatorStateInfo(0).IsName("Roll") && collision.CompareTag("EnemySword"))
     {
         health -= 0.101f;
         anim.SetTrigger("gethit");
         SoundManager.PlaySound("Hurt");
     }
     if (this.anim.GetCurrentAnimatorStateInfo(0).IsName("Roll") && collision.CompareTag("Arrow"))
     {
         health -= 0f;
         //anim.SetTrigger("gethit");
     }
     if (!this.anim.GetCurrentAnimatorStateInfo(0).IsName("Roll") && collision.CompareTag("Arrow"))
     {
         health -= 0.101f;
         anim.SetTrigger("gethit");
         SoundManager.PlaySound("Hurt");
     }
     if (collision.CompareTag("HealthPotion"))
     {
         SoundManager.PlaySound("Gem");
         Destroy(collision.gameObject);
         health += 0.5f;
         if (health >= 0.5f)
         {
             health = 0.5f;
         }
     }
     if (collision.CompareTag("PowerUp"))
     {
         SoundManager.PlaySound("Gem");
         Destroy(collision.gameObject);
         jumpForce     = 800;
         movementSpeed = 12;
         GetComponent <SpriteRenderer>().color = Color.red;
         StartCoroutine(ResetPower());
     }
     if (collision.CompareTag("Trap"))
     {
         Die();
         GameOverScreen.Setup(gem);
         Time.timeScale = 0;
     }
     if (collision.CompareTag("CheckPoint"))
     {
         SoundManager.PlaySound("Victory");
         NextLevel.Setup2(gem);
     }
     if (this.anim.GetCurrentAnimatorStateInfo(0).IsTag("Attack") && collision.CompareTag("Minion"))
     {
         count += 1;
         if (count >= 10)
         {
             Boss.Die();
         }
     }
 }