public override void trigger() { on = true; lastResequenceTime = Time.time; fader.StartFade(fadeOutColour, fadeTime); print("Starting fade to black."); state = RISC.FadingToBlack; transparency = new Color(0, 0, 0, 0); fadeOutColour = new Color(0, 0, 0, 1); }
void OnLevelWasLoaded() { if (FinishedLoading != null) FinishedLoading.Invoke(); CameraFade.StartFade(CameraFade.FadeType.FADEOUT); async = null; }
/* * /// <summary> * /// Teleports player * /// On a collision event * /// If isPortal true * /// </summary> * public void OnTriggerEnter(Collider thing){ * if (isPortal) { * thing.transform.root.position = linkedTeleporter.transform.position + linkedTeleporter.relativePosition; * } * }*/ public void Update() { if (beginFadeAt + fadeTime > Time.time && !faded) { fader.StartFade(transparency, fadeTime); faded = true; } }
/// <summary> /// Interact with this instance. /// </summary> public override void Interact(GameObject player, ShootObjects SOPlayer) { if (RenderSettings.skybox == dayMaterial) { fader.StartFade(fadeColor, fadeTime); lastFade = Time.realtimeSinceStartup; faded = false; //Time.timeScale = 0.1f; } else { fader.StartFade(fadeColor, fadeTime); lastFade = Time.realtimeSinceStartup; faded = false; //Time.timeScale = 0.1f; } }
void Start() { Physics.gravity = new Vector3(0.0f,-9.81f,0.0f); fade = GetComponent<CameraFade>(); fade.SetScreenOverlayColor(FullFadeColor); //setup start fade color fade.StartFade(EmptyFadeColor, FadeInTime); }
void OnGUI() { if (!on) { return; } if (lastResequenceTime + (state == IS.DisplayingSplash ? splashTime : 0) + (state == IS.BackToBlack ? fadeTime : 0) < Time.time) { state++; lastResequenceTime = Time.time; if (state == IS.BackToTrans) { fader.StartFade(transparency, fadeTime); } if (state == IS.BackToBlack) { fader.StartFade(fadeOutColour, fadeTime); } } if (state == IS.DisplayingSplash) { GUI.DrawTexture(new Rect(0, 0, Screen.width, Screen.height), SplashScreen); } if (state == IS.BackToBlack) { GUI.DrawTexture(new Rect(0, 0, Screen.width, Screen.height), SplashScreen); } if (state == IS.Done) { fader.SetScreenOverlayColor(transparency); on = false; pilot.talking = true; } }
private void Update() { if (async != null && async.progress >= 0.9f) { //Debug.Log(async.progress); //Debug.Log(levelName); if (!fading) { fading = true; CameraFade.FinishedFade += ActivateScene; CameraFade.StartFade(CameraFade.FadeType.FADEIN); } } }
IEnumerator Start() { #if UNITY_EDITOR || UNITY_STANDALONE_WIN || UNITY_STANDALONE_OSX originalRotation = transform.localRotation; #elif UNITY_IPHONE || UNITY_ANDROID localRotation = transform.eulerAngles; #endif cameraFade.SetScreenOverlayColor(Color.black); cameraFade.StartFade(Color.clear, 2f); yield return(new WaitForSeconds(2f)); iTween.MoveTo(tutorialPanel.gameObject, iTween.Hash( "position", Vector3.zero, "islocal", true, "time", 0.4f, "delay", 0.2f, "easetype", iTween.EaseType.easeOutExpo ) ); // Load gun DBAccess.instance.userPrefs.userGun.capacity = DBAccess.instance.userPrefs.userGun.compatibleAmmo[0].magSize; }
void Awake() { GameObject cam = GameObject.FindGameObjectWithTag("MainCamera"); cameraFader = cam.GetComponent <CameraFade> (); cameraFader.SetScreenOverlayColor(Color.black); cameraFader.StartFade(Color.clear, 3f); player = GameObject.FindGameObjectWithTag("Player"); GameObject musicDir = GameObject.FindGameObjectWithTag("MusicDirector"); if (musicDir != null) { musicDirector = musicDir.GetComponent <MusicDirector> (); } else { Debug.Log("Cannot find music director"); } }
/// <summary>3 /// Deal damage to player.ss /// </summary> /// <param name='damage'> /// the amount of damage received. /// </param> /// <returns> /// Whether the player survived. /// </returns> public bool Damage(float damage, DamageCause COD = DamageCause.Default) { lastInjury = Time.time; if (playSounds) { painSoundSource.PlayOneShot(painSounds[(int)(Random.value * (painSounds.Length - 1))]); } fader.SetScreenOverlayColor(fadeColor); fader.StartFade(transparent, fadeTime); lastCOD = COD; if (damage >= HealthLevel) { Die(); return(false); } else { HealthLevel = HealthLevel - damage; return(true); } }
/// <summary> /// Deal damage to player.ss /// </summary> /// <param name='damage'> /// the amount of damage received. /// </param> /// <returns> /// Whether the player survived. /// </returns> public bool Damage(float damage) { lastInjury = Time.time; if (playSounds) { painSoundSource.PlayOneShot(painSounds[(int)(Random.value * (painSounds.Length - 1))]); } fader.SetScreenOverlayColor(fadeColor); fader.StartFade(transparent, fadeTime); if (damage > HealthLevel) { HealthLevel = 0; print("Debug: Dead."); pauseController.pane = "/Dead"; Time.timeScale = 0; return(false); } else { HealthLevel = HealthLevel - damage; return(true); } }
public void Explode() { Color white = new Color(1, 1, 1, 1); Color whitef = new Color(1, 1, 1, 0); weapon.vessel.GetHeightFromTerrain(); blastRadius = weapon.blastRadius; blastPower = weapon.blastPower; blastHeat = weapon.blastHeat; Vector3 position = transform.position; Vector3 direction = transform.up; Quaternion rotation = Quaternion.LookRotation(VectorUtils.GetUpDirection(position)); if (!hasExploded && weapon.TimeFired >= weapon.dropTime && weapon.vessel.heightFromTerrain >= 70000) { hasExploded = true; if (part != null) { part.temperature = part.maxTemp + 100; } GameObject lightBall = new GameObject(); lightBall.SetActive(true); lightBall.transform.position = position; lightBall.transform.rotation = rotation; Detonator sdetonator = lightBall.AddComponent <Detonator>(); lightBall.GetComponent <Detonator>().enabled = true; sdetonator.duration = 2f; sdetonator.size = blastRadius; sdetonator.detail = 10f; Debug.Log("Space Explosion Activated"); } else { if (!hasExploded && weapon.vessel.heightFromTerrain <= 69999 && weapon.vessel.heightFromTerrain >= 501 && weapon.TimeFired >= weapon.dropTime && weapon.blastRadius >= 1000) { hasExploded = true; if (part != null) { part.temperature = part.maxTemp + 100; } GameObject source = new GameObject(); source.SetActive(true); source.transform.position = position; source.transform.rotation = rotation; source.transform.up = direction; ///Detonator ndetonator = source.AddComponent<Detonator>(); //source.GetComponent<Detonator>().enabled = true; //ndetonator.duration = 5.0f; //ndetonator.size = blastRadius; //ndetonator.detail = 10.0f; CameraFade flashEffect = source.AddComponent <CameraFade>(); source.GetComponent <CameraFade>().enabled = true; flashEffect.SetScreenOverlayColor(white); flashEffect.StartFade(whitef, 2.0f); ExplosionFx.CreateExplosion(position, blastPower, explAirPath, explSoundPath, isMissile = true, caliber = 0, explosivePart = null, direction = default(Vector3)); Debug.Log("Air NExplosion Activated"); } else { if (!hasExploded && weapon.vessel.heightFromTerrain <= 69999 && weapon.vessel.heightFromTerrain >= 501 && weapon.TimeFired >= weapon.dropTime && weapon.blastRadius <= 1000) { hasExploded = true; if (part != null) { part.temperature = part.maxTemp + 100; } GameObject csource = new GameObject(); csource.SetActive(true); csource.transform.position = position; csource.transform.rotation = rotation; csource.transform.up = direction; //Detonator cdetonator = csource.AddComponent<Detonator>(); //csource.GetComponent<Detonator>().enabled = true; //cdetonator.duration = 3.0f; //cdetonator.size = blastRadius; //cdetonator.detail = 10.0f; ExplosionFx.CreateExplosion(position, blastPower, explAirPath, explSoundPath, isMissile = true, caliber = 0, explosivePart = null, direction = default(Vector3)); Debug.Log("Air CExplosion Activated"); } else { if (!hasExploded && weapon.TimeFired >= weapon.dropTime && weapon.vessel.heightFromTerrain <= 500 && weapon.blastRadius >= 1000) { hasExploded = true; if (part != null) { part.temperature = part.maxTemp + 100; } GameObject source = new GameObject(); source.SetActive(true); source.transform.position = position; source.transform.rotation = rotation; source.transform.up = direction; //Detonator ndetonator = source.AddComponent<Detonator>(); //source.GetComponent<Detonator>().enabled = true; //ndetonator.duration = 5.0f; //ndetonator.size = blastRadius; //ndetonator.detail = 10.0f; CameraFade flashEffect = source.AddComponent <CameraFade>(); source.GetComponent <CameraFade>().enabled = true; flashEffect.SetScreenOverlayColor(white); flashEffect.StartFade(whitef, 2.0f); ExplosionFx.CreateExplosion(position, blastPower, explGroundPath, explSoundPath, isMissile = true, caliber = 0, explosivePart = null, direction = default(Vector3)); Debug.Log("Ground NExplosion Activated"); } else { if (!hasExploded && weapon.TimeFired >= weapon.dropTime && weapon.vessel.heightFromTerrain <= 500 && weapon.blastRadius <= 1000) { hasExploded = true; if (part != null) { part.temperature = part.maxTemp + 100; } GameObject csource = new GameObject(); csource.SetActive(true); csource.transform.position = position; csource.transform.rotation = rotation; csource.transform.up = direction; //Detonator cdetonator = csource.AddComponent<Detonator>(); //csource.GetComponent<Detonator>().enabled = true; //cdetonator.duration = 3.0f; //cdetonator.size = blastRadius; //cdetonator.detail = 10.0f; ExplosionFx.CreateExplosion(position, blastPower, explGroundPath, explSoundPath, isMissile = true, caliber = 0, explosivePart = null, direction = default(Vector3)); Debug.Log("Ground CExplosion Activated"); } } } } } }