private void PedVariation(CutEvent e) { var args = e.EventArgs as CutObjectVariationEventArgs; if (args == null) { return; } var oe = e as CutObjectIdEvent; if (oe == null) { return; } CutsceneObject cso = null; SceneObjects.TryGetValue(oe.iObjectId, out cso); if (cso?.Ped != null) { int comp = args.iComponent; int drbl = args.iDrawable; int texx = args.iTexture; Task.Run(() => { cso.Ped.SetComponentDrawable(comp, drbl, 0, texx, GameFileCache); }); } }
internal static void CallRPC(int id, byte rpcID, NetIncomingMessage message) { NetworkedSceneObject sceneObject; if (SceneObjects.TryGetValue(id, out sceneObject)) { Action <NetIncomingMessage> processor; if (sceneObject._rpcProcessors.TryGetValue(rpcID, out processor)) { if (processor != null) { processor(message); } else { Debug.LogWarning(sceneObject._net, "RPC processor for {0} was null. Automatically cleaning up. Please be sure to clean up after yourself in the future.", rpcID); sceneObject._rpcProcessors.Remove(rpcID); } } else { Debug.LogWarning(sceneObject._net, "NetworkedSceneObject on {0}: unhandled RPC {1}", id, rpcID); } } }
private void EnableHideObject(CutEvent e) { var oe = e as CutObjectIdEvent; if (oe == null) { return; } CutsceneObject cso = null; SceneObjects.TryGetValue(oe.iObjectId, out cso); if (cso != null) { cso.Enabled = true; } }
private void CameraCut(CutEvent e) { var args = e.EventArgs as CutCameraCutEventArgs; if (args == null) { return; } var oe = e as CutObjectIdEvent; if (oe == null) { return; } CutsceneObject obj = null; SceneObjects.TryGetValue(oe.iObjectId, out obj); if (obj == null) { return; } var pos = Position; var rot = Rotation * Quaternion.RotationAxis(Vector3.UnitX, 1.57079632679f); obj.Position = pos + rot.Multiply(args.vPosition); obj.Rotation = rot * args.vRotationQuaternion; CameraNearClip = (args.fNearDrawDistance > 0) ? Math.Min(args.fNearDrawDistance, 0.5f) : 0.5f; CameraFarClip = (args.fFarDrawDistance > 0) ? Math.Max(args.fFarDrawDistance, 1000.0f) : 12000.0f; CameraClipUpdate = true; CameraObject = obj; }
private void UnloadModels(CutEvent e) { var args = e.EventArgs as CutObjectIdListEventArgs; if (args == null) { return; } if (args.iObjectIdList == null) { return; } foreach (var objid in args.iObjectIdList) { CutsceneObject obj = null; SceneObjects.TryGetValue(objid, out obj); if (obj != null) { obj.Enabled = false; } } }