private void OnEnable() { if (cameras.ContainsKey(securityCameraChannel) == false) { cameras.Add(securityCameraChannel, new List <SecurityCamera> { this }); return; } cameras[securityCameraChannel].Add(this); cameraActive = !wiresCut; if (CustomNetworkManager.IsServer) { //Make sure new lights are set correctly for newly built cameras if (lightOn != GlobalLightStatus) { ToggleLight(GlobalLightStatus); } apcPoweredDevice.OrNull()?.OnStateChangeEvent.AddListener(PowerStateChanged); integrity.OnWillDestroyServer.AddListener(OnCameraDestruction); if (motionSensingCamera) { UpdateManager.Add(MotionSensingUpdate, 1f); } } }
private void SyncOnFire(bool wasOnFire, bool onFire) { EnsureInit(); //do nothing if this can't burn if (!Resistances.Flammable) { return; } this.onFire = onFire; if (this.onFire) { if (CustomNetworkManager.IsServer) { UpdateManager.Add(PeriodicUpdateBurn, BURN_RATE); } burningObjectOverlay.Burn(); } else { if (CustomNetworkManager.IsServer) { UpdateManager.Remove(CallbackType.PERIODIC_UPDATE, PeriodicUpdateBurn); } burningObjectOverlay.StopBurning(); } }
/// <summary> /// Uses one charge from the emag, returns true if successful /// </summary> public bool UseCharge(HandApply interaction) { Chat.AddActionMsgToChat(interaction, $"You wave the Emag over the {interaction.TargetObject.ExpensiveName()}'s electrical panel.", $"{interaction.Performer.ExpensiveName()} waves something over the {interaction.TargetObject.ExpensiveName()}'s electrical panel."); if (Charges > 0) { //if this is the first charge taken off, add recharge loop if (Charges >= startCharges) { UpdateManager.Add(RegenerateCharge, rechargeTimeInSeconds); } SyncCharges(Charges, Charges - 1); if (Charges > 0) { spriteHandler.ChangeSprite(ScaleChargesToSpriteIndex()); } else { _ = SoundManager.PlayNetworkedForPlayer(recipient: interaction.Performer, OutOfChargesSFXA, sourceObj: gameObject); spriteHandler.Empty(); } return(true); } return(false); }
private void OnEnable() { if (CustomNetworkManager.IsServer) { UpdateManager.Add(CallbackType.UPDATE, UpdateRadiationOutput); } }
private void ToggleOn() { UpdateManager.Add(CallbackType.UPDATE, UpdateMe); electricalNodeControl.TurnOnSupply(); baseSpriteHandler.ChangeSprite((int)SpriteState.On); isOn = true; }
private void OnEnable() { if (Application.isPlaying) { UpdateManager.Add(CallbackType.UPDATE, UpdateMe); } }
private void OnEnable() { if (CustomNetworkManager.IsServer) { UpdateManager.Add(ServerPeriodicUpdate, timeCheckDiskLocation); } }
private void OnEnable() { if (CustomNetworkManager.IsServer) { UpdateManager.Add(CallbackType.UPDATE, ServerUpdateMe); } }
/// <summary>Construct the logo</summary> public XenLogo(UpdateManager updateManager) { if (updateManager == null) throw new ArgumentNullException(); content = new ContentLoader(Application.GetApplicationInstance().Services); this.clearBackground = true; //setup the system and drawer this.particles = new Xen.Ex.Graphics.ParticleSystem(updateManager); this.particleDrawer = new VelocityBillboardParticles2DElement(this.particles, false, 0.025f); //align it... this.particleDrawer.VerticalAlignment = Xen.Ex.Graphics2D.VerticalAlignment.Centre; this.particleDrawer.HorizontalAlignment = Xen.Ex.Graphics2D.HorizontalAlignment.Centre; //clear background is optional. this.clear = new Xen.Graphics.Modifier.ClearBufferModifier(Microsoft.Xna.Framework.Graphics.ClearOptions.Target); this.clear.ClearColour = new Microsoft.Xna.Framework.Color(); //load the data straight from the assembly. this.particles.ParticleSystemData = content.Load<Xen.Ex.Graphics.Content.ParticleSystemData>("Logo"); this.particleTrigger = this.particles.GetTriggerByName("Fire"); updateManager.Add(this); }
public void OnStateChange(ShuttleConsoleState newState) { if (newState == ShuttleConsoleState.Off) { SetSafetyProtocols(true); UpdateManager.Remove(CallbackType.PERIODIC_UPDATE, UpdateMe); ClearScreen(); return; } if (newState == ShuttleConsoleState.Normal) { AddRadarItems(); //Important: set values from server using SetValue and not Value Rulers.SetValueServer(rulersColor); RadarScanRay.SetValueServer(rayColor); Crosshair.SetValueServer(crosshairColor); SetSafetyProtocols(true); } else if (newState == ShuttleConsoleState.Emagged) { AddRadarItems(true); //Repaint radar to evil colours Rulers.SetValueServer(HSVUtil.ChangeColorHue(rulersColor, -80)); RadarScanRay.SetValueServer(HSVUtil.ChangeColorHue(rayColor, -80)); Crosshair.SetValueServer(HSVUtil.ChangeColorHue(crosshairColor, -80)); SetSafetyProtocols(false); } UpdateManager.Add(UpdateMe, 1f); OffOverlay.SetValueServer(Color.clear); }
void OnEnable() { displaySettings.SettingsChanged += DisplaySettings_SettingsChanged; SceneManager.activeSceneChanged += SceneManager_activeSceneChanged; UpdatePixelPerfectCamera(); UpdateManager.Add(CallbackType.UPDATE, UpdateMe); }
void OnEnable() { if (CustomNetworkManager.IsServer) { UpdateManager.Add(ServerPeriodicUpdate, tickRate); } }
public void OnEnable() { if (CustomNetworkManager.IsServer == false) { return; } UpdateManager.Add(CycleUpdate, 1); }
public virtual void OnSpawnServer(SpawnInfo info) { UpdateManager.Add(CallbackType.UPDATE, ServerUpdateMe); cnt.OnTileReached().AddListener(OnTileReached); startPos = OriginTile.WorldPositionServer; isServer = true; AgentServerStart(); }
/// <summary> /// Display the burning animation in the specified direction /// </summary> /// <param name="direction"></param> public void Burn(Orientation direction) { UpdateManager.Add(CallbackType.UPDATE, UpdateMe); orientation = direction; burn = true; spriteRenderer.enabled = true; ChangeBurningSprite(); }
public virtual void OnSpawnServer(SpawnInfo info) { UpdateManager.Add(CallbackType.UPDATE, ServerUpdateMe); cnt.OnTileReached().AddListener(OnTileReached); startPos = OriginTile.WorldPositionServer; isServer = true; registerObj.WaitForMatrixInit(StartServerAgent); }
/// <summary> /// Constructor /// </summary> /// <param name="updaterManager"></param> /// <param name="projection"></param> public ControlledCamera3D(UpdateManager updaterManager, Projection projection) : base(projection, Matrix.Identity) { if (updaterManager != null) { updaterManager.Add(this); } }
private void OnEnable() { if (CustomNetworkManager.IsHeadless) { return; } UpdateManager.Add(CallbackType.UPDATE, UpdateLoop); }
private void OnEnable() { if (!DetectViaMatrix) { return; } UpdateManager.Add(CallbackType.UPDATE, UpdateMe); }
/// <summary> /// Construct the particle system. Before the particle system is used, the <see cref="ParticleSystemData"/> must be set /// </summary> /// <param name="update"></param> public ParticleSystem(UpdateManager update) : this() { if (update == null) throw new ArgumentNullException(); update.Add(this); }
private void OnEnable() { if (!passiveDetect) { return; } UpdateManager.Add(DetectObjectsOnTile, 1f); }
public void OnSpawnServer(SpawnInfo info) { if (!passiveDetect) { return; } UpdateManager.Add(ServerDetectObjectsOnTile, 1f); }
//------------------------------------------------------------------------------------------------------------------------ // Add() //------------------------------------------------------------------------------------------------------------------------ internal void Add(GameObject gameObject) { if (!_gameObjectsContained.Contains(gameObject)) { _updateManager.Add(gameObject); _collisionManager.Add(gameObject); _gameObjectsContained.Add(gameObject); } }
//The class is constructed with a camera and a reference to the Applications //UpdateManager public CameraOrbit(Camera3D camera, UpdateManager manager) { //keep a reference to the camera this.camera = camera; //Add this object to the update manager manager.Add(this); }
private void OnEnable() { if (CustomNetworkManager.IsServer == false) { return; } UpdateManager.Add(RequestPulse, 5); }
private void OnEnable() { if (CustomNetworkManager.IsServer == false) { return; } UpdateManager.Add(UpdateMe, 0.85f); }
public override void OnEnable() { base.OnEnable(); if (CustomNetworkManager.Instance._isServer == false) { return; } UpdateManager.Add(Refresh, 1); }
private void OnEnable() { if (Application.isEditor == false && NetworkServer.active == false) { return; } UpdateManager.Add(SicknessUpdate, 1); }
private void OnEnable() { if (CustomNetworkManager.Instance._isServer == false) { return; } UpdateManager.Add(CycleUpdate, 1); }
private void OnEnable() { if (CustomNetworkManager.IsServer == false) { return; } UpdateManager.Add(CallbackType.UPDATE, UpdateMe); }
private void OnEnable() { if (CustomNetworkManager.IsServer == false) { return; } UpdateManager.Add(EmitterUpdate, 1f); }
public void AddDrunkTime(int time) { drunkCameraTime += time; if (drunkCamera.enabled == false) { UpdateManager.Add(DoEffectTimeCheck, TIMER_INTERVAL); } }
/// <summary> /// Construct a particle system with data /// </summary> /// <param name="systemData"></param> /// <param name="update"></param> public ParticleSystem(ParticleSystemData systemData, UpdateManager update) : this() { if (update == null) throw new ArgumentNullException(); Initalise(systemData, DefaultProcessorType); update.Add(this); }
private ParticleSystemHotLoader(UpdateManager updateManager, ParticleSystem system, string pathToShaderSystem) { if (system == null || updateManager == null) throw new ArgumentNullException(); if (system.ParticleSystemData == null) throw new ArgumentNullException("ParticleSystem.ParticleSystemData"); this.system = new WeakReference(system); this.filename = system.ParticleSystemData.FileName; this.pathToShaderSystem = pathToShaderSystem; this.sourceFileModifiedDate = File.GetLastWriteTime(this.filename); updateManager.Add(this); }
internal AnimationProcessor(UpdateManager manager, object parent) { if (manager != null) { manager.Add(this); isAsync = true; if (parent != null) { parents = new List<WeakReference>(); parents.Add(new WeakReference(parent)); } threadAnimations = new List<AnimationStreamControl>(); } animations = new List<AnimationStreamControl>(); wasDrawn = true; }
//load the avatar public Avatar(ContentRegister content, UpdateManager update, out bool contentLoaded) { //create a random avatar description... Microsoft.Xna.Framework.GamerServices.AvatarDescription description; description = Microsoft.Xna.Framework.GamerServices.AvatarDescription.CreateRandom(); //Create the avatar instance avatar = new AvatarInstance(description, true); //Create the animation controller. animationController = avatar.GetAnimationController(); //NOTE: Animations cannot be played until the avatar animation data has been loaded... update.Add(this); //to play animations from a file, the user must download additional content. //however, we don't want to crash if they haven't... so only crash if the debugger is present //this will allow the user to download the content. contentLoaded = false; try { content.Add(this); contentLoaded = true; } catch { content.Remove(this); //failed! but don't crash } if (contentLoaded) { //At this point in this tutorial, the animation is now loaded. //get the index of the walk animation int animationIndex = animationController.AnimationIndex("Walk"); //begin playing the animation, looping walkAnimation = animationController.PlayLoopingAnimation(animationIndex); } }
/// <summary> /// Constructor /// </summary> /// <param name="updaterManager"></param> /// <param name="projection"></param> public ControlledCamera3D(UpdateManager updaterManager, Projection projection) : base(projection, Matrix.Identity) { if (updaterManager != null) updaterManager.Add(this); }
public TutorialSelection(string text, int y_pos, IContentRegister content, ElementRect parent, UpdateManager update, Type value) { this.Value = value; this.YPos = XenMenuApp.ElementHeight * 0.5f - y_pos; background = new SolidColourElement[3]; for (int i = 0; i < background.Length; i++) { background[i] = new SolidColourElement(Color.Black, new Vector2(parent.Size.X, XenMenuApp.ElementHeight)); background[i].VerticalAlignment = VerticalAlignment.Top; background[i].HorizontalAlignment = HorizontalAlignment.Left; background[i].Position = new Vector2(0, (float)y_pos); parent.Add(background[i]); } //offset the elements a bit, to give a 3D effect. background[1].AlphaBlendState = AlphaBlendState.ModulateX2; background[2].AlphaBlendState = AlphaBlendState.ModulateX2; background[1].Size -= new Vector2(1, 1); background[1].Position += new Vector2(1, 0); background[2].Size -= new Vector2(1, 1); background[2].Position -= new Vector2(0, 1); this.text = new TextElementRect(new Vector2(parent.Size.X - XenMenuApp.ElementTextOffset, XenMenuApp.ElementHeight), text); this.text.VerticalAlignment = VerticalAlignment.Top; this.text.HorizontalAlignment = HorizontalAlignment.Left; this.text.Position = new Vector2(XenMenuApp.ElementTextOffset, (float)y_pos); parent.Add(this.text); content.Add(this); update.Add(this); }
/// <summary>Construct the statistics display</summary> /// <param name="manager"></param> /// <param name="font"></param> public DrawStatisticsDisplay(UpdateManager manager, SpriteFont font) { this.font = font; #if DEBUG if (manager != null) manager.Add(this); toggleText = new TextElement("", font); toggleText.HorizontalAlignment = HorizontalAlignment.Left; toggleText.VerticalAlignment = VerticalAlignment.Top; toggleTextGamepad = new TextElement("Hold both thumbsticks to toggle debug graphs", font); toggleTextGamepad.HorizontalAlignment = HorizontalAlignment.Left; toggleTextGamepad.VerticalAlignment = VerticalAlignment.Top; DebugToggleKey = Keys.F12; #endif }
private bool worldMatrixDirty = true; // set to true if worldMatrix is no longer valid, see 'UpdateWorldMatrix()' //create the actor public Actor(ContentRegister content, UpdateManager updateManager, MaterialLightCollection lights, float groundRadius) { this.groundRadius = groundRadius; model = new ModelInstance(); model.LightCollection = lights; //force the model to render using spherical harmonic lighting //this will significantly improve performance on some hardware when GPU limited model.ShaderProvider = new Xen.Ex.Graphics.Provider.LightingDisplayShaderProvider(LightingDisplayModel.ForceSphericalHarmonic, model.ShaderProvider); //random starting position position = GetRandomPosition(); //initially target the current position //the 'move to next target' timer will wind down and then the actor will move target = position; //randomize a bit lookAngle = (float)random.NextDouble() * MathHelper.TwoPi; moveSpeed = (float)random.NextDouble() * 0.9f + 0.1f; content.Add(this); updateManager.Add(this); InitaliseAnimations(updateManager); }