Package cn.nukkit.entity.ai.executor
Class FlatRandomRoamExecutor
java.lang.Object
cn.nukkit.entity.ai.executor.FlatRandomRoamExecutor
- All Implemented Interfaces:
EntityControl
,IBehaviorExecutor
@PowerNukkitXOnly
@Since("1.6.0.0-PNX")
public class FlatRandomRoamExecutor
extends Object
implements EntityControl, IBehaviorExecutor
-
Field Summary
Modifier and TypeFieldDescriptionprotected boolean
protected boolean
protected int
protected int
protected int
protected int
protected int
protected int
protected float
-
Constructor Summary
ConstructorDescriptionFlatRandomRoamExecutor
(float speed, int maxRoamRange, int frequency) FlatRandomRoamExecutor
(float speed, int maxRoamRange, int frequency, boolean calNextTargetImmediately, int runningTime) FlatRandomRoamExecutor
(float speed, int maxRoamRange, int frequency, boolean calNextTargetImmediately, int runningTime, boolean avoidWater, int maxRetryTime) -
Method Summary
Modifier and TypeMethodDescriptionboolean
execute
(EntityIntelligent entity) 调度器将会持续执行此执行器,直到返回false,或者执行器被中断
此方法每gt都会调用protected boolean
needUpdateTarget
(EntityIntelligent entity) protected Vector3
next
(EntityIntelligent entity) void
onInterrupt
(EntityIntelligent entity) 行为非正常中断时(例如被更高级行为覆盖)调用void
onStop
(EntityIntelligent entity) 行为正常结束时(execute()方法返回false)调用protected void
stop
(EntityIntelligent entity) Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface cn.nukkit.entity.ai.executor.EntityControl
removeLookTarget, removeRouteTarget, setLookTarget, setRouteTarget
Methods inherited from interface cn.nukkit.entity.ai.executor.IBehaviorExecutor
onStart
-
Field Details
-
speed
protected float speed -
maxRoamRange
protected int maxRoamRange -
frequency
protected int frequency -
currentTargetCalTick
protected int currentTargetCalTick -
durationTick
protected int durationTick -
calNextTargetImmediately
protected boolean calNextTargetImmediately -
runningTime
protected int runningTime -
avoidWater
protected boolean avoidWater -
maxRetryTime
protected int maxRetryTime
-
-
Constructor Details
-
FlatRandomRoamExecutor
public FlatRandomRoamExecutor(float speed, int maxRoamRange, int frequency) -
FlatRandomRoamExecutor
public FlatRandomRoamExecutor(float speed, int maxRoamRange, int frequency, boolean calNextTargetImmediately, int runningTime) -
FlatRandomRoamExecutor
public FlatRandomRoamExecutor(float speed, int maxRoamRange, int frequency, boolean calNextTargetImmediately, int runningTime, boolean avoidWater, int maxRetryTime)
-
-
Method Details
-
execute
Description copied from interface:IBehaviorExecutor
调度器将会持续执行此执行器,直到返回false,或者执行器被中断
此方法每gt都会调用- Specified by:
execute
in interfaceIBehaviorExecutor
- Parameters:
entity
- 执行目标实体- Returns:
- boolean
-
onInterrupt
Description copied from interface:IBehaviorExecutor
行为非正常中断时(例如被更高级行为覆盖)调用- Specified by:
onInterrupt
in interfaceIBehaviorExecutor
- Parameters:
entity
- 目标实体
-
onStop
Description copied from interface:IBehaviorExecutor
行为正常结束时(execute()方法返回false)调用- Specified by:
onStop
in interfaceIBehaviorExecutor
- Parameters:
entity
- 目标实体
-
stop
-
needUpdateTarget
-
next
-