public bool AddCharacter(GameObject character) { int occupiedSlots = slotAssignments.Count; if (!pattern.SupportsSlots(occupiedSlots + 1)) { return(false); } SlotAssignment sa = new SlotAssignment(); sa.character = character; slotAssignments.Add(sa); UpdateSlotAssignments(); return(true); }
public bool AddCharacter(AgentNPC character) { int occupiedSlots = slotAssignments.Count; if (!pattern.SupportsSlots(occupiedSlots + 1) || character == pattern.leader) { // Debug.Log ("NOT Added " + character.name); return(false); } SlotAssignment sa = new SlotAssignment(); sa.character = character; slotAssignments.Add(sa); UpdateSlotAssignments(); // Debug.Log ("Added " + character.name); return(true); }
// Add a new Unit to the first available slot, returns false if there are no free slots public bool AddUnit(Unit Unit) { // Find out how many slots we have occupied int OccupiedSlots = Slots.Count; // Check if the pattern supports more slots if (Pattern.SupportsSlots(OccupiedSlots + 1)) { // Add a new slot Slot NewSlot = new Slot(); NewSlot.Unit = Unit; Slots.Add(NewSlot); // Update the slots assignments Pattern.NumberOfSlots++; UpdateSlotAssignments(); return(true); } return(false); }