public CFibreReg SpawnUnit(CFibre Fibre, int ArgCount) { if (ArgCount == 6) { int ownerId = (int)Fibre.mLocal.mStore[Fibre.mFramePtr + 0].mNumber; float posX = (float)Fibre.mLocal.mStore[Fibre.mFramePtr + 1].mNumber; float posY = (float)Fibre.mLocal.mStore[Fibre.mFramePtr + 2].mNumber; int rot = (int)Fibre.mLocal.mStore[Fibre.mFramePtr + 3].mNumber; int tier = (int)Fibre.mLocal.mStore[Fibre.mFramePtr + 4].mNumber; int level = (int)Fibre.mLocal.mStore[Fibre.mFramePtr + 5].mNumber; CResume resume = new CResume(); resume.Generate(_world, tier, level); CUnit entity = _world.SpawnUnit(ownerId, resume, new Vector2(posX, posY), rot); return(new CFibreReg(entity.mID)); } throw new CFibreRuntimeException("unit_spawn does not take " + ArgCount + " parameters.", Fibre); }
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; } } } } } }