Exemplo n.º 1
0
 void Start()
 {
     _rigidBody    = GetComponent <Rigidbody>();
     NextCheckmark = Checkmarks.transform.GetChild(0).gameObject;
     NextCheckmark.GetComponent <MeshRenderer>().material = CurrentCheckmarkMaterial;
     Debug.Log("First Checkmark is " + NextCheckmark.name);
     GetComponent <TargetIndicatorController>().Target = NextCheckmark;
     currAudio             = gameObject.AddComponent <AudioSource>();
     currAudio.playOnAwake = false;
     currAudio.clip        = SoundLow;
     currAudio.volume      = 0.5f;
 }
Exemplo n.º 2
0
    protected override void SetRotationPoint()
    {
        Vector3 target    = (NextCheckmark.GetComponent <Collider>().ClosestPoint(transform.position) + NextCheckmark.transform.position) / 2;
        Vector3 direction = target - transform.position;

        if (direction.magnitude > 30 && direction.magnitude > _rigidBody.velocity.magnitude)
        {
            direction = direction - _rigidBody.velocity * Mathf.Abs(_sideSlipAmount) * 1.8f;
        }
        float rotationAngle = Mathf.Atan2(direction.x, direction.z) * Mathf.Rad2Deg;

        targetRotation = Quaternion.Euler(0, rotationAngle, 0);
    }
Exemplo n.º 3
0
 protected override void GetNextCheckmark()
 {
     if (LapCheck)
     {
         MarkLap();
     }
     if (Checkmarks.transform.childCount <= ++NextCheckmarkIndex)
     {
         NextCheckmarkIndex = 0;
         LapCheck           = true;
     }
     NextCheckmark.GetComponent <MeshRenderer>().material = InactiveCheckmarkMaterial;
     NextCheckmark = NextCheckmark.transform.parent.GetChild(NextCheckmarkIndex).gameObject;
     NextCheckmark.GetComponent <MeshRenderer>().material = CurrentCheckmarkMaterial;
     Debug.Log("Next Checkpoint is " + NextCheckmarkIndex + 1);
     GetComponent <TargetIndicatorController>().Target = NextCheckmark;
 }