Esempio n. 1
0
 /// <summary>
 /// 检查
 /// </summary>
 public void UpdateBehaviorType(MovingEntity entity, SteeringBehavior.Type_ type)
 {
     if (type == Type)
     {
         return;
     }
     Behavior = SteeringBehavior.Create(entity, type);
 }
Esempio n. 2
0
 // Use this for initialization
 void Start()
 {
     _movingEntity = GetComponent <MovingEntity>();
     if (_movingEntity == null)
     {
         Debug.LogError("Need Script: MovingEntity");
     }
     UpdateState(StateType.Patrol);
 }
Esempio n. 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);
 }
Esempio n. 4
0
 public WallAvoidance(MovingEntity entity) : base(entity, "WallAvoidance", Type_.wall_avoidance)
 {
 }
Esempio n. 5
0
 protected SteeringBehavior(MovingEntity entity, string name, SteeringBehavior.Type_ type)
 {
     _movingEntity = entity;
     BehaviorName  = name;
     Type          = type;
 }
Esempio n. 6
0
 public Wander(MovingEntity entity)
     : base(entity, "Wander", Type_.wander)
 {
 }
Esempio n. 7
0
 public Seek(MovingEntity movingEntity) : base(movingEntity, "Seek", Type_.seek)
 {
 }