コード例 #1
0
    // Update is called once per frame
    void Update()
    {
        if (gameOver)
        {
            return;
        }

        if (transform.position.x >= finishLine.transform.position.x)
        {
            gameOver = true;
            src_Rabbit.turtleFinished = true;
            toIdleEast();
            src_Manager.winner("Turtle");
        }

        Debug.Log("Current: " + TEST.ToString());
        if (playing && waiting && !isMoving)
        {
            if (Input.GetKeyDown(currentKey))
            {
                //move Turtle forward
                Vector3 endPosition = new Vector3(transform.position.x + 0.7f, transform.position.y, transform.position.z);
                StartCoroutine(Move(transform, endPosition));

                //generate next key
                ui_Key.SetActive(false);
                genKey();
            }
        }
    }
コード例 #2
0
 // Update is called once per frame
 void Update()
 {
     if (turtleFinished || reachFinish)
     {
         //race over
         faceEast();
     }
     else
     {
         if (transform.position.x >= finishLine.transform.position.x)
         {
             src_Turte.gameOver = true;
             reachFinish        = true;
             Debug.Log("Rabbit finished");
             src_Manager.winner("Rabbit");
         }
     }
 }