예제 #1
0
 void OnTriggerEnter(Collider collider)
 {
     if (collider.gameObject.tag == "Missile")
     {
         Quaternion lookAt = Quaternion.LookRotation(collider.transform.position - transform.position);
         EffectManager.Instance.PlayEffect("explosion", collider.transform.position, lookAt);
         hp--;
         hp_Slider.fillAmount = Mathf.Lerp(0, 1, ((float)hp / maxHp));
         if (hp <= 0)
         {
             if (scoreCount < 1)
             {
                 GameController.Instance.enemyList.Clear();
                 ScoreInfo.HitMars();
                 scoreCount++;
                 SoundManeger.Instance.isPlayPlayerOrMarsDeathSe = true;
                 K_Score.Instance.hitMars = true;
                 K_Score.Instance.marsDefeatCount++;
             }
             GameController.Instance.gameStates = GameController.GameStates.End;
             gameEndText.color             = new Color(1, 1, 0);
             gameEndText.text              = "GameClear";
             GameController.Instance.IsWin = true;
             GameController.Instance.marsBakuhatu.transform.position = transform.position;
             GameController.Instance.marsBakuhatu.SetActive(true);
             this.gameObject.SetActive(false);
         }
     }
 }
예제 #2
0
    // Update is called once per frame
    void Update()
    {
        if (Input.GetKeyDown(KeyCode.A))
        {
            ScoreInfo.HitUfo();
        }
        else if (Input.GetKeyDown(KeyCode.S))
        {
            ScoreInfo.HitMeteorSmall();
        }
        else if (Input.GetKeyDown(KeyCode.D))
        {
            ScoreInfo.HitMeteorNormal();
        }
        else if (Input.GetKeyDown(KeyCode.F))
        {
            ScoreInfo.HitMeteorBig();
        }
        else if (Input.GetKeyDown(KeyCode.G))
        {
            ScoreInfo.HitMars();
        }
        else if (Input.GetKeyDown(KeyCode.Q))
        {
            //セーブ
            //Debug.ClearDeveloperConsole();

            //ハイスコアを確認して、今の点数が今までのハイスコア5つと比べて何番目かを確認している
            ScoreInfo.AddToHighScores();
            //Debug.Log(ScoreInfo.GetTotalScore());
            nameCount++;

            //スコアを新しく作る
            ScoreInfo.Score = new Score();

            //気にしない
            ScoreInfo.Score.Name = "Name " + nameCount;
        }
        //else if (Input.GetKeyDown(KeyCode.W))
        //{

        //    ScoreInfo.SortScoreDescending();
        //}
    }