//Use this for initialization private void Start() { //Get the light lightAffected = this.gameObject.GetComponent <Light>(); //If the light is found, get the original intensity and whether the light has if (lightAffected != null) { originalIntensity = lightAffected.intensity; hasLight = lightAffected.enabled; } //Get the Light's wire wire = this.gameObject.GetComponentInChildren <Wire>(); //Set the special effects that occur when the light prisoner interacts with the light flicker = null; fade = null; dimmer = null; //Find the original effects that the light has originalFlicker = this.gameObject.GetComponent <LightFlicker>(); originalFade = this.gameObject.GetComponent <LightFade>(); toggle = this.gameObject.GetComponent <ToggleLight>(); }
private bool isInLight; //Checks if the prisoner is in range to act upon a light //Use this for initialization protected override void Start() { base.Start(); lightHolder = GameObject.Find("Light Prisoner/StoredLight"); lightStored = lightHolder.GetComponent <Light>(); lightStoredFade = null; }
public void setFade(bool take, LightFade fade, float intensity, Light lightAffected) { fade.totalDuration = fadeDuration; fade.startDim = true; fade.callStart = false; fade.startSequence(take, intensity, lightAffected); }
//Light:光线 private void LightButton_Tapped(object sender, TappedRoutedEventArgs e) { if (LightPanel.Opacity == 0) { LightShow.Begin(); } else { LightFade.Begin(); } }
IEnumerator BulletDeath() { yield return(new WaitForSeconds(bulletTime.destroyBulletTime)); isHalo = true; GameObject newLight = Instantiate(LightPrefab, transform.position, Quaternion.identity); lightF = newLight.GetComponent <LightFade>(); lightF.bullet = this; lightF.setLightRange(); Destroy(this.gameObject); }
public void OnCollisionEnter(Collision collision) { if (collision.gameObject.tag == "Terrain") { isHalo = false; GameObject newLight = Instantiate(LightPrefab, transform.position, Quaternion.identity); lightF = newLight.GetComponent <LightFade>(); lightF.GetComponent <Light>().flare = null; lightF.bullet = this; lightF.setLightRange(); SED.StartScan(transform.position); Destroy(this.gameObject); } }
//Sets the temp fade, showing the transfer of light from the light source to the light prisoner or vice versa private void addTempFade(bool put, float intensity) { lightStoredFade = lightStored.gameObject.AddComponent("LightFade") as LightFade; specialfade.setFade(put, lightStoredFade, intensity, lightStored); //lightStoredFade.specialFade(put, lightStored, intensity); }
private void addTempFade(bool take, LightPrisoner lightPrisoner) { fade = this.gameObject.AddComponent("LightFade") as LightFade; lightPrisoner.specialfade.setFade(take, fade, originalIntensity, lightAffected); }
public void ReviveUpdate() { this.LightAlpha = Calc.Approach(this.LightAlpha, this.targetLightAlpha, 0.1f * Engine.TimeMult); base.Update(); if (this.levitateCorpse) { float num = this.targetPosition.Y + this.sine.Value * 2f; Vector2 zero = Vector2.Zero; zero.Y = MathHelper.Clamp(num - this.Corpse.ActualPosition.Y, -0.6f, 0.6f); if (!this.Finished && !this.AutoRevive) { Player player = base.Level.GetPlayer(this.reviver); if (player != null) { if (Math.Abs(player.X - base.X) > 10f) { zero.X = (float)Math.Sign(player.X - base.X) * 0.2f; } if (Math.Abs(player.Y - base.Y) > 14f) { zero.Y = (float)Math.Sign(player.Y - base.Y) * 0.6f; } } } if (this.Corpse.Squished == Vector2.Zero) { this.Corpse.Speed = this.Corpse.Speed.Approach(zero, 4f * Engine.TimeMult); } } if (!this.Finished) { if (this.Corpse.Scene == null || this.Corpse.MarkedForRemoval) { LightFade lightFade = Cache.Create <LightFade> (); lightFade.Init(this, null); base.Level.Add <LightFade> (lightFade); base.RemoveSelf(); } else { this.Position = this.Corpse.BottomCenter; if (base.Scene.OnInterval(3)) { if (this.arrowColor == this.colorA) { this.arrowColor = this.colorB; } else { this.arrowColor = this.colorA; } } if (this.reviving) { this.reviveCounter -= Engine.TimeMult; if (this.Corpse.Squished != Vector2.Zero) { this.StopReviving(); } else if (this.reviveCounter <= 0f) { this.Finished = true; this.Corpse.Revived = true; base.Add(new Coroutine(this.ReviveSequence())); } else if (!this.Corpse.PrismHit && this.CanReviveAtThisPosition()) { if (!this.AutoRevive && this.PlayerCanRevive) { bool flag = false; int num2 = -1; using (List <Entity> .Enumerator enumerator = base.Level.Players.GetEnumerator()) { while (enumerator.MoveNext()) { Player player2 = (Player)enumerator.Current; if (player2.Allegiance == this.Corpse.Allegiance && base.CollideCheck(player2)) { flag = true; if (num2 != this.reviver) { if (player2.PlayerIndex == this.reviver) { num2 = this.reviver; } else if (num2 == -1) { num2 = player2.PlayerIndex; } } } } } if (this.ghostRevives) { using (List <Entity> .Enumerator enumerator = base.Level[GameTags.PlayerGhost].GetEnumerator()) { while (enumerator.MoveNext()) { PlayerGhost ghost = (PlayerGhost)enumerator.Current; if (ghost.Allegiance == this.Corpse.Allegiance && base.CollideCheck(ghost) && ghost.PlayerIndex != this.Corpse.PlayerIndex) { flag = true; if (num2 != this.reviver) { if (ghost.PlayerIndex == this.reviver) { num2 = this.reviver; } else if (num2 == -1) { num2 = ghost.PlayerIndex; } } } } } } if (num2 != this.reviver && num2 != -1) { this.reviver = num2; } if (!flag) { this.StopReviving(); } } TFGame.PlayerInputs [this.Corpse.PlayerIndex].Rumble(0.5f, 2); if (this.reviver != -1) { TFGame.PlayerInputs [this.reviver].Rumble(0.5f, 2); } } else { this.StopReviving(); } } else { this.ResetCounter(); this.LightAlpha = Calc.Approach(this.LightAlpha, 0f, 0.1f * Engine.TimeMult); if (this.canRevive && !this.Corpse.PrismHit && this.Corpse.Squished == Vector2.Zero && this.CanReviveAtThisPosition()) { if (this.AutoRevive) { this.StartReviving(); } else if (this.PlayerCanRevive) { using (List <Entity> .Enumerator enumerator = base.Level.Players.GetEnumerator()) { while (enumerator.MoveNext()) { Player player2 = (Player)enumerator.Current; if (player2.Allegiance == this.Corpse.Allegiance && !player2.Dead && base.CollideCheck(player2)) { this.reviver = player2.PlayerIndex; this.StartReviving(); break; } } } if (this.ghostRevives) { using (List <Entity> .Enumerator enumerator = base.Level[GameTags.PlayerGhost].GetEnumerator()) { while (enumerator.MoveNext()) { PlayerGhost ghost = (PlayerGhost)enumerator.Current; if (ghost.Allegiance == this.Corpse.Allegiance && ghost.State != 3 && base.CollideCheck(ghost) && ghost.PlayerIndex != this.Corpse.PlayerIndex) { this.reviver = ghost.PlayerIndex; this.StartReviving(); break; } } } } } } } } } }