void Awake() { m_Academy = FindObjectOfType <SoccerAcademy>(); m_GroundRenderer = centerPitch.GetComponent <Renderer>(); m_GroundMaterial = m_GroundRenderer.material; canResetBall = true; if (goalTextUI) { goalTextUI.SetActive(false); } ballRb = ball.GetComponent <Rigidbody>(); m_BallController = ball.GetComponent <SoccerBallController>(); m_BallController.area = this; ballStartingPos = ball.transform.position; }
void Awake() // 무조건 실행되는 함수인데 { m_Academy = FindObjectOfType <SoccerAcademy>(); m_GroundRenderer = centerPitch.GetComponent <Renderer>(); //중앙피치에서 랜더링 값을 가져와서 m_GroundRenderer에 넣어줌. 왜? 아 바닥의 색을 바꾸기 위해서??? m_GroundMaterial = m_GroundRenderer.material; canResetBall = true; // ???? if (goalTextUI) { goalTextUI.SetActive(false); } // ui가 처음에는 안나오고. 골을 넣으면 나옴 ballRb = ball.GetComponent <Rigidbody>(); // 공의 강체값을 ballRb에 넣는다. m_BallController = ball.GetComponent <SoccerBallController>(); m_BallController.area = this; // ballStartingPos = ball.transform.position; // 공의 위치를 시작위치로 정해줌 }
public override void InitializeAgent() { base.InitializeAgent(); agentRenderer = GetComponent <Renderer>(); rayPer = GetComponent <RayPerception>(); academy = FindObjectOfType <SoccerAcademy>(); var playerState = new PlayerState(); 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; }
public override void InitializeAgent() { base.InitializeAgent(); m_AgentRenderer = GetComponentInChildren <Renderer>(); m_Academy = FindObjectOfType <SoccerAcademy>(); agentRb = GetComponent <Rigidbody>(); agentRb.maxAngularVelocity = 500; var playerState = new PlayerState { agentRb = agentRb, startingPos = transform.position, agentScript = this, }; area.playerStates.Add(playerState); m_PlayerIndex = area.playerStates.IndexOf(playerState); playerState.playerIndex = m_PlayerIndex; }
public override void InitializeAgent() // 초기화됨. 매우 중요함. { base.InitializeAgent(); //에이전트 초기화 이때는 에이전트가 퍼플도 블루도 아님 >>> 여기서 base의 의미는 부모의 오버라이드된 InitializaAgnet()라는 메소드를 지정한다는거, 초기화값을 부모에게 전달 m_AgentRenderer = GetComponentInChildren <Renderer>(); // 렌더러로 화면에 나타남? m_RayPer = GetComponent <RayPerception>(); //레이인식 m_Academy = FindObjectOfType <SoccerAcademy>(); // 축구아카데미 설정 agentRb = GetComponent <Rigidbody>(); // // 강체를 적용 agentRb.maxAngularVelocity = 500; // 최고 속도를 500으로 설정 그런데 이거 실수 var playerState = new PlayerState //??? { agentRb = agentRb, startingPos = transform.position, agentScript = this, }; area.playerStates.Add(playerState); m_PlayerIndex = area.playerStates.IndexOf(playerState); //???? playerState.playerIndex = m_PlayerIndex; }