Compare commits
No commits in common. "7a477817fe7fde28553860ca016b461520f4e24f" and "0cc9ddba16f1ae15297292a9e439b7d1980cba35" have entirely different histories.
7a477817fe
...
0cc9ddba16
|
@ -11,7 +11,6 @@ public class NPCAnimationController : MonoBehaviour
|
|||
|
||||
|
||||
public Transform toiletTransform;
|
||||
public Transform dancePlace;
|
||||
public Transform toiletLookAtTransform;// Die Transform-Position der Toilette
|
||||
private NavMeshAgent agent;
|
||||
private Animator animator;
|
||||
|
@ -21,22 +20,7 @@ public class NPCAnimationController : MonoBehaviour
|
|||
agent = GetComponent<NavMeshAgent>();
|
||||
animator = GetComponent<Animator>();
|
||||
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)
|
||||
|
@ -88,7 +72,7 @@ public class NPCAnimationController : MonoBehaviour
|
|||
|
||||
private IEnumerator GoToToiletRoutine()
|
||||
{
|
||||
yield return StartCoroutine(FadeLayerWeight(animator.GetLayerIndex("Typing"), 0, 1f));
|
||||
animator.SetLayerWeight(animator.GetLayerIndex("Typing"), 0);
|
||||
// Beginne mit dem Laufen zur Toilette.
|
||||
animator.SetTrigger("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"));
|
||||
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"));
|
||||
transform.rotation = workPosition.rotation;
|
||||
yield return StartCoroutine(FadeLayerWeight(animator.GetLayerIndex("Typing"), 1, 1f));
|
||||
animator.SetLayerWeight(animator.GetLayerIndex("Typing"), 1);
|
||||
}
|
||||
// Hier kannst du entscheiden, ob der Charakter wieder sitzt oder steht.
|
||||
// Beispiel: Setze IsSitting oder IsStanding entsprechend.
|
||||
|
||||
public void GettingMad()
|
||||
|
||||
public void AskForMoney()
|
||||
{
|
||||
StartCoroutine(GettingMadRoutine());
|
||||
}
|
||||
|
||||
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));
|
||||
|
||||
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
|
@ -190,12 +134,7 @@ public class NPCAnimationController : MonoBehaviour
|
|||
// Prüft, ob der Buchstabe 'M' gedrückt wurde
|
||||
if (Input.GetKeyDown(KeyCode.M))
|
||||
{
|
||||
GettingMad();
|
||||
}
|
||||
// Prüft, ob der Buchstabe 'C' gedrückt wurde
|
||||
if (Input.GetKeyDown(KeyCode.O))
|
||||
{
|
||||
CaffeinOverdose();
|
||||
AskForMoney();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Binary file not shown.
Loading…
Reference in New Issue