private void OnLayWallButtonPressed() { if (player.Team != null && stateManager.CurrentState == State.NormalMovement) { TronWallInformation info = stateManager.GetStateInformationForWriting <TronWallInformation>(State.LayTronWall); info.Direction = playerMovement.Forward; info.StartPosition = playerMovement.CurrentPosition; stateManager.TransitionToState(State.LayTronWall, info); } }
private void DoLayTronWall() { // TODO dkonik: Previously, we were setting this every frame while the player was // laying the tron wall, do we still need to do this. TronWallInformation info = stateManager.CurrentStateInformation_Exn <TronWallInformation>(); StopAllMovementCoroutines(false); float timeTravelledSoFar = (float)(PhotonNetwork.Time - info.EventTimeStamp); Vector2 layingVelocity = PlayerTronMechanic.layingSpeedMovementSpeedRatio * movementSpeed * info.Direction; rb2d.position = info.StartPosition + timeTravelledSoFar * layingVelocity; rb2d.velocity = layingVelocity; }