示例#1
0
    // Update is called once per frame
    void Update()
    {
        if (!gfc.GetRunning())
        {
            isInvoking = false;
            CancelInvoke();
            return;
        }
        if (!isInvoking)
        {
            isInvoking = true;
            InvokeRepeating("SpawnThrowable", 0, throwInterval);
        }

        transform.Translate(sign * speed * Time.deltaTime * Vector3.right);
        if (transform.position.x < minStageDimensions.x || transform.position.x > maxStageDimensions.x)
        {
            transform.position = new Vector3(Mathf.Clamp(transform.position.x, minStageDimensions.x, maxStageDimensions.x), transform.position.y, 0f);
            sign *= -1;
        }
    }
示例#2
0
 // Update is called once per frame
 void Update()
 {
     scoreText.text = "Score: " + score + "/" + gfc.GetScoreThresh() + " ";
     livesText.text = " Lives: " + hp;
     if (!gfc.GetRunning())
     {
         return;
     }
     transform.Translate(Input.GetAxisRaw("Horizontal") * currSpeed * Time.deltaTime * Vector3.right);
     if (transform.position.x < minStageDimensions.x || transform.position.x > maxStageDimensions.x)
     {
         transform.position = new Vector3(Mathf.Clamp(transform.position.x, minStageDimensions.x, maxStageDimensions.x), transform.position.y, 0f);
     }
 }