Commit 592a96cd authored by bennet's avatar bennet
Browse files
parents 9e6bb52c 7230b287
......@@ -56,7 +56,7 @@ CapsuleCollider:
m_Material: {fileID: 0}
m_IsTrigger: 0
m_Enabled: 1
m_Radius: 1
m_Radius: 1.2
m_Height: 3.7
m_Direction: 1
m_Center: {x: -0, y: 1.9, z: -0}
......
......@@ -15,6 +15,9 @@ public class CustomerBehaviour : MonoBehaviour
[SerializeField] private float orderPopUpTime = 5;
[SerializeField] private float waitingTime = 90;
private bool _percOne = false;
private bool _percTwo = false;
private bool _percThree = false;
private GameObject _cameraObject;
private NavMeshAgent _agent;
......@@ -100,6 +103,25 @@ public class CustomerBehaviour : MonoBehaviour
_state = CustomerState.Leaving;
}
if (_customerBar.getPercentage() >= 0.25 && !_percOne)
{
StartCoroutine(OrderAgain(orderPopUpTime));
_percOne = true;
}
if (_customerBar.getPercentage() >= 0.50 && !_percTwo)
{
StartCoroutine(OrderAgain(orderPopUpTime));
_percTwo = true;
}
if (_customerBar.getPercentage() >= 0.75 && !_percThree)
{
StartCoroutine(OrderAgain(orderPopUpTime));
_percThree = true;
}
_playerActor.gameObject.transform.LookAt(_playerActor.gameObject.transform.position + _agent.velocity);
Vector3 trans = _customerBar.transform.position;
......@@ -107,16 +129,27 @@ public class CustomerBehaviour : MonoBehaviour
_orderPopUp.transform.LookAt(_cameraObject.transform);
}
private IEnumerator OrderAndWait(float orderDuration)
private IEnumerator OrderAgain(float orderDuration)
{
//_customerBar.gameObject.SetActive(false);
_orderPopUp.SetActive(true);
yield return new WaitForSeconds(orderDuration);
_orderPopUp.SetActive(false);
//_customerBar.gameObject.SetActive(true);
_state = CustomerState.Random;
}
private IEnumerator OrderAndWait(float orderDuration)
{
_orderPopUp.SetActive(true);
yield return new WaitForSeconds(orderDuration);
_orderPopUp.SetActive(false);
_customerBar.gameObject.SetActive(true);
_customerBar.initializeBar(90f);
_customerBar.initializeBar(90f);
_state = CustomerState.Random;
......@@ -175,17 +208,18 @@ public class CustomerBehaviour : MonoBehaviour
_agent.SetDestination(transform.parent.position);
_customerBar.gameObject.SetActive(false);
_state = CustomerState.Leaving;
Destroy(other.gameObject);
}
else
{
// Wrong Beer
_playerActor.AudioSource.PlayOneShot(_customerSounds.GetHappyClip(), 0.2f);
_customerBar.addPercentageOfSlider(-0.3f);
Destroy(other.gameObject);
}
}
}else if (other.collider.gameObject.CompareTag("Projectile"))
Destroy(other.gameObject);
}
else if (other.collider.gameObject.CompareTag("Projectile"))
{
_playerActor.AudioSource.PlayOneShot(_customerSounds.GetSadClip(), 0.2f);
_customerBar.addPercentageOfSlider(0.3f);
......
......@@ -45,7 +45,7 @@ public class PlayerBazookaAiming : MonoBehaviour
_playerActor.LineRenderer.SetPosition(0, bazookaPos);
List<Vector3> bezierCurve;
if (Physics.Raycast(aimRay, out RaycastHit raycastHit, 0, LayerMask.GetMask("Environment")) && raycastHit.distance <= dashSize)
if (Physics.Raycast(aimRay, out RaycastHit raycastHit, 0, LayerMask.GetMask("Environment", "Customer")) && raycastHit.distance <= dashSize)
{
Vector3 pos2 = bazookaPos + (raycastHit.point - bazookaPos) / 2;
......
......@@ -77,7 +77,7 @@ public class PlayerInputSystemManager : MonoBehaviour, IInputManager
return false;
if (GetGamePadCount() >= playerNumber)
result = _gamepads[playerNumber - 1].xButton.isPressed;
result = _gamepads[playerNumber - 1].leftTrigger.isPressed;
if (GetGamePadCount() == 0)
result = Keyboard.current.spaceKey.isPressed;
......@@ -94,10 +94,10 @@ public class PlayerInputSystemManager : MonoBehaviour, IInputManager
return false;
if (GetGamePadCount() >= playerNumber)
result = _gamepads[playerNumber - 1].rightTrigger.wasPressedThisFrame || _gamepads[playerNumber - 1].leftTrigger.wasPressedThisFrame;
result = _gamepads[playerNumber - 1].rightTrigger.isPressed;
if (GetGamePadCount() == 0)
result = Keyboard.current.fKey.wasPressedThisFrame;
result = Keyboard.current.fKey.isPressed;
return result;
}
......
......@@ -27,7 +27,7 @@ public class PlayerRotate : MonoBehaviour
if (_playerActor.PlayerMovement != null)
{
if (_playerActor.PlayerMovement.MoveDirection.sqrMagnitude > 0.1)
if (_playerActor.PlayerMovement.MoveDirection.sqrMagnitude > 0)
direction = _playerActor.PlayerMovement.MoveDirection.normalized;
if (!_playerActor.PlayerMovement.MoveDirection.Equals(Vector3.zero))
......
......@@ -70,5 +70,10 @@ public class CustomerBar : MonoBehaviour
{
return (customerSlider.value >= 100);
}
public float getPercentage()
{
return _currentTime / durationTime;
}
}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment