public void EvadeOff() { if (On(behavior_type.evade)) { flags ^= behavior_type.evade; } }
public void ArriveOff() { if (On(behavior_type.arrive)) { flags ^= behavior_type.arrive; } }
public void PursuitOff() { if (On(behavior_type.pursuit)) { flags ^= behavior_type.pursuit; } }
public void FleeOff() { if (On(behavior_type.flee)) { flags ^= behavior_type.flee; } }
public void SeekOff() { if (On(behavior_type.seek)) { flags ^= behavior_type.seek; } }
public void WanderOff() { if (On(behavior_type.wander)) { flags ^= behavior_type.wander; } }
public SteeringBehavior(Vehicle vehicle) { this.vehicle = vehicle; this.flags = behavior_type.none; this.TargetAgent1 = null; //this.targetAgent2 = null; this.target = Vector2.Empty; //stuff for the wander behavior double theta = random.NextDouble() * 2.0 * Math.PI; //create a vector to a target position on the wander circle wanderTarget = new Vector2((float)(wanderRadius * Math.Cos(theta)), (float)(wanderRadius * Math.Sin(theta))); }
public void WanderOn() { flags |= behavior_type.wander; }
bool On(behavior_type bt) { return((flags & (int)bt) == (int)bt); }
public void PursuitOn() { flags |= behavior_type.pursuit; }
public void ArriveOn() { flags |= behavior_type.arrive; }
public void SeekOn() { flags |= behavior_type.seek; }
public void FleeOn() { flags |= behavior_type.flee; }
bool On(behavior_type bt) { return((flags & bt) == bt); }
//this function tests if a specific bit of m_iFlags is set private bool On(behavior_type bt) { return (m_iFlags & (int)bt) == (int)bt; }
//检测某个属性是否开启 private bool On(behavior_type type) { return ((m_flags & (int)type) == (int)type); }
public void EvadeOn() { flags |= behavior_type.evade; }
bool On(behavior_type type) { return((m_iFlags & ((int)type)) == (int)type); }