示例#1
0
 void Update()
 {
     if (BRGameController.CurrentRaceState() == RaceState.RACING)
     {
         placeText.enabled = true;
         timerText.enabled = true;
     }
     else
     {
         placeText.enabled = false;
         timerText.enabled = false;
     }
 }
示例#2
0
    void FixedUpdate()
    {
        RaceState state = BRGameController.CurrentRaceState();

        bool canStart = false;
        bool canStop  = false;

        switch (state)
        {
        case RaceState.LOBBY:
            canStart = true;
            break;

        case RaceState.RACING:
            canStop = true;
            break;
        }
        startObj.SetActive(canStart);
        stopObj.SetActive(canStop);
    }
    // Update is called once per frame
    void FixedUpdate()
    {
        if (BRGameController.gameOver)
        {
            target = null;
            return;
        }
        BaseCar c = BRGameController.GetCurrentLeader();

        if (!c)
        {
            return;
        }
        target = c.transform;


        targetPos = target.position - target.forward * distance + Vector3.up * height;

        thisTransform.position = Vector3.Lerp(thisTransform.position, targetPos, Time.deltaTime * speed);
        Vector3    targetDir  = target.position - thisTransform.position;
        Quaternion desiredRot = Quaternion.LookRotation(targetDir, Vector3.up);

        thisTransform.rotation = Quaternion.Slerp(thisTransform.rotation, desiredRot, Time.deltaTime * speed);
    }
示例#4
0
 public Race(BRGameController ctrl)
 {
     gameController = ctrl;
 }