public override void Begin(AIStateController controller) { controller.Agent.speed = wanderSpeed; controller.Agent.stoppingDistance = 0f; controller.Agent.angularSpeed = wanderTurnSpeed; WanderDataContainer container = controller.Data.Wander; container.SetStartPosition(controller.transform.position); container.SetWanderTarget(this, controller); ChaseDataContainer chase = controller.Data.Chase; if (chase.ChaseTarget != null) { chase.SetChaseTarget(null); } AttackDataContainer attack = controller.Data.Attack; if (attack.DamageTarget != null) { attack.SetDamageTarget(null); } }
public override void Begin(AIStateController controller) { AttackDataContainer container = controller.Data.Attack; if (container.DamageTarget == null) { container.SetDamageTarget(controller.Data.Chase.ChaseTarget); } controller.Animator.SetInteger("Walk", 0); }
public override void Act(AIStateController controller) { AttackDataContainer container = controller.Data.Attack; if (container.CanAttack) { container.DamageTarget.Damage(new TimedHealthModifier("DogDamage", 0, 10, false, true, true, true)); controller.Learn(experienceGainPerAttack); controller.Animator.SetTrigger("Attack"); container.ResetAttackInterval(AttackTimeInterval); } else { container.UpdateAttackIntervalTime(); } }