private void Start() { //grid 초기화 grid = ClientLibrary.Grid.instance; if (PhotonNetwork.IsMasterClient && photonView.IsMine) { Debug.Log("나마스터임"); photonView.RPC("ChangeColorA", RpcTarget.All); CountdownTimer.instance.playerA = true; } else if (photonView.IsMine) { photonView.RPC("ChangeColorB", RpcTarget.All); CountdownTimer.instance.playerB = true; } if (!photonView.IsMine) { return; } else { //smoothMovment null 초기화 smoothMovement = SmoothMovement(null); //Get a component reference to this object's BoxCollider2D boxCollider = GetComponent <BoxCollider>(); //currentGrid 초기화 currentGrid = grid.GetNearestPointOnGrid(transform.position); controller = GetComponent <CharacterController>(); //위치 초기화 transform.position = grid.GetCurrentGrid(transform.position) + new Vector3(0.001f, 0, 0.001f);//반올림 error 보간값 } }
//Grid.cs 에서 클릭된 포지션의 grid 근삿값을 리턴함 private Vector3 PlaceCubeNear(Vector3 clickPoint) { var finalPosition = grid.GetNearestPointOnGrid(clickPoint); return(finalPosition); }