public void SetNight() { if (_light != null) { _light.enabled = false; } CurrentPhase = DayPhase.Night; }
public void SetDayPhase(DayPhase newDayPhase) { CurrentDayPhase = newDayPhase; if (DayPhaseChangedTo != null) { DayPhaseChangedTo.Invoke(newDayPhase); } }
/// Sets the currentPhase to Dawn, turning on the directional light, if any. public void SetDawn() { if (light != null) { light.enabled = true; } currentPhase = DayPhase.Dawn; }
/// <summary> /// Sets the currentPhase to Dusk. /// </summary> public void SetDusk() { RenderSettings.skybox = dawnDuskSkybox; //would be commented out or removed if UpdateSkybox were used. //remainingTransition = skyTransitionTime; //would be set if UpdateSkybox were used. currentPhase = DayPhase.Dusk; currentCycleTime = duskTime; }
public void SetDay() { if (_light != null) { _light.intensity = _lightIntensity; } CurrentPhase = DayPhase.Day; }
public void SetDawn() { if (_light != null) { _light.enabled = true; } CurrentPhase = DayPhase.Dawn; Audio.AudioManager.PlaySoundEffect(DawnAudio); }
void SetDay() { RenderSettings.ambientLight = fullLight; if (light != null) { light.intensity = lightIntensity; } currentPhase = DayPhase.DAY; }
void SetNight() { RenderSettings.ambientLight = fullDark; if (light != null) { light.enabled = false; } currentPhase = DayPhase.NIGHT; }
public float DayPhaseFraction(DayPhase phase) { float num = this.DayFraction - DayPhaseExtensions.StartTime(phase); if ((double)num < 1.0) { ++num; } return(num / DayPhaseExtensions.Duration(phase)); }
/// <summary> /// Sets the currentPhase to Dawn, turning on the directional light, if any. /// </summary> public void SetDawn() { RenderSettings.skybox = dawnDuskSkybox; //would be commented out or removed if UpdateSkybox were used. //remainingTransition = skyTransitionTime; //would be set if UpdateSkybox were used. if (GetComponent <Light>() != null) { GetComponent <Light>().enabled = true; } currentPhase = DayPhase.Dawn; }
/// <summary> /// Sets the currentPhase to Day, ensuring full day color ambient light, and full /// directional light intensity, if any. /// </summary> public void SetDay() { RenderSettings.skybox = daySkybox; //would be commented out or removed if UpdateSkybox were used. //remainingTransition = skyTransitionTime; //would be set if UpdateSkybox were used. RenderSettings.ambientLight = fullLight; if (GetComponent <Light>() != null) { GetComponent <Light>().intensity = lightIntensity; } currentPhase = DayPhase.Day; }
/// <summary> /// Sets the currentPhase to Night, ensuring full night color ambient light, and /// turning off the directional light, if any. /// </summary> public void SetNight() { RenderSettings.skybox = nightSkybox; //would be commented out or removed if UpdateSkybox were used. //remainingTransition = skyTransitionTime; //would be set if UpdateSkybox were used. //RenderSettings.ambientLight = fullDark; if (GetComponent <Light>() != null) { GetComponent <Light>().enabled = false; } currentPhase = DayPhase.Night; }
public static float Duration(this DayPhase phase) { float num1 = DayPhaseExtensions.EndTime(phase); float num2 = DayPhaseExtensions.StartTime(phase); if ((double)num1 < (double)num2) { ++num1; } return(num1 - num2); }
// Continues to the next phase and returns it private void SwitchPhase() { if (currentDayPhase == DayPhase.Day) { _currentDayPhase = DayPhase.Night; _nights_survived++; } else { _currentDayPhase = DayPhase.Day; } MainEventManager.Instance.OnDaySwitchPhase.Invoke(); }
/// Sets the currentPhase to Dawn, turning on the directional light, if any. public void SetDawn() { if (sun != null) { sun.intensity = Mathf.Lerp (sun.intensity, 0.3f, Time.deltaTime); sun.flare = coldSunFlare; } RenderSettings.ambientIntensity = ambientIntensity; currentPhase = DayPhase.Dawn; if (RenderSettings.skybox != dawn && updateSkyboxes) { RenderSettings.skybox = dawn; } }
void RecomputeDate() { int counter = m_TurnCounter; m_Day = counter / TURNS_PER_DAY; counter -= m_Day * TURNS_PER_DAY; m_Hour = counter / TURNS_PER_HOUR; counter -= m_Hour * TURNS_PER_HOUR; switch (m_Hour) { case 0: m_Phase = DayPhase.MIDNIGHT; m_IsNight = true; break; case 1: case 2: case 3: case 4: case 5: m_Phase = DayPhase.DEEP_NIGHT; m_IsNight = true; break; case 6: m_Phase = DayPhase.SUNRISE; m_IsNight = false; break; case 7: case 8: case 9: case 10: case 11: m_Phase = DayPhase.MORNING; m_IsNight = false; break; case 12: m_Phase = DayPhase.MIDDAY; m_IsNight = false; break; case 13: case 14: case 15: case 16: case 17: m_Phase = DayPhase.AFTERNOON; m_IsNight = false; break; case 18: m_Phase = DayPhase.SUNSET; m_IsNight = true; break; case 19: case 20: case 21: case 22: case 23: m_Phase = DayPhase.EVENING; m_IsNight = true; break; default: throw new ArgumentOutOfRangeException("unhandled hour"); } }
private string GetFadeTitle(DayPhase newDayPhase) { switch (newDayPhase) { case DayPhase.Morning: return(string.Format("Day {0}", time.GameTime.GetDay() + 1)); case DayPhase.Open: return("Opening Time!"); case DayPhase.Night: return("Always some stragglers. Use the console near the door to turf them out."); default: throw new ArgumentOutOfRangeException("newDayPhase", newDayPhase, null); } }
///<summary> ///Establece la fase del dia, dependiendo de esta se pueden hacer unas cosas u otras /// <param name="phaseOfTheDay">fase del dia</param> ///</summary> public void SetPhaseOfTheDay(DayPhase nextPhaseOfTheDay) { if (nextPhaseOfTheDay >= this.PhaseOfTheDay) { PhaseOfTheDay = nextPhaseOfTheDay; print("Fase del dia : " + PhaseOfTheDay); if (Day == 0) { ExecuteEventsTutorial(); } else { ExecuteEventsNormalDay(); } } }
public bool IsDayPhase(DayPhase phase) { float dayFraction = this.DayFraction; float num1 = DayPhaseExtensions.StartTime(phase); float num2 = DayPhaseExtensions.EndTime(phase); if ((double) num1 < (double) num2) { if ((double) dayFraction >= (double) num1) return (double) dayFraction <= (double) num2; else return false; } else if ((double) dayFraction < (double) num1) return (double) dayFraction <= (double) num2; else return true; }
// Update is called once per frame void Update() { if (this.paused) { return; } // Rudementary phase-check algorithm: if (currentCycleTime > nightTime && currentPhase == DayPhase.Dusk) { SetNight(); } else if (currentCycleTime > duskTime && currentPhase == DayPhase.Day) { SetDusk(); } else if (currentCycleTime > dayTime && currentPhase == DayPhase.Dawn) { SetDay(); } else if (currentCycleTime > dawnTime && currentCycleTime < dayTime && currentPhase == DayPhase.Night) { SetDawn(); } // Perform standard updates: UpdateWorldTime(); UpdateDaylight(); UpdateFog(); //UpdateSkybox(); //would be called if UpdateSkybox were used. // Update the current cycle time: currentCycleTime += Time.deltaTime; currentCycleTime = currentCycleTime % dayCycleLength; // Pause the phase if necessary. if (this.currentPhase == this.pausePhase && this.currentCycleTime >= this.GetPhaseStartTime(this.currentPhase)) { this.paused = true; this.pausePhase = DayPhase.None; } }
public static float MusicEndTime(this DayPhase phase) { switch (phase) { case DayPhase.Night: return(0.08333334f); case DayPhase.Dawn: return(0.2083333f); case DayPhase.Day: return(0.7916667f); case DayPhase.Dusk: return(0.875f); default: throw new InvalidOperationException(); } }
/// <summary> /// Sets the currentPhase to Night, ensuring full night color ambient light, and /// turning off the directional light, if any. /// </summary> public void SetNight() { RenderSettings.skybox = nightSkybox; //would be commented out or removed if UpdateSkybox were used. //remainingTransition = skyTransitionTime; //would be set if UpdateSkybox were used. RenderSettings.ambientLight = fullDark; if (light != null) { light.enabled = false; } currentPhase = DayPhase.Night; }
/// <summary> /// Sets the currentPhase to Dusk. /// </summary> public void SetDusk() { RenderSettings.skybox = dawnDuskSkybox; //would be commented out or removed if UpdateSkybox were used. //remainingTransition = skyTransitionTime; //would be set if UpdateSkybox were used. currentPhase = DayPhase.Dusk; }
public float DayPhaseFraction(DayPhase phase) { float num = this.DayFraction - DayPhaseExtensions.StartTime(phase); if ((double) num < 1.0) ++num; return num / DayPhaseExtensions.Duration(phase); }
/// <summary> /// Sets the currentPhase to Day, ensuring full day color ambient light, and full /// directional light intensity, if any. /// </summary> public void SetDay() { //remainingTransition = skyTransitionTime; //would be set if UpdateSkybox were used. RenderSettings.ambientLight = fullLight; if (GetComponent<Light>() != null) { GetComponent<Light>().intensity = lightIntensity; } currentPhase = DayPhase.Day; }
private void SetNight() { Debug.Log("It is now Night."); for (int i = 0; i < nightLights.Length; i++) nightLights[i].SetActive(true); skybox.SetFloat("_Blend", 1.0f); currentPhase = DayPhase.Night; RenderSettings.ambientLight = fullDark; if (GetComponent<Light>() != null) GetComponent<Light>().enabled = false; }
private void SetDay() { //Debug.Log("It is now Day."); for (int i = 0; i < nightLights.Length; i++) nightLights[i].SetActive(false); skybox.SetFloat("_Blend", 0.0f); currentPhase = DayPhase.Day; RenderSettings.ambientLight = fullLight; if (GetComponent<Light>() != null) GetComponent<Light>().intensity = lightIntensity; }
/// <summary> /// Sets the currentPhase to Dusk. /// </summary> public void SetDusk() { //remainingTransition = skyTransitionTime; //would be set if UpdateSkybox were used. currentPhase = DayPhase.Dusk; }
void SetDusk() { currentPhase = DayPhase.DUSK; }
public static void CreateNewAsset(RawInfoHolder raw) { AnimalInfo newAnimal = ScriptableObject.CreateInstance <AnimalInfo>(); newAnimal._id = raw.Id; newAnimal._name = raw.Name; newAnimal._subtitle = raw.Subtitle; newAnimal._detailedDescripion = raw.Description; newAnimal._specie = (AnimalSpecie)Enum.Parse(typeof(AnimalSpecie), raw.Specie); newAnimal._location = (FishingAreaType)Enum.Parse(typeof(FishingAreaType), raw.Location); CatchValues cValues = new CatchValues(int.Parse(raw.Stamina), int.Parse(raw.Fails), int.Parse(raw.ReelWindow) * 0.01f, int.Parse(raw.WindowIncrease) * 0.01f, int.Parse(raw.BaitInterest) * 0.01f); AvailabilityValues aValues = new AvailabilityValues( GetMonths(), GetPhases(), int.Parse(raw.SpawnChance) * 0.01f, int.Parse(raw.Lifespan)); newAnimal._catchingValues = cValues; newAnimal._availability = aValues; string path = "Assets/Resources/Fauna Info/Aquatic/" + raw.Specie + '/'; string file = newAnimal._name + ".asset"; AnimalInfo[] foundAssets = Resources.LoadAll <AnimalInfo>("Fauna Info/Aquatic/" + raw.Specie); bool flag = false; foreach (AnimalInfo i in foundAssets) { if (i._name == newAnimal._name) { newAnimal._fishGFX = i.FishGFX; AssetDatabase.DeleteAsset(path + file); Debug.Log("Found duplicate of " + newAnimal.Name + "\nReplacing..."); flag = true; } } if (!flag) { Debug.Log("New Animal Added: " + newAnimal.Name); } AssetDatabase.CreateAsset(newAnimal, path + file); Month GetMonths() { Month months = Month.NONE; string[] rawMonths = raw.Months.Split(' '); for (int i = 0; i < rawMonths.Length; i++) { switch (int.Parse(rawMonths[i])) { case 1: months |= Month.JANUARY; break; case 2: months |= Month.FEBRUARY; break; case 3: months |= Month.MARCH; break; case 4: months |= Month.APRIL; break; case 5: months |= Month.MAY; break; case 6: months |= Month.JUNE; break; case 7: months |= Month.JULY; break; case 8: months |= Month.AUGUST; break; case 9: months |= Month.SEPTEMBER; break; case 10: months |= Month.OCTOBER; break; case 11: months |= Month.NOVEMBER; break; case 12: months |= Month.DECEMBER; break; } } return(months); } DayPhase GetPhases() { DayPhase phases = DayPhase.NONE; string[] rawPhases = raw.Phases.Split(' '); for (int i = 0; i < rawPhases.Length; i++) { switch (rawPhases[i]) { case "EM": phases |= DayPhase.Early_Morning; break; case "LM": phases |= DayPhase.Late_Morning; break; case "EA": phases |= DayPhase.Early_Afternoon; break; case "LA": phases |= DayPhase.Late_Afternoon; break; case "EN": phases |= DayPhase.Early_Night; break; case "LN": phases |= DayPhase.Late_Night; break; case "NO": phases |= DayPhase.Night_Owl; break; } } return(phases); } }
/// <summary> /// Continues the cycle and pauses when the specified <paramref name="phase"/> is reached. /// </summary> public void ContinueToPhase(DayNightController.DayPhase phase) { this.pausePhase = phase; this.paused = false; }
/// <summary> /// Update is called once per frame /// </summary> void Update() { //if main player is killed fade screen and move them to start to respawn if (FadeScreen) { Color myColor = new Color(60, 0, 0); if(notFaded) { screenFader.color = Color.Lerp(screenFader.color, myColor, fadeSpeed * Time.deltaTime); } if(screenFader.color.a > 0.9) { notFaded = false; player.transform.position = new Vector3(529f, 1.5f, 276f); } if(screenFader.color.a > 0 && !notFaded) { screenFader.color = Color.Lerp(screenFader.color, Color.clear, fadeSpeed * Time.deltaTime); } if(screenFader.color.a == 0) { FadeScreen = false; notFaded = true; } } if (Input.GetKeyDown(KeyCode.C)) { currentCameraIndex ++; Debug.Log ("C button has been pressed. Switching to the next camera"); if (currentCameraIndex < cameras.Length) { cameras[currentCameraIndex-1].gameObject.SetActive(false); cameras[currentCameraIndex].gameObject.SetActive(true); Debug.Log ("Camera with name: " + cameras [currentCameraIndex].GetComponent<Camera>().name + ", is now enabled"); } else { cameras[currentCameraIndex-1].gameObject.SetActive(false); currentCameraIndex = 0; cameras[currentCameraIndex].gameObject.SetActive(true); Debug.Log ("Camera with name: " + cameras [currentCameraIndex].GetComponent<Camera>().name + ", is now enabled"); } } // Rudementary phase-check algorithm: if (currentCycleTime > nightTime && currentPhase == DayPhase.Dusk) { lightsOn = true; currentPhase = DayPhase.Night; } else if (currentCycleTime > duskTime && currentPhase == DayPhase.Day) { lightsOn = true; currentPhase = DayPhase.Dusk; } else if (currentCycleTime > dayTime && currentPhase == DayPhase.Dawn) { lightsOn = false; currentPhase = DayPhase.Day; } else if (currentCycleTime > dawnTime && currentCycleTime < dayTime && currentPhase == DayPhase.Night) { lightsOn = true; currentPhase = DayPhase.Dawn; } // Perform standard updates: UpdateWorldTime(); UpdateDaylight(); UpdateFog(); //UpdateSkybox(); //would be called if UpdateSkybox were used. // Update the current cycle time: currentCycleTime += Time.deltaTime; currentCycleTime = currentCycleTime % dayCycleLength; if (lightsOn) { CarouselLight.intensity = 5.5f; CarouselLight.range = 40; flashLight.intensity = 2; flashLight.range = 40; HurCarLight1.intensity = 5; HurCarLight2.intensity = 5; HurCarLight3.intensity = 5; HurCarLight4.intensity = 5; HurCarLight5.intensity = 5; HurRideLight.intensity = 4; TeaCupLight.intensity = 5; RoundUpLight.intensity = 5; } else { CarouselLight.intensity = 0; CarouselLight.range = 0; flashLight.intensity = 0; flashLight.range = 0; HurCarLight1.intensity = 0; HurCarLight2.intensity = 0; HurCarLight3.intensity = 0; HurCarLight4.intensity = 0; HurCarLight5.intensity = 0; HurRideLight.intensity = 0; TeaCupLight.intensity = 0; RoundUpLight.intensity = 0; } if(modFlock != null && modFlock.Count > 0) { foreach (GameObject food in modFlock) { //remove guy flock.Remove(food); modFlock.Remove(food); Destroy(food); Vector3 position = new Vector3(Random.Range (445, 480), 1f, Random.Range (238, 280)); GameObject guy = (GameObject)GameObject.Instantiate(GuyPrefab, position, Quaternion.identity); guy.name = "dude " + Random.Range(10,100); guy.GetComponent<Seeker>().myTarget = null; guy.GetComponent<Seeker>().myLeader = leaders[0]; flock.Add (guy); } } }
public DayPhaseState(DayPhase dayPhase) { DayPhase = dayPhase; }
/// Sets the currentPhase to Day, ensuring full day color ambient light, and full /// directional light intensity, if any. public void SetDay(float lighting) { if (sun != null) { sun.intensity = Mathf.Lerp (sun.intensity, lighting, Time.deltaTime); sun.flare = coldSunFlare; } currentPhase = DayPhase.Day; RenderSettings.ambientIntensity = ambientIntensity; if (RenderSettings.skybox != day && updateSkyboxes) { RenderSettings.skybox = day; } }
/// <summary> /// Sets the currentPhase to Dawn, turning on the directional light, if any. /// </summary> public void SetDawn() { //remainingTransition = skyTransitionTime; //would be set if UpdateSkybox were used. if (GetComponent<Light>() != null) { GetComponent<Light>().enabled = true; } currentPhase = DayPhase.Dawn; }
/// <summary> /// Sets the currentPhase to Night, ensuring full night color ambient light, and /// turning off the directional light, if any. /// </summary> public void SetNight() { //remainingTransition = skyTransitionTime; //would be set if UpdateSkybox were used. RenderSettings.ambientLight = fullDark; if (GetComponent<Light>() != null) { GetComponent<Light>().enabled = false; } currentPhase = DayPhase.Night; }
/// Sets the currentPhase to Night, ensuring full night color ambient light, and /// turning off the directional light, if any. public void SetNight() { if (sun != null) { sun.intensity = Mathf.Lerp (sun.intensity, 0.3f, Time.deltaTime); sun.flare = null; } RenderSettings.ambientIntensity = 0.9f; currentPhase = DayPhase.Night; if (RenderSettings.skybox != night && updateSkyboxes) { RenderSettings.skybox = night; } }
private void SetDawn() { Debug.Log("It is now Dawn."); skybox.SetFloat("_Blend", 1.0f); currentPhase = DayPhase.Dawn; if (GetComponent<Light>() != null) GetComponent<Light>().enabled = true; }
public void SetDusk() { CurrentPhase = DayPhase.Dusk; Audio.AudioManager.PlaySoundEffect(DuskAudio); }
private void SetDusk() { Debug.Log("It is now Dusk."); skybox.SetFloat("_Blend", 0.0f); currentPhase = DayPhase.Dusk; }
/// <summary> /// Sets the currentPhase to Dawn, turning on the directional light, if any. /// </summary> public void SetDawn() { RenderSettings.skybox = dawnDuskSkybox; //would be commented out or removed if UpdateSkybox were used. //remainingTransition = skyTransitionTime; //would be set if UpdateSkybox were used. if (light != null) { light.enabled = true; } currentPhase = DayPhase.Dawn; }
private void Start() { PhaseOfTheDay = 0; SetPhaseOfTheDay(0); }
/// <summary> /// Sets the currentPhase to Day, ensuring full day color ambient light, and full /// directional light intensity, if any. /// </summary> public void SetDay() { RenderSettings.skybox = daySkybox; //would be commented out or removed if UpdateSkybox were used. //remainingTransition = skyTransitionTime; //would be set if UpdateSkybox were used. RenderSettings.ambientLight = fullLight; if (light != null) { light.intensity = lightIntensity; } currentPhase = DayPhase.Day; }
private void OnDayPhaseChanged(DayPhase newDayPhase) { switch (newDayPhase) { case DayPhase.Morning: if (time.GameTime != Constants.GameStartTime) { time.GameTime.IncrementDay(); switch (time.GameTime.GetDay()) { case 1: break; case 2: DayTwoMorning.Start(people); break; case 3: DayThreeMorning.Start(people); break; case 4: WelcomeSignControllerVisualizer.Instance.SetWelcomeSignActive(false); break; } } break; case DayPhase.Open: time.GameTime.SetTime(Constants.OpeningHour, 0); EventSystem.StartDrinkMakingEvent.Invoke(); switch (time.GameTime.GetDay()) { case 1: break; case 2: DayTwoOpen.Start(people); break; } break; case DayPhase.Night: EventSystem.EndDrinkMakingEvent.Invoke(); switch (time.GameTime.GetDay()) { case 1: DayOneNight.Start(people); break; case 2: DayTwoNight.Start(people); break; case 3: PartyScene.Start(people); break; } break; default: throw new ArgumentOutOfRangeException("newDayPhase", newDayPhase, null); } }
/// Sets the currentPhase to Dusk. public void SetDusk() { currentPhase = DayPhase.Dusk; }
private static void SetLighting(DayPhase newDayPhase) { LightControllerVisualizer.Instance.SetLighting(newDayPhase); }
public void GetCurrentPhase() { int i = 0; int nextPhaseIndex = 0; int previousPhaseIndex = 0; bool foundPhase = false; foreach (DayPhase phase in Phases) { if (phase.DayPhaseHours.Contains(TimeManager.Instance.CurrentHour)) { CurrentDayPhase = phase; // print (CurrentDayPhase.Name); foundPhase = true; } previousPhaseIndex = i - 1; nextPhaseIndex = i + 1; i++; if (foundPhase) { break; } } //Get next phase index if (nextPhaseIndex > Phases.Count - 1) { nextPhaseIndex = 0; } //Get previous phase index if (previousPhaseIndex < 0) { previousPhaseIndex = Phases.Count - 1; } PreviousDayPhase = Phases[previousPhaseIndex]; NextDayPhase = Phases[nextPhaseIndex]; TargetColor = CurrentDayPhase.SunColor; TargetIntensity = CurrentDayPhase.SunIntensity; // print("Current Color: " + Sun.color); // print("Target Color: " + TargetColor); if (CurrentDayPhase.Name == DayPhaseNames.Dawn || CurrentDayPhase.Name == DayPhaseNames.Evening || CurrentDayPhase.Name == DayPhaseNames.Night) { NightState.SetValue(); } else { DayState.SetValue(); } if (OnPhaseChange != null) { OnPhaseChange(); } }