August 2018
Beginner
334 pages
10h 19m
English
We will implement three different classes for handling low-level and high-level AIs, as follows:
using UnityEngine;
public class RacingRival : MonoBehaviour
{
public float distanceThreshold;
public float maxSpeed;
public Vector3 randomPos;
protected Vector3 targetPosition;
protected float currentSpeed;
protected RacingCenter ghost;
}
void Start()
{
ghost = FindObjectOfType<RacingCenter>();
}
public virtual void Update() { targetPosition = transform.position + randomPos; AdjustSpeed(targetPosition); ...Read now
Unlock full access