although my debug writes that the right animator is loaded it doesn’t change in the inspector nor do the right animations change…
here’s the piece of code i use:
public void Update()
{
health.health = health.MonitorHealth();
switch(daySchedule.action.currentAction)
{
case CurrentAction.Idle:
health.fatigue.CurrentValue += Time.deltaTime*0.5f/WorldClock._oneHour;
health.hunger.CurrentValue += Time.deltaTime*0.5f/WorldClock._oneHour;
health.strength.CurrentValue -= Time.deltaTime*0.5f/WorldClock._oneHour;
if(anim != null)
anim.runtimeAnimatorController = (RuntimeAnimatorController)RuntimeAnimatorController.Instantiate(Resources.Load("AnimCtrls/TheKidIdles"));//, typeof(RuntimeAnimatorController))as AnimatorOverrideController;
break;
case CurrentAction.Sleeping:
health.fatigue.CurrentValue -= Time.deltaTime*1f/WorldClock._oneHour;
health.hunger.CurrentValue += Time.deltaTime*0.5f/WorldClock._oneHour;
health.strength.CurrentValue += Time.deltaTime*0.5f/WorldClock._oneHour;
if(anim != null)
anim.runtimeAnimatorController = Resources.Load<RuntimeAnimatorController>("AnimCtrls/TheKidSleeps");//, typeof(RuntimeAnimatorController))as AnimatorOverrideController;
break;
case CurrentAction.Eating:
health.fatigue.CurrentValue += Time.deltaTime*0.5f/WorldClock._oneHour;
health.hunger.CurrentValue -= Time.deltaTime*1f/WorldClock._oneHour;
health.strength.CurrentValue += Time.deltaTime*0.5f/WorldClock._oneHour;
if(anim != null)
anim.runtimeAnimatorController = Resources.Load<RuntimeAnimatorController>("AnimCtrls/TheKidEats");
break;
case CurrentAction.Working:
health.fatigue.CurrentValue += Time.deltaTime*0.5f/WorldClock._oneHour;
health.hunger.CurrentValue += Time.deltaTime*0.5f/WorldClock._oneHour;
health.strength.CurrentValue += Time.deltaTime*1f/WorldClock._oneHour;
if(anim != null)
anim.runtimeAnimatorController = Resources.Load<RuntimeAnimatorController>("AnimCtrls/TheKidWorks");
break;
}
health.fatigue.Leveling();
health.hunger.Leveling();
health.strength.Leveling();
daySchedule.DoDaySchedule();
if(anim != null)
Debug.Log(anim.runtimeAnimatorController);
}