// Update is called once per frame
    void Update()
    {
        //ゾンビの増殖
        zombies = GameObject.FindGameObjectsWithTag("zombie");
        if (zombies.Length < 4)
        {
            Instantiate(zombie,
                        new Vector3(Random.Range(-stageWidth / 2, stageWidth / 2), 0, Random.Range(-stageHeight / 2, stageHeight / 2)), Quaternion.identity);
        }

        //HPが0になった時
        if (PlayerHP <= 0)
        {
            print("YouDied");

            //プレイヤーのHPがゼロの時に表示
            panel.SetActive(true);
            messeage.SetActive(true);
            ResetMessage.SetActive(true);
            YourScore.SetActive(true);
            YourScore1.text = "Your Score:" + score;


            ////GameControllerクラスにあるクラスメソッド・FixedCameraを呼び出す。
            GyroScript.FixedCamera();

            //タイトルへ戻るメソッドの呼び出し
            Invoke("ReturnTitle", 5.0f);
        }
    }
Exemple #2
0
    void Awake()
    {
        Screen.orientation = ScreenOrientation.LandscapeLeft;

        if (Instance)
        {
            DestroyImmediate(gameObject);
        }
        else
        {
            DontDestroyOnLoad(gameObject);
            Instance = this;
        }
    }
 /// <summary>
 /// Initialization step.
 /// </summary>
 public void Start()
 {
     gyro = this.GetComponent <GyroScript>();
     line = Camera.main.transform.parent.GetComponent <LineRenderer>();
 }