public void QueueEvent(CElevatorEvent Event, bool AtFront = false) { if (AtFront) { mEvents.Insert(0, Event); } else { mEvents.Add(Event); } }
public override void SimTick() { base.SimTick(); if (mCurrentEvent == null) { if (mEvents.Count > 0) { mCurrentEvent = mEvents[0]; mEvents.RemoveAt(0); mDoorPosition = 0.0f; if (mCurrentEvent.mType != CElevatorEvent.EType.T_EXIT) { _deliveryTimer = 2.0f; } } } else { if (mCurrentEvent.mType != CElevatorEvent.EType.T_EXIT) { if (_waitingTimer > 0.0f) { _waitingTimer -= CWorld.SECONDS_PER_TICK; if (_waitingTimer <= 0.0f) { _waitingTimer = 0.0f; mDoorPosition = 0.0f; mCurrentEvent = null; } } else { _deliveryTimer -= CWorld.SECONDS_PER_TICK; if (_deliveryTimer <= 0.0f) { mDoorPosition = 1.0f; _deliveryTimer = 0.0f; _waitingTimer = 2.0f; if (mCurrentEvent.mType == CElevatorEvent.EType.T_SPAWN_UNIT) { CResume resume = mWorld.GetEntity <CResume>(mCurrentEvent.mInfo2); if (resume == null) { resume = new CResume(); resume.Generate(mWorld, 0, 1); CUnit unit = mWorld.SpawnUnitAtElevator(this, mCurrentEvent.mInfo1, resume); mWorld.PushMessage("Intern " + unit.mName + " has arrived", 0); } else { CUnit unit = mWorld.SpawnUnitAtElevator(this, mCurrentEvent.mInfo1, resume); mWorld.PushMessage("Employee " + unit.mName + " has arrived", 0); mWorld.DespawnEntity(resume); } } else if (mCurrentEvent.mType == CElevatorEvent.EType.T_DELIVERY) { CPickup pickup = mWorld.SpawnPickup(this, mCurrentEvent.mInfo1, mCurrentEvent.mInfoStr); pickup.mBuildTag = mCurrentEvent.mInfo3; } } } } } }