// Update is called once per frame
 void Update()
 {
     if (GlobalControl.GetButtonA(1))
     {
         SceneManager.LoadScene(scene);
     }
 }
    // Update is called once per frame
    void Update()
    {
        var x = GlobalControl.GetHorizontal(BossPNum) * 0.05f * speed;

        if (transform.position.x + x > bounds.max.x)
        {
            Debug.Log("Clamping " + transform.position.x + " into " + bounds.max.x);
            x = Mathf.Clamp(x, int.MinValue, 0);
        }
        else if (transform.position.x + x < bounds.min.x)
        {
            x = Mathf.Clamp(x, 0, int.MaxValue);
        }
        transform.position += new Vector3(x, 0, 0);

        if (players.TrueForAll(isDisabled))
        {
            ChangeScene("End_Screen");
            Debug.Log("Game Over");
        }
        frameCt++;
        if (currentObstacle != null)
        {
            currentObstacle.transform.position = transform.position;
            //Debug.Log ("Updating " + Input.GetButton ("X_P1"));
            if (GlobalControl.GetButtonA(BossPNum) || Input.GetKeyDown(KeyCode.Space))
            {
                Debug.Log("Pressed");
                currentObstacle.GetComponent <Obstacle>().setActive(conveyor);
                currentObstacle = null;
                frameCt         = 0;
            }
        }
        else
        {
            if (frameCt > frameDelay)
            {
                currentObstacle = Instantiate(obPreFabs[Random.Range(0, obPreFabs.Length)]).GetComponent <Obstacle>();
                currentObstacle.GetComponent <AffectedByConveyor>().conveyor = conveyor;
                currentObstacle.transform.position = transform.position;
                frameCt = 0;
            }
        }
    }
Esempio n. 3
0
 // Update is called once per frame
 void Update()
 {
     if (GlobalControl.GetButtonA(1))
     {
     }
 }