Commit 6e79b7c9 authored by Tobias's avatar Tobias
Browse files

Player Sounds

parent e5332406
fileFormatVersion: 2
guid: 74fd32b8a82a08841abd27b278fdf4b0
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
......@@ -2,6 +2,7 @@
using System.Collections;
using System.Collections.Generic;
using Scripts.Brewing;
using Scripts.Customer;
using UnityAtoms;
using UnityEditor;
using UnityEngine;
......@@ -19,6 +20,7 @@ public class CustomerBehaviour : MonoBehaviour
private NavMeshAgent _agent;
private Order _customerOrder;
private CustomerBar _customerBar;
private CustomerSounds _customerSounds;
private PlayerActor _playerActor;
......@@ -57,8 +59,8 @@ public class CustomerBehaviour : MonoBehaviour
_orderPopUp = Instantiate(_customerOrder.OrderPopup, transform);
_orderPopUp.gameObject.SetActive(false);
_playerActor = GetComponentInChildren<PlayerActor>();
_playerActor.CollisionEnterEvent += OnCollisionEnterEvent;
_customerSounds = GetComponent<CustomerSounds>();
}
// Update is called once per frame
......@@ -92,6 +94,7 @@ public class CustomerBehaviour : MonoBehaviour
// TODO: Clean Debug
print("I waited too long!!!11!elf");
_playerActor.AudioSource.PlayOneShot(_customerSounds.GetAngryClip(), 0.2f);
_agent.SetDestination(transform.parent.position);
_customerBar.gameObject.SetActive(false);
_state = CustomerState.Leaving;
......@@ -151,22 +154,23 @@ public class CustomerBehaviour : MonoBehaviour
{
// Correct Beer
float percentage = 100 - _customerBar.CustomerSlider.value;
if (percentage > 50)
if (percentage > 10)
{
// 3 Likes
score.Value += 3;
// 1 Like
score.Value += 1;
}
else if (percentage > 30)
if (percentage > 30)
{
// 2 Likes
score.Value += 2;
score.Value += 1;
}
else if (percentage > 10)
{
// 1 Like
// 3 Likes
score.Value += 1;
}
_playerActor.AudioSource.PlayOneShot(_customerSounds.GetBurpClip(), 0.2f);
_gotServed = true;
_agent.SetDestination(transform.parent.position);
_customerBar.gameObject.SetActive(false);
......@@ -176,7 +180,8 @@ public class CustomerBehaviour : MonoBehaviour
else
{
// Wrong Beer
_customerBar.addPercentageOfSlider(0.3f);
_playerActor.AudioSource.PlayOneShot(_customerSounds.GetHappyClip(), 0.2f);
_customerBar.addPercentageOfSlider(-0.3f);
}
}
}
......
fileFormatVersion: 2
guid: 938fe1540aa4aac42981219f8e6e8caf
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
fileFormatVersion: 2
guid: bc3f13c3a929b244eb70dfac58545015
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
Supports Markdown
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