Beispiel #1
0
 /// <summary>
 /// 检查
 /// </summary>
 public void UpdateBehaviorType(MovingEntity entity, SteeringBehavior.Type_ type)
 {
     if (type == Type)
     {
         return;
     }
     Behavior = SteeringBehavior.Create(entity, type);
 }
Beispiel #2
0
 // Use this for initialization
 void Start()
 {
     _movingEntity = GetComponent <MovingEntity>();
     if (_movingEntity == null)
     {
         Debug.LogError("Need Script: MovingEntity");
     }
     UpdateState(StateType.Patrol);
 }
Beispiel #3
0
 /// <summary>
 /// 工厂方法
 /// </summary>
 /// <param name="entity"></param>
 /// <param name="type"></param>
 /// <returns></returns>
 public static SteeringBehavior Create(MovingEntity entity, SteeringBehavior.Type_ type)
 {
     if (type == Type_.seek)
     {
         return(new Seek(entity));
     }
     else if (type == Type_.wall_avoidance)
     {
         return(new WallAvoidance(entity));
     }
     else if (type == Type_.wander)
     {
         return(new Wander(entity));
     }
     return(null);
 }
Beispiel #4
0
 public WallAvoidance(MovingEntity entity) : base(entity, "WallAvoidance", Type_.wall_avoidance)
 {
 }
Beispiel #5
0
 protected SteeringBehavior(MovingEntity entity, string name, SteeringBehavior.Type_ type)
 {
     _movingEntity = entity;
     BehaviorName  = name;
     Type          = type;
 }
Beispiel #6
0
 public Wander(MovingEntity entity)
     : base(entity, "Wander", Type_.wander)
 {
 }
Beispiel #7
0
 public Seek(MovingEntity movingEntity) : base(movingEntity, "Seek", Type_.seek)
 {
 }