void Awake() { clock = GameObject.FindGameObjectWithTag("Clock").GetComponent <CentralClock>(); if (clock == null) { Debug.LogError("SEASONALFADE " + this.name + ": No clock could be found, please remember to tag the object with the CentralClock script with the tag 'Clock' "); Debug.Break(); } if (minutesToFade < 0) { Debug.LogError("SEASONALFADE " + this.name + ": The minutesToFade parameter can not be negative"); } renderer = GetComponent <MeshRenderer>(); if (renderer == null) { Debug.LogError("SEASONALFADE: GameObject " + this.name + "Needs a Renderer to make moonPhases visible"); Debug.Break(); } rend = GetComponent <Renderer>(); if (rend == null) { Debug.LogError("SEASONALFADE: GameObject containing the script needs a renderer"); } opacityChangePerSecond = 1.0f / ((float)minutesToFade * 60); if (debug) { Debug.Log("OPACITY CHANGE PER SECOND: " + opacityChangePerSecond + "\n" + "CURRENT OPACITY: " + rend.material.color.a); } }
//internal altributes initialization private void Awake() { //day to dusk color change dayToDusk_r = (duskAndDown.r - day.r) / (startMinutesBeforeDawnDusk * 60); dayToDusk_g = (duskAndDown.g - day.g) / (startMinutesBeforeDawnDusk * 60); dayToDusk_b = (duskAndDown.b - day.b) / (startMinutesBeforeDawnDusk * 60); dayToDusk_a = (duskAndDown.a - day.a) / (startMinutesBeforeDawnDusk * 60); //dusk to night color change duskToNight_r = (night.r - duskAndDown.r) / (startMinutesBeforeDawnDusk * 60); duskToNight_g = (night.g - duskAndDown.g) / (startMinutesBeforeDawnDusk * 60); duskToNight_b = (night.b - duskAndDown.b) / (startMinutesBeforeDawnDusk * 60); duskToNight_a = (night.a - duskAndDown.a) / (startMinutesBeforeDawnDusk * 60); //night to dawn color change nightToDawn_r = (duskAndDown.r - night.r) / (startMinutesBeforeDawnDusk * 60); nightToDawn_g = (duskAndDown.g - night.g) / (startMinutesBeforeDawnDusk * 60); nightToDawn_b = (duskAndDown.b - night.b) / (startMinutesBeforeDawnDusk * 60); nightToDawn_a = (duskAndDown.a - night.a) / (startMinutesBeforeDawnDusk * 60); //dawn to day color change dawnToDay_r = (day.r - duskAndDown.r) / (startMinutesBeforeDawnDusk * 60); dawnToDay_g = (day.g - duskAndDown.g) / (startMinutesBeforeDawnDusk * 60); dawnToDay_b = (day.b - duskAndDown.b) / (startMinutesBeforeDawnDusk * 60); dawnToDay_a = (day.a - duskAndDown.a) / (startMinutesBeforeDawnDusk * 60); clock = GameObject.FindGameObjectWithTag("Clock").GetComponent <CentralClock>(); if (clock == null) { Debug.LogError("CLOUDCOLOR " + this.name + ": No clock could be found, please remember to tag the object with the CentralClock script with the tag 'Clock' "); Debug.Break(); } if (startMinutesBeforeDawnDusk < 0) { Debug.LogError("CLOUDCOLOR " + this.name + ": The minutesToFade parameter can not be negative"); } if (endMinutesAfterDawnDusk < 0) { Debug.LogError("CLOUDCOLOR " + this.name + ": The minutesToFade parameter can not be negative"); } /* * renderer = GetComponent<Renderer>(); * if (renderer == null) { * Debug.LogError("CLOUDCOLOR: GameObject " + this.name + "Needs a Renderer to apply the color changes"); * Debug.Break(); * } */ light = GetComponent <Light>(); if (light == null) { Debug.LogError("CLOUDCOLOR: GameObject " + this.name + "Needs a light to to apply the color changes"); Debug.Break(); } }
//internal altributes initialization private void Awake() { clock = GameObject.FindGameObjectWithTag("Clock").GetComponent <CentralClock>(); if (clock == null) { Debug.LogError("SEASONALCOLOR " + this.name + ": No clock could be found, please remember to tag the object with the CentralClock script with the tag 'Clock' "); Debug.Break(); } }
// Use this for initialization void Start() { //Getting Clock reference clock = GameObject.FindGameObjectWithTag("Clock").GetComponent <CentralClock>(); if (clock == null) { Debug.LogError("GUI: No clock could be found, please remember to tag the object with the CentralClock script"); Debug.Break(); } }
//private Vector3 sunRotationAxis; #endregion Private Atributes public void Awake() { //Getting Clock reference clock = GameObject.FindGameObjectWithTag("Clock").GetComponent <CentralClock>(); if (clock == null) { Debug.LogError("SUN/MOON ROTATION: No clock could be found, please remember to tag the object with the CentralClock script"); Debug.Break(); } //not sun warning if (!sun) { Debug.LogWarning("SUN/MOON ROTATION" + this.name + ": has sun value set so false, it will be asumed a moon"); } }
void Awake() { clock = GameObject.FindGameObjectWithTag("Clock").GetComponent <CentralClock>(); if (clock == null) { Debug.LogError("MOONPHASES: No clock could be found, please remember to tag the object with the CentralClock script with the tag 'Clock' "); Debug.Break(); } renderer = GetComponent <MeshRenderer>(); if (renderer == null) { Debug.LogError("MOONPHASES: GameObject " + this.name + "Needs a Renderer to make moonPhases visible"); Debug.Break(); } if (Cycle_Length <= 0) { Debug.LogError("MOONPHASES: The Moon Cycle cannot have negative or zero length"); Debug.Break(); } if (moonPhases.Length > Cycle_Length) { Debug.LogError("MOONPHASES: There cannot be more phases than days in a cycle"); Debug.Break(); } if (moonPhases.Length % 2 == 1) { Debug.LogError("MOONPHASES: There seems to be an odd number of moonPhases. Please remember that the first phase shoud not be repeated at the end of the cycle."); Debug.Break(); } for (int i = 0; i < moonPhases.Length; i++) { if (moonPhases[i] == null) { Debug.LogError("MOONPHASES: Ther ecan not be null moon phase images"); Debug.Break(); } } calculatePhaseLengths(); phaseIndex = 0; daysSincePhaseChange = 1; renderer.material = moonPhases[0]; }
//internal altributes initialization private void Awake() { clock = GameObject.FindGameObjectWithTag("Clock").GetComponent <CentralClock>(); if (clock == null) { Debug.LogError("SEASONALCOLOR " + this.name + ": No clock could be found, please remember to tag the object with the CentralClock script with the tag 'Clock' "); Debug.Break(); } renderer = GetComponent <Renderer>(); if (renderer == null) { Debug.LogError("SEASONALCOLOR: GameObject " + this.name + "Needs a Renderer to make moonPhases visible"); Debug.Break(); } Season[] s = GetSeasons(); //TODO: estan ya en la posicion seasonIndex //TODO: comprobar que los dias de transicion son menores o iguales que la duracion de la estacion mas corta. transitionValues = new float[colors.Length, 4]; // calculando los valores de transicion por segundo for (int i = 0; i < colors.Length; i++) { transitionValues[i, R] = (colors[s[i].next_season.GetIndex()].r - colors[i].r) / (transiotion_days * 24 * 3600); transitionValues[i, G] = (colors[s[i].next_season.GetIndex()].g - colors[i].g) / (transiotion_days * 24 * 3600); transitionValues[i, B] = (colors[s[i].next_season.GetIndex()].b - colors[i].b) / (transiotion_days * 24 * 3600); transitionValues[i, A] = (colors[s[i].next_season.GetIndex()].a - colors[i].a) / (transiotion_days * 24 * 3600); if (debug) { Debug.Log("Transition values for seasosn: " + i + s[i].name); Debug.Log("color on season: " + colors[i]); Debug.Log("Color on next season: " + colors[s[i].next_season.GetIndex()]); Debug.Log("TRANSITION VALUES: \n " + "\r R : " + transitionValues[i, R] + "\t " + ((colors[s[i].next_season.GetIndex()].r - colors[i].r) + "\t " + (transiotion_days * 24 * 3600)) + "\n" + "\r G : " + transitionValues[i, G] + "\t " + ((colors[s[i].next_season.GetIndex()].g - colors[i].g) + "\t" + (transiotion_days * 24 * 3600)) + "\n" + "\r B : " + transitionValues[i, B] + "\t " + ((colors[s[i].next_season.GetIndex()].b - colors[i].b) + "\t" + (transiotion_days * 24 * 3600)) + "\n" + "\r A : " + transitionValues[i, A] + "\t " + ((colors[s[i].next_season.GetIndex()].a - colors[i].a) + "\t" + (transiotion_days * 24 * 3600)) + "\n"); } } }
public void setClock() { clock = GameObject.FindGameObjectWithTag("Clock").GetComponent <CentralClock>(); }