void Awake() { academy = FindObjectOfType <CarsAcademy>(); groundRenderer = centerPitch.GetComponent <Renderer>(); groundMaterial = groundRenderer.material; canResetBall = true; if (goalTextUI) { goalTextUI.SetActive(false); } ballRB = ball.GetComponent <Rigidbody>(); ballController = ball.GetComponent <CarsBallController>(); ballController.area = this; ballStartingPos = ball.transform.position; Mesh mesh = ground.GetComponent <MeshFilter>().mesh; }
public override void InitializeAgent() { base.InitializeAgent(); agentRenderer = GetComponent <Renderer>(); rayPer = GetComponent <RayPerception>(); academy = FindObjectOfType <CarsAcademy>(); agentRb = GetComponent <Rigidbody>(); agentRb.maxAngularVelocity = 500; var playerState = new CarState { agentRB = agentRb, startingPos = transform.position, agentScript = this, }; area.playerStates.Add(playerState); playerIndex = area.playerStates.IndexOf(playerState); playerState.playerIndex = playerIndex; }