Exemple #1
0
    void Start()
    {
        carScript = (BuggyControl)target.GetComponent <BuggyControl>();

        myRigidbody = target.GetComponent <Rigidbody>();

        cameraSwitchView = carScript.carSetting.cameraSwitchView;
    }
Exemple #2
0
    // Start is called before the first frame update
    void Start()
    {
        // 車の情報
        buggycontrol = car.GetComponent <BuggyControl>();

        lastPos = buggycontrol.GetPos();

        lastRot = buggycontrol.GetRot();
    }
 void Start()
 {
     fadeImage = GetComponent <Image>();
     red       = fadeImage.color.r;
     green     = fadeImage.color.g;
     blue      = fadeImage.color.b;
     alfa      = 0.0f;
     //carController = car.GetComponent<Car.CarController>();
     buggyControl     = car.GetComponent <BuggyControl>();
     cameraController = camera.GetComponent <CameraController>();
     //userController = car.GetComponent<Car.CarUserControl>();
 }
Exemple #4
0
    void Update()
    {
        if (!target)
        {
            return;
        }

        carScript = (BuggyControl)target.GetComponent <BuggyControl>();

        myRigidbody = target.GetComponent <Rigidbody>();

        if (Input.GetKeyDown(KeyCode.G))
        {
            RestCar();
        }


        if (Input.GetKeyDown(KeyCode.R))
        {
            Application.LoadLevel(Application.loadedLevel);
        }


        if (restTime != 0.0f)
        {
            restTime = Mathf.MoveTowards(restTime, 0.0f, Time.deltaTime);
        }



        ShowCarUI();

        GetComponent <Camera>().fieldOfView = Mathf.Clamp(carScript.speed / 10.0f + 60.0f, 60, 90.0f);



        if (Input.GetKeyDown(KeyCode.C))
        {
            Switch++;
            if (Switch > cameraSwitchView.Count)
            {
                Switch = 0;
            }
        }



        if (Switch == 0)
        {
            // Damp angle from current y-angle towards target y-angle

            //  float xAngle = Mathf.SmoothDampAngle(transform.eulerAngles.x,
            ///target.eulerAngles.x + Angle, ref xVelocity, smooth);

            float yAngle = Mathf.SmoothDampAngle(transform.eulerAngles.y,
                                                 target.eulerAngles.y, ref yVelocity, smooth);

            // Look at the target
            transform.eulerAngles = new Vector3(Angle, yAngle, 0.0f);

            var direction      = transform.rotation * -Vector3.forward;
            var targetDistance = AdjustLineOfSight(target.position + new Vector3(0, height, 0), direction);


            transform.position = target.position + new Vector3(0, height, 0) + direction * targetDistance;
        }
        else
        {
            transform.position = cameraSwitchView[Switch - 1].position;
            transform.rotation = Quaternion.Lerp(transform.rotation, cameraSwitchView[Switch - 1].rotation, Time.deltaTime * 5.0f);
        }
    }