/// <summary> /// Use this to assign a leader to this follower. /// </summary> /// <param name="leader"></param> /// <returns></returns> public bool AssignLeader(FormationLeader leader) { Assert.IsNotNull(leader); Leader = leader; var i = Leader.RegisterFollower(this); if (i >= 0) { PositionIndex = i; Leader = leader; return(true); } return(false); }
/// <summary> /// /// </summary> /// <param name="leader"></param> /// <returns></returns> public void RemoveLeader(FormationLeader leader) { Assert.IsNotNull(leader); if (Leader != leader) { throw new UnityException(leader.name + " is not the current FormationLeader of " + name); } if (Leader.UnregisterFollower(this)) { Leader = null; PositionIndex = -1; } else { throw new UnityException("There was an error removing " + name + " as a follower of " + leader.name); } }