protected virtual void InteractableObjectUsed(object sender, InteractableObjectEventArgs e) { ETR_IceCube.ChangeHeatState(); if (fireEffect.activeSelf) { fireEffect.SetActive(false); } else { fireEffect.SetActive(true); } burnerControl.enabled = false; burnerEvent.Invoke(); }
// Update is called once per frame void Update() { //if user changed the time if (userInput.Equals(false)) { //if user does not do anything to the clock, it is a normal clock //every second gameHourAngle += Time.deltaTime * hoursDegrees; //gameHourAngle = gameHourAngle % 360f; gameMinuteAngle += Time.deltaTime * minutesDegrees; //gameHourAngle = gameMinuteAngle % 360f; } else { //minute can not be changed //if (mOrH.Equals(true)){ //minute is changed // //current hour angle sum // gameHourAngle += angle/12f; // //gameHourAngle = gameHourAngle % 360f; // //current hour angle sum // gameMinuteAngle += angle; // //gameMinuteAngle = gameMinuteAngle % 360f; // if (hour >= 4 && hour <= 8) // { // // 4AM - 8AM increase from 0 to 1.5 // //per min 0.375/60 per min angle 0.375/1800 // assistLight.intensity = assistLight.intensity > 1.5f ? 1.5f : assistLight.intensity + (0.375f / 1800f * angle); ; //angle is hour changed // } // else if (hour >= 16 && hour <= 20) // { // assistLight.intensity = assistLight.intensity < 0f ? 0f : assistLight.intensity - (0.375f / 1800f) * angle; //angle is hour changed; // } //} //else{ //hour is changed //current hour angle sum gameHourAngle += angle; //gameHourAngle = gameHourAngle % 360f; //current hour angle sum gameMinuteAngle += 12f * angle; //gameMinuteAngle = gameMinuteAngle % 360f; //Debug.Log("Passed second:" + angle * 120f); ETR_IceCube.MeltIce(angle * 120f, true); //} userInput = false; //let the clock continue run second = 0; //audio audioControl(); } gameSecondAngle += Time.deltaTime * secondsDegrees; secondHand.localRotation = Quaternion.Euler(0f, 0f, gameSecondAngle); hourHand.localRotation = Quaternion.Euler(0f, 0f, gameHourAngle); minuteHand.localRotation = Quaternion.Euler(0f, 0f, gameMinuteAngle); //range the time int tmph = (int)Math.Floor(gameHourAngle % 720f / 30f); hour = tmph >= 0 ? tmph : 24 + tmph; int tmpm = (int)Math.Floor(gameMinuteAngle % 360f / 6f); minute = tmpm >= 0 ? tmpm : 60 + tmpm; //the second can not be changed and no negative situation second = (int)Math.Floor(gameSecondAngle % 360f / 6f); sunLight.rotation = Quaternion.Euler(-90f - gameHourAngle / 2, 342.8f, -10.71399f); //Debug.Log(hour + " " + minute); second = 0; //audio audioControl(); //assist light if (hour >= 4 && hour <= 8) { //per hour 0.375 per hour angle = 0.375/30 assistLight.intensity = assistLight.intensity > 1.5f ? 1.5f : assistLight.intensity + (0.375f / 30f * angle);; } else if (hour >= 16 && hour <= 20) { assistLight.intensity = assistLight.intensity < 0f ? 0f : assistLight.intensity - (0.375f / 30f) * angle; } }