game: fixing unknown unicode error
honestly have no clue how they got there in the first place
This commit is contained in:
parent
9dfc52a907
commit
dae5cfb88f
|
@ -2,7 +2,7 @@
|
|||
* author: lin hengrui ryan
|
||||
* date: 30/7/2024
|
||||
<<<<<<< Updated upstream
|
||||
* description: ai code for the different ai in the game
|
||||
* description: AI code for the different AI in the game
|
||||
=======
|
||||
* description: AI code for the different AI in the game
|
||||
>>>>>>> Stashed changes
|
||||
|
@ -15,36 +15,11 @@
|
|||
|
||||
public class AI : MonoBehaviour
|
||||
{
|
||||
<<<<<<< Updated upstream
|
||||
/// <summary>
|
||||
/// the types of ai that this game object can be
|
||||
/// </summary>
|
||||
public enum EntityType
|
||||
{
|
||||
Human,
|
||||
Car
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// to save resources when referring to the speed of this ai if its a human
|
||||
/// to save resources when referring to the speed of this AI if its human
|
||||
/// </summary>
|
||||
private static readonly int AnimatorSpeed = Animator.StringToHash("Speed");
|
||||
|
||||
/// <summary>
|
||||
/// to show the entity types in the inspector as a dropdown
|
||||
/// </summary>
|
||||
public EntityType entityType;
|
||||
=======
|
||||
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// to save resources when referring to the speed of this AI
|
||||
/// </summary>
|
||||
private static readonly int AnimatorSpeed = Animator.StringToHash("Speed");
|
||||
|
||||
|
||||
>>>>>>> Stashed changes
|
||||
|
||||
/// <summary>
|
||||
/// set the layers the AI can be on
|
||||
|
@ -86,63 +61,38 @@ public enum EntityType
|
|||
/// </summary>
|
||||
private string _nextState;
|
||||
|
||||
<<<<<<< Updated upstream
|
||||
=======
|
||||
|
||||
|
||||
|
||||
>>>>>>> Stashed changes
|
||||
/// <summary>
|
||||
/// to set initial values
|
||||
/// </summary>
|
||||
public void Awake()
|
||||
{
|
||||
<<<<<<< Updated upstream
|
||||
_agent = GetComponent<NavMeshAgent>();
|
||||
if (entityType == EntityType.Human)
|
||||
{
|
||||
_animator = GetComponent<Animator>();
|
||||
_currentState = "Strolling";
|
||||
}
|
||||
=======
|
||||
|
||||
_agent = GetComponent<NavMeshAgent>();
|
||||
_animator = GetComponent<Animator>();
|
||||
_currentState = "Strolling";
|
||||
|
||||
_animator = GetComponent<Animator>();
|
||||
_currentState = "Strolling";
|
||||
|
||||
|
||||
_agent = GetComponent<NavMeshAgent>();
|
||||
_animator = GetComponent<Animator>();
|
||||
_currentState = "Strolling";
|
||||
|
||||
|
||||
>>>>>>> Stashed changes
|
||||
|
||||
_nextState = _currentState;
|
||||
ChangeState();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
<<<<<<< Updated upstream
|
||||
/// to update the speed of the AI to the animator each frame and to update any state changes to the ai
|
||||
/// </summary>
|
||||
public void Update()
|
||||
{
|
||||
if (entityType == EntityType.Human) _animator.SetFloat(AnimatorSpeed, _agent.velocity.magnitude);
|
||||
=======
|
||||
/// to update the speed of the AI to the animator each frame and to update any state changes to the AI
|
||||
/// </summary>
|
||||
public void Update()
|
||||
{
|
||||
_animator.SetFloat(AnimatorSpeed, _agent.velocity.magnitude);
|
||||
>>>>>>> Stashed changes
|
||||
_currentState = _nextState;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// to change the scene when needed
|
||||
/// </summary>
|
||||
<<<<<<< Updated upstream
|
||||
public void ChangeState()
|
||||
=======
|
||||
private void ChangeState()
|
||||
>>>>>>> Stashed changes
|
||||
{
|
||||
StartCoroutine(_currentState);
|
||||
}
|
||||
|
@ -172,10 +122,6 @@ private IEnumerator Strolling()
|
|||
|
||||
while (_currentState == "Strolling")
|
||||
{
|
||||
<<<<<<< Updated upstream
|
||||
Debug.Log("strolling");
|
||||
=======
|
||||
>>>>>>> Stashed changes
|
||||
if (!_destinationPointSet)
|
||||
SearchWalkPoint();
|
||||
else
|
||||
|
@ -188,9 +134,4 @@ private IEnumerator Strolling()
|
|||
|
||||
ChangeState();
|
||||
}
|
||||
<<<<<<< Updated upstream
|
||||
=======
|
||||
|
||||
|
||||
>>>>>>> Stashed changes
|
||||
}
|
|
@ -13,18 +13,13 @@ public enum Axel
|
|||
public float acceleration;
|
||||
public float turnAngle;
|
||||
public List<Wheel> wheels;
|
||||
<<<<<<< Updated upstream
|
||||
public float brakeForce = 50.0f;
|
||||
=======
|
||||
|
||||
public float brakeForce;
|
||||
>>>>>>> Stashed changes
|
||||
public bool braking;
|
||||
private float _currentAcceleration;
|
||||
private float _currentTurn;
|
||||
public bool braking;
|
||||
|
||||
|
||||
<<<<<<< Updated upstream
|
||||
|
||||
private void FixedUpdate()
|
||||
{
|
||||
Move();
|
||||
|
@ -32,26 +27,13 @@ private void FixedUpdate()
|
|||
Brake();
|
||||
}
|
||||
|
||||
public void SetInputs(float forwardAmount,float turnAmount)
|
||||
{
|
||||
_currentAcceleration = forwardAmount*acceleration;
|
||||
_currentTurn = turnAmount*turnAngle;
|
||||
}
|
||||
=======
|
||||
private void FixedUpdate()
|
||||
{
|
||||
Brake();
|
||||
Move();
|
||||
Steering();
|
||||
}
|
||||
|
||||
public void SetInputs(float forwardAmount, float turnAmount)
|
||||
{
|
||||
_currentAcceleration = forwardAmount * acceleration;
|
||||
_currentTurn = turnAmount * turnAngle;
|
||||
}
|
||||
|
||||
>>>>>>> Stashed changes
|
||||
|
||||
public void Move()
|
||||
{
|
||||
foreach (var wheel in wheels) wheel.wheelCollider.motorTorque = _currentAcceleration;
|
||||
|
@ -81,9 +63,4 @@ public struct Wheel
|
|||
public WheelCollider wheelCollider;
|
||||
public Axel axel;
|
||||
}
|
||||
<<<<<<< Updated upstream
|
||||
=======
|
||||
|
||||
|
||||
>>>>>>> Stashed changes
|
||||
}
|
|
@ -1,19 +1,8 @@
|
|||
<<<<<<< Updated upstream
|
||||
using System;
|
||||
=======
|
||||
using System.Collections;
|
||||
>>>>>>> Stashed changes
|
||||
using System.Collections;
|
||||
using UnityEngine;
|
||||
|
||||
public class AICar : MonoBehaviour
|
||||
{
|
||||
<<<<<<< Updated upstream
|
||||
private CarController _carController;
|
||||
|
||||
private void Awake()
|
||||
{
|
||||
_carController = GetComponent<CarController>();
|
||||
=======
|
||||
[SerializeField] private Transform carPosition;
|
||||
[SerializeField] private float stoppingDistance;
|
||||
[SerializeField] private float slowingSpeed;
|
||||
|
@ -23,7 +12,7 @@ private void Awake()
|
|||
private string _currentState;
|
||||
private Transform _driveTarget;
|
||||
private string _nextState;
|
||||
|
||||
|
||||
|
||||
private void Awake()
|
||||
{
|
||||
|
@ -48,16 +37,10 @@ private void Awake()
|
|||
_currentState = "Driving";
|
||||
_nextState = _currentState;
|
||||
ChangeState();
|
||||
>>>>>>> Stashed changes
|
||||
}
|
||||
|
||||
private void Update()
|
||||
{
|
||||
<<<<<<< Updated upstream
|
||||
float forwardAmount = 1f;
|
||||
float turnAmount = 1f;
|
||||
_carController.SetInputs(forwardAmount,turnAmount);
|
||||
=======
|
||||
_currentState = _nextState;
|
||||
}
|
||||
|
||||
|
@ -103,14 +86,9 @@ private IEnumerator Driving()
|
|||
else
|
||||
{
|
||||
if (distanceToTarget < reverseDist)
|
||||
{
|
||||
accelerationAmount = -1;
|
||||
}
|
||||
else
|
||||
{
|
||||
accelerationAmount = 1;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
@ -132,6 +110,5 @@ private IEnumerator Driving()
|
|||
_car.SetInputs(accelerationAmount, turnAmount);
|
||||
yield return new WaitForEndOfFrame();
|
||||
}
|
||||
>>>>>>> Stashed changes
|
||||
}
|
||||
}
|
Reference in a new issue