コード例 #1
0
 private IEnumerator SpeedTemporarily(KeyboardMover keyboardMover)
 {
     //destroyComponent.enabled = false;
     keyboardMover.setSpeed(speed);
     for (float i = duration; i > 0; i--)
     {
         Debug.Log("speed upgrade: " + i + " seconds remaining!");
         yield return(new WaitForSeconds(1));
     }
     Debug.Log("speed upgrade gone!");
     keyboardMover.setSpeed(-speed);
     //destroyComponent.enabled = true;
 }
コード例 #2
0
 private void OnTriggerEnter2D(Collider2D collision)
 {
     if (collision.tag == "Player")
     {
         KeyboardMover player = collision.transform.GetComponent <KeyboardMover>();
         player.transform.position = new Vector3(player.transform.position.x, -4.5f, player.transform.position.z);
         Debug.Log("Wall");
     }
     if (collision.tag == "Circle")
     {
         Destroy(collision.gameObject);
     }
 }
コード例 #3
0
ファイル: CircleW.cs プロジェクト: orabu103/GameDevCourse
 private void OnTriggerExit2D(Collider2D collision)
 {
     if (collision.tag == "Player")
     {
         KeyboardMover player = collision.transform.GetComponent <KeyboardMover>();
         if (player.transform.position.x > 10f)
         {
             player.transform.position = new Vector3(-10, player.transform.position.y, 0);
         }
         else if (player.transform.position.x < -10f)
         {
             player.transform.position = new Vector3(10, player.transform.position.y, 0);
         }
         else if (player.transform.position.y > 4.5f)
         {
             player.transform.position = new Vector3(player.transform.position.x, -4.5f, 0);
         }
     }
 }