private void Awake() { m_Academy = FindObjectOfType <MiniSoccerAcademy>(); m_GroundRenderer = centerPitch.GetComponent <Renderer>(); m_GroundMaterial = m_GroundRenderer.material; ballRb = ball.GetComponent <Rigidbody>(); m_BallController = ball.GetComponent <MiniSoccerBallController>(); m_BallController.area = this; ballStartingPos = ball.transform.position; }
public override void InitializeAgent() { base.InitializeAgent(); m_AgentRenderer = GetComponentInChildren <Renderer>(); // m_RayPerception = GetComponent<RayPerception>(); m_Academy = FindObjectOfType <MiniSoccerAcademy>(); agentRigitBody = GetComponent <Rigidbody>(); agentRigitBody.maxAngularVelocity = 500; var playerState = new MiniSoccerPlayerState { agentRb = agentRigitBody, startingPos = transform.position, agentScript = this, }; area.playerStates.Add(playerState); m_PlayerIndex = area.playerStates.IndexOf(playerState); playerState.playerIndex = m_PlayerIndex; }