/// <summary> /// Occupy slot for role first gets a slot number based on a role, then occupies the slot /// </summary> /// <param name="aOccupant">The new occupant</param> /// <param name="aRole">The role to occupy</param> /// <returns>true if a slot was occupied successfully, false otherwise</returns> public bool OccupySlotForRole(GameObject aOccupant, FireTeamRole aRole) { return OccupySlot(aOccupant, GetSlotForRole(aRole)); }
/// <summary> /// Get slot for role converts from a FireTeamRole to a slot number, which is returned /// </summary> /// <param name="aRole">The FireTeamRole (rifleman, leader, automatic) to assume</param> /// <returns>The position of the specified fireteam role. For rifleman, this is the first open rifleman position</returns> public int GetSlotForRole(FireTeamRole aRole) { //In the fire team, the following always hold regardless of formation type: // Rifleman 2 = 0 // Leader = 1 // Automatic = 2 // Rifleman 1 = 3 if (aRole == FireTeamRole.Leader) return 1; if (aRole == FireTeamRole.Automatic) return 2; if (aRole == FireTeamRole.Rifleman) { if (!IsOccupied(3)) return 3; if (!IsOccupied(0)) return 0; } return -1; }