Skip to content

Commit

Permalink
implemented a speedometer
Browse files Browse the repository at this point in the history
  • Loading branch information
dcmrobin committed May 10, 2023
1 parent 3b09232 commit beff8e4
Show file tree
Hide file tree
Showing 5 changed files with 634 additions and 1 deletion.
Binary file modified Assets/Game/Models/car.blend
Binary file not shown.
Binary file modified Assets/Game/Models/car.blend1
Binary file not shown.
3 changes: 3 additions & 0 deletions Assets/Game/Scripts/SimpleCarController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
using System.Collections;
using System.Collections.Generic;
using Photon.Pun;
using TMPro;

[System.Serializable]
public class AxleInfo {
Expand All @@ -17,6 +18,7 @@ public class SimpleCarController : MonoBehaviour {
public float maxSteeringAngle;
public Transform steeringWheel;
public GameObject currentDriver;
public TMP_Text speedNumText;
public PhotonView pv;

// finds the corresponding visual wheel
Expand All @@ -39,6 +41,7 @@ public void ApplyLocalPositionToVisuals(WheelCollider collider)

public void FixedUpdate()
{
speedNumText.text = Mathf.Round(GetComponent<Rigidbody>().velocity.magnitude).ToString();
if (GetComponent<Damageable>() != null)
{
maxMotorTorque = GetComponent<Damageable>().health;
Expand Down
1 change: 1 addition & 0 deletions Assets/Resources/PhotonPrefabs/Player.prefab
Original file line number Diff line number Diff line change
Expand Up @@ -3845,6 +3845,7 @@ MonoBehaviour:
playerCanvases: []
allCars: []
allGuns: []
allPlayers: []
screenspaceCanvas: {fileID: 2508726181643955868}
playerModel: {fileID: 4345891675642908121}
magazineModel: {fileID: 5777915231028986748}
Expand Down
Loading

0 comments on commit beff8e4

Please sign in to comment.