/// <summary> /// Adds a new checkpoints /// </summary> /// <param name="coords">Coordinates for the checkpoint</param> /// <param name="type">Type of the checkpoint to add</param> protected void AddCheckpoint(Vector3 coords, int type) { ClientCheckpoint checkpoint = new ClientCheckpoint(checkpointId, character.owner.client, coords, type, this.OnEnterCheckpoint, this.OnExitCheckpoint); checkpoints.Add(checkpoint); checkpointId++; }
/// <summary> /// Loads trash from a trash collection point /// </summary> /// <param name="cp">Trash collection point</param> private void LoadTrash(ClientCheckpoint cp) { workVehicle.freezePosition = true; trashLoadTimer.Interval = 5000; trashLoadTimer.Enabled = true; currentCheckPoint = cp; character.SendNotification("Loading trash..."); }
public override void OnEnterCheckpoint(ClientCheckpoint cp, NetHandle e) { // Job complete, unload cargo if (!finished) { this.finished = true; character.PlayFrontendSound("FLIGHT_SCHOOL_LESSON_PASSED", "HUD_AWARDS"); this.character.SetMoney(this.character.money + salary); this.FinishJob(); } }
/// <summary> /// Is ran when trash loading is finished /// </summary> /// <param name="source">Timer</param> /// <param name="args">Timer arguments</param> public void FinishedLoadingTrash(System.Object source, ElapsedEventArgs args) { Timer t = (Timer)source; t.Enabled = false; character.SendNotification("Trash loaded"); this.RemoveCheckpoint(currentCheckPoint); currentCheckPoint = null; workVehicle.freezePosition = false; character.PlayFrontendSound("SELECT", "HUD_LIQUOR_STORE_SOUNDSET"); CheckMissionComplete(); }
/// <summary> /// Is ran when player enters checkpoint /// </summary> /// <param name="cp">Checkpoint entered</param> /// <param name="e">Handle of entered thing, for example vehicle or player</param> public override void OnEnterCheckpoint(ClientCheckpoint cp, NetHandle e) { if (IsPlayerInWorkVehicle()) { if (jobStage == 0) { LoadTrash(cp); } else if (jobStage == 1) { UnloadTrash(); } } }
/// <summary> /// Is triggered when player exits a checkpoint /// </summary> /// <param name="checkpoint">Checkpoint that player(or vehicle) exited</param> /// <param name="handle">Handle of object that exited</param> virtual public void OnExitCheckpoint(ClientCheckpoint checkpoint, NetHandle handle) { }
/// <summary> /// Removes a checkpoint /// </summary> /// <param name="checkpoint">Checkpoint to remove</param> protected void RemoveCheckpoint(ClientCheckpoint checkpoint) { checkpoints.Remove(checkpoint); checkpoint.Destroy(); }
/// <summary> /// Cleans up the job when it ends /// </summary> private void CleanUp() { currentCheckPoint = null; jobStage = 0; }
/// <summary> /// Is ran when player exits checkpoint /// </summary> /// <param name="cp">Checkpoint exited</param> /// <param name="e">Handle of exited thing, for example vehicle or player</param> public override void OnExitCheckpoint(ClientCheckpoint cp, NetHandle e) { }
/// <summary> /// Is triggered when player exits a checkpoint /// </summary> /// <param name="cp">Checkpoint that player(or vehicle) exited</param> /// <param name="e">Handle of object that exited</param> virtual public void OnExitCheckpoint(ClientCheckpoint cp, NetHandle e) { }
/// <summary> /// Removes a checkpoint /// </summary> /// <param name="cp">Checkpoint to remove</param> protected void RemoveCheckpoint(ClientCheckpoint cp) { checkpoints.Remove(cp); cp.Destroy(); }
/// <summary> /// Is ran when player exits checkpoint /// </summary> /// <param name="checkpoint">Checkpoint exited</param> /// <param name="handle">Handle of exited thing, for example vehicle or player</param> public override void OnExitCheckpoint(ClientCheckpoint checkpoint, NetHandle handle) { }