Merge branch 'master' of git@ooftooft.net:Racesm.git
# Conflicts: # Assets/ML-Agents/Timers/Racetrack mini_timers.json # Assets/ML-Agents/Timers/mini_racetrack3_timers.json
This commit is contained in:
@@ -8,6 +8,7 @@ public class GameManager : MonoBehaviour
|
||||
public int lapAmount;
|
||||
public GameObject[] checkpoints;
|
||||
public GameObject[] players;
|
||||
[HideInInspector] public string[] playersFinished;
|
||||
|
||||
int[] playerLaps;
|
||||
void Start()
|
||||
@@ -28,6 +29,9 @@ public class GameManager : MonoBehaviour
|
||||
{
|
||||
GameObject player = players[i];
|
||||
|
||||
if (playersFinished.Contains(player.name))
|
||||
continue;
|
||||
|
||||
bool isAI = true;
|
||||
if (player.GetComponent<PlayerController>().enabled)
|
||||
isAI = false;
|
||||
@@ -56,8 +60,12 @@ public class GameManager : MonoBehaviour
|
||||
if (playerLaps[i] > lapAmount)
|
||||
{
|
||||
player.GetComponent<Rigidbody>().isKinematic = true;
|
||||
}
|
||||
playersFinished.Append(player.name);
|
||||
|
||||
print("\nPlayers finished:");
|
||||
foreach (string pp in playersFinished)
|
||||
print(pp);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -10,17 +10,13 @@ public class NPCimproved : MonoBehaviour
|
||||
private bool walking = true;
|
||||
|
||||
|
||||
void Start()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void Update()
|
||||
{
|
||||
if (walking)
|
||||
{
|
||||
//npcPrefab.transform.position += new Vector3(0,0,0.005f);
|
||||
npcPrefab.transform.position += transform.forward * Time.deltaTime;
|
||||
npcPrefab.transform.position = new Vector3(npcPrefab.transform.position.x, 0, npcPrefab.transform.position.z);
|
||||
}
|
||||
|
||||
//animator.SetBool("IsTurning", false);
|
||||
@@ -42,7 +38,7 @@ public class NPCimproved : MonoBehaviour
|
||||
if (col.gameObject.tag == "Wall")
|
||||
{
|
||||
|
||||
npcPrefab.transform.eulerAngles += new Vector3(0,180,0);
|
||||
npcPrefab.transform.eulerAngles += new Vector3(0,120,0);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -77,18 +77,19 @@ public class PlayerController : MonoBehaviour
|
||||
|
||||
if (isBraking)
|
||||
{
|
||||
wheel.WheelCollider.motorTorque = 0;
|
||||
wheel.WheelCollider.brakeTorque = Mathf.Abs(vInput) * brakeTorque;
|
||||
//wheel.WheelCollider.motorTorque = 0;
|
||||
}
|
||||
|
||||
if (isAccelerating)
|
||||
{
|
||||
// Apply torque to Wheel colliders that have "Motorized" enabled
|
||||
wheel.WheelCollider.brakeTorque = 0;
|
||||
if (wheel.motorized)
|
||||
{
|
||||
wheel.WheelCollider.motorTorque = vInput * currentMotorTorque;
|
||||
}
|
||||
wheel.WheelCollider.brakeTorque = 0;
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -122,13 +123,13 @@ public class PlayerController : MonoBehaviour
|
||||
}
|
||||
|
||||
private void Update() {
|
||||
// Transform currentCheckpoint = checkpoints[checkpointsCollected].transform;
|
||||
// float checkpintDistance = distanceToCheckpoint(currentCheckpoint);
|
||||
Transform currentCheckpoint = checkpoints[checkpointsCollected].transform;
|
||||
float checkpintDistance = distanceToCheckpoint(currentCheckpoint);
|
||||
|
||||
// if (checkpintDistance < 0.1f)
|
||||
// {
|
||||
// checkpointsCollected += 1;
|
||||
// }
|
||||
if (checkpintDistance < 0.1f)
|
||||
{
|
||||
checkpointsCollected += 1;
|
||||
}
|
||||
}
|
||||
|
||||
private void OnCollisionEnter(Collision other) {
|
||||
|
||||
Reference in New Issue
Block a user