Exemple #1
0
    // Update is called once per frame
    void Update()
    {
        // TODO: Call respawnable.Respawn (); if forward progress doesn't change
        // over some period of time.
        // TODO: Call vehicleController.FlipGravityDirection (); or rotate right
        // periodically.
        if (counter >= 0 && counter < 25)
        {
            vehicleController.MoveRight();
        }
        else if (counter >= 25 && counter < 50)
        {
            vehicleController.MoveLeft();
        }

        // For testing out the AI controller.
        if (counter == 40)
        {
            vehicleController.ApplyBrake();
        }
        else if (counter == 45)
        {
            vehicleController.ReleaseBrake();
        }
        else if (counter >= 50)
        {
            counter = 0;
        }

        counter++;
    }
    // Update is called once per frame
    void Update()
    {
        // TODO: Should all of these be defined in InputManger in editor?
        if (Input.GetKeyDown("c"))
        {
            cameratized.NextCamera();
        }
        if (Input.GetKeyDown("r"))
        {
            respawnable.Respawn();
        }

        // Gravity controls
        if (Input.GetKeyDown("up"))
        {
            vehicleController.InvertGravity();
        }
        else if (Input.GetKeyDown("right"))
        {
            vehicleController.ShiftGravityClockwise();
        }
        else if (Input.GetKeyDown("left"))
        {
            vehicleController.ShiftGravityCounterClockwise();
        }

        // Vehicle movement
        // TODO: Potentially use an axis input instead for a/d
        if (Input.GetKey("a"))
        {
            vehicleController.MoveLeft();
        }
        else if (Input.GetKey("d"))
        {
            vehicleController.MoveRight();
        }

        if (Input.GetKeyDown("s"))
        {
            vehicleController.ApplyBrake();
        }
        else if (Input.GetKeyUp("s"))
        {
            vehicleController.ReleaseBrake();
        }
    }