/// <summary> /// Updates the creature behaviour. /// </summary> public override void Update() { if (OwningCreatureAI.reachedEndOfPath && !IsDone && OwningCreatureAI.CreatureStats.IsDrinkFull()) { OwningCreatureAI.SetAnimation("Idle"); Done(); } else if (!IsDone) { if (DrinkTimer >= 1) { if (OwningCreatureAI.GetCurrentAnimation().AnimationName != "Extracting") { OwningCreatureAI.SetAnimation("Extracting"); } OwningCreatureAI.CreatureStats.AddDrink(10); DrinkTimer = 0; } else { DrinkTimer += Time.deltaTime; } } }
/// <summary> /// Updates the creature behaviour. /// </summary> public override void Update() { if (OwningCreatureAI.GetCurrentAnimation().AnimationName != "Moving") { OwningCreatureAI.SetAnimation("Moving"); } if (OwningCreatureAI.reachedEndOfPath && !IsDone) { Done(); } }
/// <summary> /// Updates the creature behaviour. /// </summary> public override void Update() { if (OwningCreatureAI.reachedEndOfPath && !IsDone && (m_CurrentResourceSource == null || IsInventoryFull())) { if (m_CurrentResourceSource != null) { m_CurrentResourceSource.m_WorkedByVillager = null; } Done(); } else if (OwningCreatureAI.reachedEndOfPath && !IsDone && (m_CurrentResourceSource != null && !IsInventoryFull())) { if (OwningCreatureAI.GetCurrentAnimation().AnimationName != "Extracting") { OwningCreatureAI.SetAnimation("Extracting"); } if (ExtractTimer >= 1) { if (m_CurrentResourceSource != null) { if (m_CurrentResourceSource.ExtractResource(1).Value != 0) { ((VillagerAI)OwningCreatureAI).GetVillagerStats().VillagerInventory.AddResource(m_TargetResourceType, 1); PlanetDatalayer.Instance.GetManager <FoMManager>().IncreaseFoM(PlanetDatalayer.Instance.GetManager <VillagerManager>().m_VillagerList.IndexOf((VillagerAI)OwningCreatureAI), 1); ExtractTimer = 0; } } } else { ExtractTimer += Time.deltaTime; } } else { List <ResourceSource> rs = PlanetDatalayer.Instance.GetManager <ResourceManager>().GetResourceSourcesInArea(new Rect(OwningCreatureAI.transform.position.x - 2, OwningCreatureAI.transform.position.z - 2, 4, 4), m_TargetResourceType); if (rs.Count > 0) { m_CurrentResourceSource = rs[0]; } } }
/// <summary> /// Updates the creature behaviour. /// </summary> public override void Update() { m_Timer += Time.deltaTime; if (OwningCreatureAI.GetCurrentAnimation().AnimationName != "Moving") { OwningCreatureAI.SetAnimation("Moving"); } if (OwningCreatureAI.reachedEndOfPath && !IsDone) { Done(); } // if you didnt move more than 2 units in the last 10sec then you are probably stuck, so just call done if (m_Timer >= 10) { if ((m_StartPos - OwningCreatureAI.position).magnitude < 2f) { Done(); } } }