Compare commits

...

4 commits

4 changed files with 6 additions and 10 deletions

View file

@ -95,10 +95,9 @@ private void Awake()
{ {
var hasChild = false; var hasChild = false;
var i = 0; var i = 0;
GameObject test;
while (!hasChild) while (!hasChild)
{ {
test = gameObject.transform.GetChild(i).gameObject; var test = gameObject.transform.GetChild(i).gameObject;
if (test.name == "Target") if (test.name == "Target")
{ {
_driveTarget = test.transform; _driveTarget = test.transform;

View file

@ -67,7 +67,7 @@ private IEnumerator Manager()
_ais = GameObject.FindGameObjectsWithTag("AIs"); _ais = GameObject.FindGameObjectsWithTag("AIs");
if (_ais.Length < maxAI) if (_ais.Length < maxAI)
{ {
var instance = Instantiate(aiPrefab, gameObject.transform); // var instance = Instantiate(aiPrefab, gameObject.transform);
} }
foreach (var i in _ais) foreach (var i in _ais)

View file

@ -6,6 +6,7 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq;
using UnityEngine; using UnityEngine;
/// <summary> /// <summary>
@ -102,9 +103,8 @@ public void Brake()
/// </summary> /// </summary>
public void Steering() public void Steering()
{ {
foreach (var wheel in wheels) foreach (var wheel in wheels.Where(wheel => wheel.axel == Axel.Front))
if (wheel.axel == Axel.Front) wheel.wheelCollider.steerAngle = _currentTurn;
wheel.wheelCollider.steerAngle = _currentTurn;
} }
/// <summary> /// <summary>

View file

@ -96,10 +96,7 @@ private IEnumerator OpenDoor()
{ {
currentDuration = 0; currentDuration = 0;
_opening = false; _opening = false;
if (_isOpen) _isOpen = !_isOpen;
_isOpen = false;
else
_isOpen = true;
} }
yield return new WaitForEndOfFrame(); yield return new WaitForEndOfFrame();