void Update() { for (int i = 0; i < 2; i++) { _playerObj[i].transform.position = _positionTracker.PlayerPosition(i, i); _playerObj[i].transform.rotation = Quaternion.Euler(_positionTracker.PlayerRotation(i, i)); //Debug.Log("Player " + i.ToString()); //Debug.Log(_playerObj[i].transform.position); //Debug.Log(_playerObj[i].transform.rotation); } }
void StartGame() { _floorDetectionStatus = FloorDetectionStatus.GameStarting; imageMask.gameObject.SetActive(true); // Display Count down timer _timeCount = MAX_TIME; mainMessage.text = ((int)_timeCount).ToString(); _positionTracker = GetComponent <PositionTracker>(); _playerObj = new GameObject[2]; for (int i = 0; i < 2; i++) { _playerObj[i] = Instantiate(playerPrefab, GetPlayerPositionInGod(_positionTracker.PlayerPosition(i, i)), Quaternion.Euler(_positionTracker.PlayerRotation(i, i))); _playerObj[i].transform.localScale = Resize(_playerObj[i].transform.localScale); _playerObj[i].GetComponent <PlayerController>().SetPlayerId(i); } }
// Update is called once per frame void Update() { if (_debug) { debugPositionText.text = "Current Position \n" + "x = " + Camera.main.transform.position.x.ToString() + "\n" + "y = " + Camera.main.transform.position.y.ToString() + "\n" + "z = " + Camera.main.transform.position.z.ToString() + "\n" + "base = " + string.Format("x:{0:0.######} y:{1:0.######} z:{2:0.######}", _basePoint.x, _basePoint.y, _basePoint.z); } if (_floorDetectionStatus == FloorDetectionStatus.GameStarting) { _timeCount -= Time.deltaTime; mainMessage.text = ((int)_timeCount).ToString(); if (_timeCount <= 1 && _timeCount > 0) { mainMessage.text = "Start!"; imageMask.gameObject.SetActive(false); } else if (_timeCount <= 0) { mainMessage.text = ""; mainMessage.gameObject.SetActive(false); _floorDetectionStatus = FloorDetectionStatus.GameStarted; } } else if (_floorDetectionStatus == FloorDetectionStatus.GameStarted) { // Get base position // Update position for (int i = 0; i < 2; i++) { _playerObj[i].transform.position = GetPlayerPositionInGod(_positionTracker.PlayerPosition(i, i)); _playerObj[i].transform.rotation = Quaternion.Euler(_positionTracker.PlayerRotation(i, i)); } } }
void Update() { _playerObj.transform.position = _positionTracker.PlayerPosition(_playerId, 1); _playerObj.transform.rotation = Quaternion.Euler(_positionTracker.PlayerRotation(_playerId, 1)); }