AnimalBeginAttacking Method |
Method used to command your creature to start attacking another creature. You can only attack one creature per round, and a single call to BeginAttacking will only attack a target creature in the upcoming tick. Calling BeginAttacking multiple times in the same turn will only result in your creature attacking the target specified in the last call to BeginAttacking.
Attacking is asynchronous so you'll need to handle the AttackCompleted event in order to get the status of your attack. A single attack might not kill a target enemy so you should detect if the enemy is still alive and call BeginAttacking once per round until the target creature is either dead or has escaped.
Namespace: Terrarium.Sdk.Classes.Creature
Exception | Condition |
---|---|
ArgumentNullException | Thrown if the targetAnimal parameter is null. |
NotHungryException | Thrown if the creature is not hungry enough to attack. |