public void AddGroup(FlockingGroup group) { if (mGroup == null) { mGroup = Optional <FlockingGroup> .Of(null); } if (mGroup.IsPresent()) { mGroup.Get().RemoveUnit(this); } mGroup = Optional <FlockingGroup> .Of(group); FlockingId = group.FlockingId; }
public void Merge(FlockingGroup other) { // todo: merge two FlockingGroups }
/* * /// <summary> * /// Calculates the direction the unit should be moving and moves it into that direction. * /// </summary> * /// <param name="target">The target to which to move.</param> * protected void MoveToTarget(Vector2 target) * { * Velocity = new Vector2(target.X - AbsolutePosition.X, target.Y - AbsolutePosition.Y); * } */ public void MakePartOf(FlockingGroup group) { mGroup = Optional <FlockingGroup> .Of(group); mSuperiorFlockingId = group.FlockingId; }