Exemple #1
0
 private void Update()
 {
     if (!canStart && !gameOver)
     {
         if (Input.GetKeyDown(KeyCode.Space))
         {
             //玉が動けるようにy座標自由にする
             player.GetComponent <Rigidbody2D>().constraints = RigidbodyConstraints2D.None;
             canStart = true;
         }
     }
     if (startMessage != null)
     {
         updateMessage();
     }
     if (!enduranceMode)
     {
         return;
     }
     else
     {
         //なければ作る
         if (endurance == null)
         {
             endurance = new EnduranceGameMode(player, hazardPrefabs.Length);
         }
         endurance.GameUpdate();
     }
 }
Exemple #2
0
 private void Start()
 {
     //文書
     scoreTxt.text = "Score: " + score.ToString();
     lifeTxt.text  = "Lives: " + lives.ToString();
     //プレーヤーreference
     player = GameObject.Find("Player").transform;
     if (player == null)
     {
         return;
     }
     startPosition = player.position;
     player.GetComponent <Rigidbody2D>().constraints = RigidbodyConstraints2D.FreezePositionY;
     //ゲームモード無限
     if (!enduranceMode)
     {
         return;
     }
     endurance = new EnduranceGameMode(player, hazardPrefabs.Length);
 }