This commit is contained in:
mxssw 2025-06-21 14:00:36 +03:00
commit 7cdb281c23
8 changed files with 66 additions and 9 deletions

View File

@ -242,8 +242,12 @@ namespace FishNet.Discovery
//
// return;
// }
<<<<<<< HEAD
<<<<<<< HEAD
Debug.Log("NetworkDiscovery is searching");
=======
// Debug.Log("NetworkDiscovery is searching on port " + port);
>>>>>>> master
=======
// Debug.Log("NetworkDiscovery is searching on port " + port);
>>>>>>> master

View File

@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:c4dfd870243f7478ecd0558d9b6821d6952a0367b38a5c3e225896d287b4c07b
size 26638

View File

@ -1,8 +1,12 @@
using System.Collections;
using System.Collections.Generic;
<<<<<<< HEAD
using Unity.XR.CoreUtils;
using UnityEngine;
using static MouseLook;
=======
using UnityEngine;
>>>>>>> master
public class CarDrivingRoutine : MonoBehaviour
{
@ -10,6 +14,7 @@ public class CarDrivingRoutine : MonoBehaviour
public AudioSource _tireSound;
public Waypoint _waypoint;
<<<<<<< HEAD
public float StraightSpeed = 5f; // Movement speed
public float rotationSpeed = 5f; // Rotation speed
public float waypointProximityThreshold = 0.5f; // Distance to consider "close enough" to a waypoint
@ -28,16 +33,29 @@ public class CarDrivingRoutine : MonoBehaviour
targetSpeed = StraightSpeed;
targetRotationSpeed = rotationSpeed;
}
=======
public float speed = 5f; // Movement speed
public float rotationSpeed = 5f; // Rotation speed
public float waypointProximityThreshold = 0.5f; // Distance to consider "close enough" to a waypoint
>>>>>>> master
// Update is called once per frame
void Update()
{
<<<<<<< HEAD
//if (hasPedestrianInFront) return;
if (_waypoint == null) return; // Just in case.
// Move towards the waypoint
Vector3 targetPosition = _waypoint.transform.position;
float step = StraightSpeed * Time.deltaTime;
=======
if (_waypoint == null) return;
// Move towards the waypoint
Vector3 targetPosition = _waypoint.transform.position;
float step = speed * Time.deltaTime;
>>>>>>> master
transform.position = Vector3.MoveTowards(transform.position, targetPosition, step);
// Rotate towards the desired rotation
@ -45,6 +63,7 @@ public class CarDrivingRoutine : MonoBehaviour
Quaternion desiredRotation = Quaternion.Euler(0, targetRotation, 0);
transform.rotation = Quaternion.RotateTowards(transform.rotation, desiredRotation, rotationSpeed * Time.deltaTime);
<<<<<<< HEAD
rollTires(); // Just an aesthetic improvement.
if (Quaternion.Angle(transform.rotation, desiredRotation) > 1f) // If the car is turning.
@ -66,12 +85,15 @@ public class CarDrivingRoutine : MonoBehaviour
isTurning = false;
}
=======
>>>>>>> master
// Check if close enough to the waypoint
if (Vector3.Distance(transform.position, targetPosition) <= waypointProximityThreshold &&
Quaternion.Angle(transform.rotation, desiredRotation) <= 1f)
{
// Proceed to the next waypoint
_waypoint = _waypoint.Next;
<<<<<<< HEAD
}
}
@ -138,4 +160,18 @@ public class CarDrivingRoutine : MonoBehaviour
StraightSpeed = targetStraightSpeed;
rotationSpeed = targetRotationSpeed;
}
=======
if (_waypoint == null)
{
// Optional: Play stop sound when no more waypoints
_stopSound?.Play();
}
else
{
// Optional: Play tire sound when moving to the next waypoint
_tireSound?.Play();
}
}
}
>>>>>>> master
}

View File

@ -65,6 +65,7 @@ MonoBehaviour:
m_GameObject: {fileID: 876842842715561968}
m_Enabled: 1
m_EditorHideFlags: 0
<<<<<<< HEAD
m_Script: {fileID: 11500000, guid: 98cc0a7a6d6d7314c8e390e45a9e1483, type: 3}
m_Name:
m_EditorClassIdentifier:
@ -72,6 +73,12 @@ MonoBehaviour:
port: 1
discoveryInterval: 0
automatic: 0
=======
m_Script: {fileID: 11500000, guid: 2883099670a13fa4397b2335c51bc792, type: 3}
m_Name:
m_EditorClassIdentifier:
networkDiscovery: {fileID: 3580593382982171501}
>>>>>>> master
--- !u!114 &3580593382982171501
MonoBehaviour:
m_ObjectHideFlags: 0
@ -81,10 +88,17 @@ MonoBehaviour:
m_GameObject: {fileID: 876842842715561968}
m_Enabled: 1
m_EditorHideFlags: 0
<<<<<<< HEAD
m_Script: {fileID: 11500000, guid: 846c98250226ef949b5c0c499e9334da, type: 3}
=======
m_Script: {fileID: 11500000, guid: 81d12db8c9730a74a923496476cfbf80, type: 3}
>>>>>>> master
m_Name:
m_EditorClassIdentifier:
networkDiscovery: {fileID: 4784684551416650039}
secret: deltavr
port: 0
discoveryInterval: 0
automatic: 0
--- !u!114 &3642215892935434233
MonoBehaviour:
m_ObjectHideFlags: 0

Binary file not shown.

Binary file not shown.

Binary file not shown.

BIN
ProjectSettings/AudioManager.asset (Stored with Git LFS)

Binary file not shown.