Compare commits

..

No commits in common. "7a477817fe7fde28553860ca016b461520f4e24f" and "0cc9ddba16f1ae15297292a9e439b7d1980cba35" have entirely different histories.

2 changed files with 8 additions and 69 deletions

View File

@ -11,7 +11,6 @@ public class NPCAnimationController : MonoBehaviour
public Transform toiletTransform; public Transform toiletTransform;
public Transform dancePlace;
public Transform toiletLookAtTransform;// Die Transform-Position der Toilette public Transform toiletLookAtTransform;// Die Transform-Position der Toilette
private NavMeshAgent agent; private NavMeshAgent agent;
private Animator animator; private Animator animator;
@ -21,22 +20,7 @@ public class NPCAnimationController : MonoBehaviour
agent = GetComponent<NavMeshAgent>(); agent = GetComponent<NavMeshAgent>();
animator = GetComponent<Animator>(); animator = GetComponent<Animator>();
HandCup.SetActive(false); HandCup.SetActive(false);
StartCoroutine(GetToWorkRoutine());
} }
private IEnumerator GetToWorkRoutine()
{
animator.SetLayerWeight(animator.GetLayerIndex("Typing"), 0);
animator.SetTrigger("Walk");
yield return new WaitUntil(() => animator.GetCurrentAnimatorStateInfo(0).IsName("WalkBack"));
MoveTo(workPosition.position);
yield return new WaitUntil(() => agent.remainingDistance <= agent.stoppingDistance);
animator.ResetTrigger("Walk"); // Setze den Lauf-Trigger zurück
animator.SetTrigger("SitDown");
yield return new WaitUntil(() => animator.GetCurrentAnimatorStateInfo(0).IsName("Sit"));
transform.rotation = workPosition.rotation;
yield return StartCoroutine(FadeLayerWeight(animator.GetLayerIndex("Typing"), 1, 1f));
}
private IEnumerator FadeLayerWeight(int layerIndex, float targetWeight, float duration) private IEnumerator FadeLayerWeight(int layerIndex, float targetWeight, float duration)
@ -88,7 +72,7 @@ public class NPCAnimationController : MonoBehaviour
private IEnumerator GoToToiletRoutine() private IEnumerator GoToToiletRoutine()
{ {
yield return StartCoroutine(FadeLayerWeight(animator.GetLayerIndex("Typing"), 0, 1f)); animator.SetLayerWeight(animator.GetLayerIndex("Typing"), 0);
// Beginne mit dem Laufen zur Toilette. // Beginne mit dem Laufen zur Toilette.
animator.SetTrigger("Walk"); animator.SetTrigger("Walk");
yield return new WaitUntil(() => animator.GetCurrentAnimatorStateInfo(0).IsName("Walk")); yield return new WaitUntil(() => animator.GetCurrentAnimatorStateInfo(0).IsName("Walk"));
@ -110,59 +94,19 @@ public class NPCAnimationController : MonoBehaviour
yield return new WaitUntil(() => animator.GetCurrentAnimatorStateInfo(0).IsName("WalkBack")); yield return new WaitUntil(() => animator.GetCurrentAnimatorStateInfo(0).IsName("WalkBack"));
MoveTo(workPosition.position); MoveTo(workPosition.position);
yield return new WaitUntil(() => agent.remainingDistance <= agent.stoppingDistance); yield return new WaitUntil(() => agent.remainingDistance <= agent.stoppingDistance);
transform.rotation = workPosition.rotation;
animator.ResetTrigger("Walk"); // Setze den Lauf-Trigger zurück animator.ResetTrigger("Walk"); // Setze den Lauf-Trigger zurück
animator.SetTrigger("SitDown"); animator.SetTrigger("SitDown");
yield return new WaitUntil(() => animator.GetCurrentAnimatorStateInfo(0).IsName("Sit")); yield return new WaitUntil(() => animator.GetCurrentAnimatorStateInfo(0).IsName("Sit"));
transform.rotation = workPosition.rotation; animator.SetLayerWeight(animator.GetLayerIndex("Typing"), 1);
yield return StartCoroutine(FadeLayerWeight(animator.GetLayerIndex("Typing"), 1, 1f));
} }
// Hier kannst du entscheiden, ob der Charakter wieder sitzt oder steht. // Hier kannst du entscheiden, ob der Charakter wieder sitzt oder steht.
// Beispiel: Setze IsSitting oder IsStanding entsprechend. // Beispiel: Setze IsSitting oder IsStanding entsprechend.
public void GettingMad()
public void AskForMoney()
{ {
StartCoroutine(GettingMadRoutine()); return;
}
private IEnumerator GettingMadRoutine()
{
animator.SetTrigger("GetMad");
yield return StartCoroutine(FadeLayerWeight(animator.GetLayerIndex("Coffee"), 1, 2f)); // 1 Sekunde zum Einblenden
yield return new WaitForSeconds(8f);
yield return StartCoroutine(FadeLayerWeight(animator.GetLayerIndex("Coffee"), 0, 1f)); // 1 Sekunde zum Ausblenden
animator.ResetTrigger("GetMad");
}
public void CaffeinOverdose()
{
StartCoroutine(CaffeinRoutine());
}
private IEnumerator CaffeinRoutine()
{
yield return StartCoroutine(FadeLayerWeight(animator.GetLayerIndex("Typing"), 0, 1f));
// Beginne mit dem Laufen zur Toilette.
animator.SetTrigger("Walk");
yield return new WaitUntil(() => animator.GetCurrentAnimatorStateInfo(0).IsName("Walk"));
MoveTo(dancePlace.position);
yield return new WaitUntil(() => agent.remainingDistance <= agent.stoppingDistance);
animator.ResetTrigger("Walk");
animator.SetTrigger("TooMuchCaffein");
yield return new WaitForSeconds(8f);
animator.ResetTrigger("TooMuchCaffein");
animator.SetTrigger("Walk");
yield return new WaitUntil(() => animator.GetCurrentAnimatorStateInfo(0).IsName("WalkBack"));
MoveTo(workPosition.position);
yield return new WaitUntil(() => agent.remainingDistance <= agent.stoppingDistance);
transform.rotation = workPosition.rotation;
animator.ResetTrigger("Walk"); // Setze den Lauf-Trigger zurück
animator.SetTrigger("SitDown");
yield return new WaitUntil(() => animator.GetCurrentAnimatorStateInfo(0).IsName("Sit"));
yield return StartCoroutine(FadeLayerWeight(animator.GetLayerIndex("Typing"), 1, 1f));
} }
@ -190,12 +134,7 @@ public class NPCAnimationController : MonoBehaviour
// Prüft, ob der Buchstabe 'M' gedrückt wurde // Prüft, ob der Buchstabe 'M' gedrückt wurde
if (Input.GetKeyDown(KeyCode.M)) if (Input.GetKeyDown(KeyCode.M))
{ {
GettingMad(); AskForMoney();
}
// Prüft, ob der Buchstabe 'C' gedrückt wurde
if (Input.GetKeyDown(KeyCode.O))
{
CaffeinOverdose();
} }
} }