Britbot
void Britbot.Group.SetTarget ( ITarget  target) [inline]

Sets the target of the group, while doing so also resets the heading vector if there is need (meaning if we didn't choose the same target again).

Parameters:
targetthe new target

Definition at line 153 of file Group.cs.

        {
            //log it
            Logger.Write(string.Format("Group {0} assinged to {1}", this, target.GetDescription()), true);

            //if it isn't the same target as before update and reset heading
            if (this.Target == null)
            {
                this.Target = target;
                this.Heading.SetCoordinates();
                //tell the target it got assigned
                this.Target.TargetAssignmentEvent();
            }
            else if (this.Target.Equals(target))
            {
                //tell the previous target it was dessigned
                this.Target.TargetDeAssignmentEvent();

                //update
                this.Target = target;
                this.Heading.SetCoordinates();

                //tell new target it got assigned
                this.Target.TargetAssignmentEvent();
            }
        }