/// <summary> /// When a staff member is dropped in one of the Slots for the post /// </summary> /// <param name="sm">The staff member to assign</param> /// <param name="pos">Which slot to assign to</param> public void StaffMemberAssigned(StaffMember sm, int pos) { // add the staff member to the staff list staffList[pos] = sm; Customer[] copy = servingSlots; // update the number of slots available to serve customers in servingSlots[pos] = null; // copy the original values in for (int i = 0; i < copy.Length; i++) { servingSlots[i] = copy[i]; } int index = 0; if (queueType.Equals("Food")) { index = 1; } // add a new thread Thread thr = new Thread(() => StaffThreadMethod(pos, sm.GetAttributeByIndex(index))); // the first parameter is the slot, the second is the speed staffThreads[pos] = thr; // if the day is already running, start the thread if (running) { staffThreads[pos].Start(); } }
public int extrasID; // which extra option was selected // CONSTRUCTOR for the class public SaveableStaff(StaffMember s) { this.index = s.GetIndex(); this.currentJob = s.GetJobID(); this.dayHired = s.GetStartDay(); this.name = s.GetStaffname(); this.attributes = s.GetAttributes(); this.transformID = s.GetTransformID(); Color[] c = s.GetAllColours(); // set colours for (int i = 0; i < 3; i++) { colourArrays[i,0] = c[i].r; colourArrays[i,1] = c[i].g; colourArrays[i,2] = c[i].b; } hairStyleID = s.GetHairID(); extrasID = s.GetExtrasID(); }
/// <summary> /// When a staff member is dragged out of one of the slots for the post /// </summary> /// <param name="sm">The Staff Member to remove</param> /// <param name="pos">The position slot number to remove the staff member from</param> public void StaffMemberRemoved(StaffMember sm, int pos) { try { // clear the staff list at pos staffList[pos] = null; // clear the thread list at pos if (staffThreads[pos] != null && staffThreads[pos].IsAlive) { staffThreads[pos].Abort(); } staffThreads[pos] = null; // possibly put customer back to queue (if someone in serving slots) if (servingSlots[pos] != null) { servingSlots[pos].inQueue = true; theQueue.Insert(0, servingSlots[pos]); servingSlots[pos] = new Customer(null, -1, null, null, null); // move customer back into queue theQueue[0].transform.position = new UnityEngine.Vector3(queuePosX, queuePosY, 0); // move queue back for (int i = 1; i < theQueue.Count; i++) { theQueue[i].transform.Translate(0, -0.8f, 0); theQueue[i].transform.GetComponent<SpriteRenderer>().sortingOrder++; } } } catch (Exception) { } }