public BallHitReplayInfo(BallHitReplayInfo ballHitInfo) { playerId = ballHitInfo.playerId; drive = ballHitInfo.drive; backhand = ballHitInfo.backhand; fastDrive = ballHitInfo.fastDrive; fastBackhand = ballHitInfo.fastBackhand; serve = ballHitInfo.serve; }
public RecordedReplayInfo(int id, Vector3 player1Position, Quaternion player1Rotation, BallHitReplayInfo player1BallHitInfo, Vector3 player2Position, Quaternion player2Rotation, BallHitReplayInfo player2BallHitInfo, Vector3 ballPosition, Quaternion ballRotation) { this.id = id; this.player1Position = player1Position; this.player1Rotation = player1Rotation; this.player1BallHitInfo = new BallHitReplayInfo(player1BallHitInfo); this.player2Position = player2Position; this.player2Rotation = player2Rotation; this.player2BallHitInfo = new BallHitReplayInfo(player2BallHitInfo); this.ballPosition = ballPosition; this.ballRotation = ballRotation; }
// Start is called before the first frame update void Start() { recordedReplayInfo = new List <RecordedReplayInfo>(); var gameManager = GetComponent <GameManager>(); _player = gameManager.player; _aiPlayer = gameManager.aiPlayer; _pointManager = gameManager.pointManager; _soundManager = gameManager.soundManager; _musicAudioSource = replayCamera.GetComponent <AudioSource>(); player1BallHitInfo = new BallHitReplayInfo(_player.playerId); player2BallHitInfo = new BallHitReplayInfo(_aiPlayer.playerId); mainCamera = GameObject.FindWithTag("MainCamera"); _scoreboard = GameObject.FindGameObjectWithTag("Scoreboard"); }
public void ReplayMove(Vector3 position, Quaternion rotation, BallHitReplayInfo ballHitInfo, bool triggerCelebration, bool wonPoint) { var distance = position - transform.position; var dz = RoundAnimatorMovementValue(distance.z / Time.fixedDeltaTime); var dx = RoundAnimatorMovementValue(distance.x / Time.fixedDeltaTime); _animator.SetFloat(_strafeHash, dz); _animator.SetFloat(_forwardHash, dx); transform.position = position; transform.rotation = rotation; if (ballHitInfo.Serve) { SwitchBallType(true); _animator.SetTrigger(_serviceTriggerHash); } else if (ballHitInfo.Drive) { _animator.SetTrigger(_driveHash); } else if (ballHitInfo.Backhand) { _animator.SetTrigger(_backhandHash); } else if (ballHitInfo.FastDrive) { _animator.SetTrigger(_fastDriveHash); } else if (ballHitInfo.FastBackhand) { _animator.SetTrigger(_fastBackhandHash); } if (triggerCelebration) { _animator.SetTrigger(wonPoint? _cheerHash : _defeatedHash); } }