private void Shoot() { // Set the information Ball ball = ballCarrier.Ball.ThrowIfNull("Tried to shoot ball while [ballCarrier.Ball] is null"); NormalMovementInformation shootBallInfo = stateManager.GetStateInformationForWriting <NormalMovementInformation>(State.NormalMovement); shootBallInfo.ShotBall = true; shootBallInfo.BallStartPosition = ball.CurrentPosition; shootBallInfo.Velocity = (ball.CurrentPosition - (Vector2)transform.position).normalized * shotSpeed; // Cleanup and transition states StopShootBallCoroutines(); stateManager.TransitionToState(State.NormalMovement, shootBallInfo); }
private void HandlePlayerShotBall(Player player) { NormalMovementInformation information = player.StateManager.CurrentStateInformation_Exn <NormalMovementInformation>(); // If we didn't shoot the ball, just return if (!information.ShotBall) { return; } AudioManager.instance.ShootBallSound.Play(.5f); if (photonView.IsMine) { // TODO dkonik: Do more here, interp based on the timestamp and ball start // pos, but I am being lazy right now just to see how this works rigidbody.velocity = information.Velocity; } }