void Awake() { academy = FindObjectOfType <NewAcademy>(); groundRenderer = centerPitch.GetComponent <Renderer>(); groundMaterial = groundRenderer.material; canResetBall = true; if (goalTextUI) { goalTextUI.SetActive(false); } ballRB = ball.GetComponent <Rigidbody>(); ballController = ball.GetComponent <NewBallController>(); 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 <NewAcademy>(); NewState playerState = new NewState(); playerState.agentRB = GetComponent <Rigidbody>(); agentRB = GetComponent <Rigidbody>(); agentRB.maxAngularVelocity = 500; playerState.startingPos = transform.position; playerState.agentScript = this; area.playerStates.Add(playerState); playerIndex = area.playerStates.IndexOf(playerState); playerState.playerIndex = playerIndex; }