コード例 #1
0
    void OnTriggerEnter2D(Collider2D col)
    {
        if (col.gameObject.tag == "Bottom")
        {
            gameOverScript.GameOver();
        }

        if (col.gameObject.tag == "Flag")
        {
            gameManager.GetComponent <StageClearScript>().stageClear();
        }

        if (col.gameObject.tag == "CheckPoint")
        {
            Sound.LoadSe("checkPoint", "passedCheckPoint");
            Sound.PlaySe("checkPoint");

            col.gameObject.GetComponent <SpriteRenderer> ().color = Color.green;
            GameManagerScript.passedCheckPoint = true;
        }

        if (col.gameObject.tag == "Message")
        {
            messageScript.getMessage(col.gameObject.name);
        }
    }
コード例 #2
0
 public void ShowGameOverPanel()
 {
     if (gameOver != null)
     {
         gameOver.GameOver(currentScore, currentSStars, isUnstable);
     }
 }
コード例 #3
0
 void      OnTriggerEnter2D(Collider2D cl)
 {
     if (cl.gameObject.tag == "Box" && !bonuses.bonus3)
     {
         gameOv.GameOver();
     }
 }
コード例 #4
0
 void LoseToManyBoxes()
 {
     if (box2 && transform.localPosition.y > 8.5f)
     {
         go.GameOver();
         gameObject.SetActive(false);
     }
 }
コード例 #5
0
 private void DeathWait5Seconds()
 {
     if (OnEndDeath != null)
     {
         OnEndDeath();
     }
     gameOverController.GameOver();
 }
コード例 #6
0
    void OnCollisionEnter2D(Collision2D col)
    {
        if (!muteki)
        {
            if (col.gameObject.transform.parent != null && col.gameObject.transform.parent.gameObject.tag == "Enemy" && !col.gameObject.GetComponent <BatScript> ().getBubbledFlag())
            {
                animator.enabled    = false;
                playerSprite.sprite = almostStumble;
                gameOverScript.GameOver();
            }
        }
        else
        {
            if (col.gameObject.transform.parent != null && col.gameObject.transform.parent.gameObject.tag == "Enemy")
            {
                Destroy(col.gameObject);
            }
        }

        if (col.gameObject.tag == "Star")
        {
            Destroy(col.gameObject);
            Sound.PlayBgm("muteki");
            walkSpeed *= 2;
            muteki     = true;
            animator.SetBool("Invisible", true);
            Invoke("invincibleOver", 8);
        }


        if (col.gameObject.tag == "Obstacle")
        {
            directionChange();
        }

        print(rotateExtent);
        if (rotateExtent > 70 && rotateExtent < 290)
        {
            if (col.gameObject.tag == "Ground" || col.gameObject.tag == "Line")
            {
                gameOverScript.GameOver();
            }
        }
    }
コード例 #7
0
    public void ModifyValue(int modifier)
    {
        value          = Mathf.Clamp(value + modifier, 0, maxValue);
        bar.fillAmount = (float)value / maxValue;
        bar.color      = Colorx.Slerp(new Color(0.75f, 0.1f, 0.1f), new Color(0.35f, 0.67f, 0.35f), bar.fillAmount);

        if (value <= 0)
        {
            gameOver.GameOver(gameObject.tag);
        }
    }
コード例 #8
0
 public void decreaseHealth()
 {
     health -= 10;
     updateHealth(health);
     if (health <= 0)
     {
         Instantiate(PlayerExplosion, player.transform.position, player.transform.rotation);
         Destroy(player.gameObject, 0.1f);
         gameOverScript.GameOver();
     }
 }
コード例 #9
0
ファイル: MCMovement.cs プロジェクト: nasa03/RSG
 public void DamagePlayer(int dmg)
 {
     PLAYER_HITPOINTS = PLAYER_HITPOINTS - dmg;
     hpslider.value   = PLAYER_HITPOINTS;
     damagetaken++;
     if (PLAYER_HITPOINTS <= 0)
     {
         //Player Dead
         Debug.Log("Player Died");
         gameover.GameOver();
     }
 }
コード例 #10
0
    private void Update()
    {
        timer -= Time.deltaTime;
        timer  = Mathf.Clamp(timer, 0, 300);
        float min = Mathf.FloorToInt(timer / 60);
        float sec = Mathf.FloorToInt(timer % 60);

        timeText.text  = DateTime.Now.ToString();
        timerText.text = string.Format("{0:00}:{1:00}", min, sec);

        if (timer <= 0)
        {
            gameOver.SetActive(true);
            gameOverScript.GameOver(infectAi.getInfected, infectAi.getNoMask, "Time's Up");
        }

        if (infectAi.getInfected == 0 && infectAi.getNoMask == 0)
        {
            gameOver.SetActive(true);
            gameOverScript.GameOver(infectAi.getInfected, infectAi.getNoMask, "Congraulations");
        }
    }
コード例 #11
0
 public void TakeDamage(int damageAmount)
 {
     if (!isDead)
     {
         health -= Mathf.Clamp(damageAmount - defence, 1, damageAmount);
         GetComponent <SpriteRenderer>().color = Color.red;
         GetComponent <SpriteRenderer>().DOColor(Color.white, 0.2f);
         screenFlash.TakeDamage();
         soundScript.OnGettingHit();
         hud.UpdateHealth();
         if (health <= 0)
         {
             soundScript.OnDeath();
             DeathAnimation();
             GetComponent <PlayerMovement>().enabled = false;
             gameOver.GameOver();
             isDead  = true;
             enabled = false;
         }
     }
 }
コード例 #12
0
    public void TakeDamage(int damageAmount)
    {
        if (!isDead)
        {
            // Reduce our health taking our defence in mind
            // An attack will always do 1 damage
            health -= Mathf.Clamp(damageAmount - defence, 1, damageAmount);

            soundScript.OnGettingHit();
            hud.UpdateHealth();

            // If the health drops to 0 or lower the player dies
            if (health <= 0)
            {
                soundScript.OnDeath();
                GetComponent <PlayerMovement>().enabled = false;
                gameOver.GameOver();
                isDead  = true;
                enabled = false;
            }
        }
    }
コード例 #13
0
 void Die()
 {
     GameOverCall.GameOver();
     //Destroy(gameObject);
 }
コード例 #14
0
 void OnTriggerEnter2D(Collider2D col)
 {
     gameOverScript.GameOver();
 }