void OnTriggerEnter(Collider colSend) { //atStationStatus++; //station = true; atStation = true; pnMessage newMessage = new pnMessage(); //newMessage.atStation = atStationStatus; newMessage.atStationStatus = atStation; newMessage.status = 1; dataServer.Publish() .Channel(channelName) .Message(newMessage) .Async((result, status) => { if (!status.Error) { Debug.Log(string.Format("Publish Timetoken: {0}", result.Timetoken)); } else { Debug.Log(status.Error); Debug.Log(status.ErrorData.Info); } }); }
void ButtonPublishHandler() { //for(int i =0; i<1000; i++){ //pubnub.Publish().Channel("channel1").Message("test message" +i+ " " + DateTime.Now.Ticks.ToString()).Async((result, status) => { Dictionary <string, string> dict = new Dictionary <string, string>(); dict.Add("k1", "v1"); Dictionary <string, string> meta = new Dictionary <string, string>(); meta.Add("k1", "v1"); pubnub.Publish().Channel("channel1").Meta(meta).Message("test message" + DateTime.Now.Ticks.ToString()).QueryParam(dict).Async((result, status) => { Debug.Log("in Publish"); if (!status.Error) { Debug.Log(string.Format("DateTime {0}, In Publish Example, Timetoken: {1}", DateTime.UtcNow, result.Timetoken)); Display(string.Format("Published: {0}", result.Timetoken)); } else { Debug.Log(status.Error); Debug.Log(status.ErrorData.Info); } }); //} }
void task_on_click() { // when the user clicks the submit button // Create a JSON object from input field input JSONInformation publish_message = new JSONInformation(); publish_message.username = Globals.username; publish_message.text = text_input.text; string publish_message_to_json = JsonUtility.ToJson(publish_message); // Publish the JSON object to the assigned PubNub channel pubnub.Publish().Channel("chatchannel13").Message(publish_message_to_json).Async((result, status) => { if (status.Error) { Debug.Log(status.Error); Debug.Log(status.ErrorData.Info); } else { Debug.Log(string.Format("Publish Timetoken: {0}", result.Timetoken)); } }); text_input.text = ""; }
void OnTriggerEnter(Collider colSend) { currentCount++; dataToSend newMessage = new dataToSend(); newMessage.totalHits = currentCount; newMessage.status = 1; Debug.Log("YOU HIT ME!!"); dataServer.Publish() .Channel(publishChannel) .Message(newMessage) .Async((result, status) => { if (!status.Error) { Debug.Log(string.Format("Publish Timetoken: {0}", result.Timetoken)); } else { Debug.Log(status.Error); Debug.Log(status.ErrorData.Info); } }); }
public void TaskOnClick() { //var usernametext = FieldUsername.text; //var scoretext = FieldScore.text; MyClass myObject = new MyClass(); myObject.username = Variables.player_name; myObject.score = Variables.points.ToString(); string json = JsonUtility.ToJson(myObject); pubnub.Publish() .Channel("beach_cg_channel") .Message(json) .Async((result, status) => { if (!status.Error) { Debug.Log(string.Format("Publish Timetoken: {0}", result.Timetoken)); } else { Debug.Log(status.Error); Debug.Log(status.ErrorData.Info); } }); //Output this to console when the Button is clicked Debug.Log("You have clicked the button!"); }
void TaskOnClick() { var usernametext = FieldUsername.text; // this would be set somewhere else in the code var scoretext = "" + ScoreCounter.Score; MyClass myObject = new MyClass(); myObject.username = FieldUsername.text; myObject.score = "" + ScoreCounter.Score; string minutes = Mathf.Floor(ScoreCounter.TimeElapsed / 60).ToString("00"); string seconds = (ScoreCounter.TimeElapsed % 60).ToString("00"); myObject.time = minutes + ":" + seconds; string json = JsonUtility.ToJson(myObject); pubnub.Publish() .Channel("my_channel") .Message(json) .Async((result, status) => { if (!status.Error) { Debug.Log(string.Format("Publish Timetoken: {0}", result.Timetoken)); HighScoreFields.SetActive(false); } else { Debug.Log(status.Error); Debug.Log(status.ErrorData.Info); } }); //Output this to console when the Button is clicked Debug.Log("You have clicked the button!"); }
// Update is called once per frame void Update() { if (sendTimeController <= Time.deltaTime) { // Restrict how quickly messages are sent. pubnub.Publish() .Channel("MagicLeap") .Message("HelloWorld") .Async((result, status) => { if (!status.Error) { Debug.Log(string.Format("Publish Timetoken: {0}", result.Timetoken)); } else { Debug.Log(status.Error); Debug.Log(status.ErrorData.Info); } }); sendTimeController = 1.0f; // Restrict how quickly messages are sent. } else { sendTimeController -= Time.deltaTime; // Update the timer. } }
void TaskOnClick() { var usernametext = FieldUsername.text; // this would be set somewhere else in the code var scoretext = LabelScore.text; //replace this with the PassScore value MyClass myObject = new MyClass(); myObject.username = FieldUsername.text; //myObject.score = FieldScore.text; //Replace this with the PassScore value myObject.score = LabelScore.text; string json = JsonUtility.ToJson(myObject); pubnub.Publish() .Channel("submit_score") .Message(json) .Async((result, status) => { if (!status.Error) { Debug.Log(string.Format("Publish Timetoken: {0}", result.Timetoken)); } else { Debug.Log(status.Error); Debug.Log(status.ErrorData.Info); } }); //Output this to console when the Button is clicked Debug.Log("You have clicked the button!"); }
void TaskOnClick() { // When the user clicks the Submit button, // create a JSON object from input field input JSONInformation publishMessage = new JSONInformation(); publishMessage.username = string.Concat(UsernameInput.text, ": "); publishMessage.text = TextInput.text; string publishMessageToJSON = JsonUtility.ToJson(publishMessage); // Publish the JSON object to the assigned PubNub Channel pubnub.Publish() .Channel(channel) .Message(publishMessageToJSON) .Async((result, status) => { if (status.Error) { Debug.Log(status.Error); Debug.Log(status.ErrorData.Info); } else { Debug.Log(string.Format("Publish Timetoken: {0}", result.Timetoken)); } }); TextInput.text = ""; }
void Update() { if (!handed) { if (GetGesture(MLHands.Left, MLHandKeyPose.Thumb) || GetGesture(MLHands.Right, MLHandKeyPose.Thumb)) { handed = true; pubnub.Publish() .Channel("tp") .Message("l1") .Async((result, status) => { if (!status.Error) { Debug.Log(string.Format("Publish Timetoken: {0}", result.Timetoken)); } else { Debug.Log(status.Error); Debug.Log(status.ErrorData.Info); } }); onText.color = Color.green; // Set color to green. onGesture.color = Color.green; // Set color to green. onTimeLeft = 0.75f; // Transition color back to white. StartCoroutine(NextScene()); } } if (onTimeLeft > Time.deltaTime) { onText.color = Color.Lerp(onText.color, Color.white, Time.deltaTime / onTimeLeft); // Calculate interpolated color. onGesture.color = Color.Lerp(onGesture.color, Color.white, Time.deltaTime / onTimeLeft); // Calculate interpolated color. onTimeLeft -= Time.deltaTime; // Update the timer. } }
// Update is called once per frame void Update() { animator.SetFloat("Horizontal2", Input.GetAxis("Horizontal")); animator.SetFloat("Vertical2", Input.GetAxis("Vertical")); Vector2 moveInput = new Vector2(Input.GetAxis("Horizontal"), Input.GetAxis("Vertical")); Debug.Log(moveInput); moveVelocity = moveInput.normalized * speed; if (hasShell == true) { animator.SetBool("hasShell2", true); InShell = true; } if (InShell == true) { if (hasShell == false) { animator.SetBool("InShell2", false); } else { animator.SetBool("InShell2", true); } } Dictionary <string, object> message = new Dictionary <string, object>(); message.Add("x", this.transform.position.x); message.Add("y", this.transform.position.y); dataServer.Publish().Channel("P4").Message(message) .Async((a, b) => { }); }
public void TaskOnClick() { Debug.Log(PlayerPrefs.GetString("EMAIL")); var usernametext = PlayerPrefs.GetString("EMAIL");// this would be set somewhere else in the code var scoretext = PlayerPrefs.GetInt("Score"); MyClass myObject = new MyClass(); myObject.username = PlayerPrefs.GetString("EMAIL"); myObject.score = PlayerPrefs.GetInt("Score").ToString(); string json = JsonUtility.ToJson(myObject); pubnub.Publish() .Channel("LEaderBoardchannel") .Message(json) .Async((result, status) => { if (!status.Error) { Debug.Log(string.Format("Publish Timetoken: {0}", result.Timetoken)); log.text = string.Format("Publish Timetoken: {0}", result.Timetoken); } else { Debug.Log(status.Error); Debug.Log(status.ErrorData.Info); } }); //Output this to console when the Button is clicked Debug.Log("You have clicked the button!"); }
void HandleOnTriggerDown(byte controllerId, float value) { PNConfiguration pnConfiguration = new PNConfiguration(); pnConfiguration.PublishKey = "pub-c-86694f64-f8a5-4dea-a382-d99cef5f71e9"; pnConfiguration.SubscribeKey = "sub-c-ef60f02c-80b8-11e9-bc4f-82f4a771f4c5"; pnConfiguration.LogVerbosity = PNLogVerbosity.BODY; pnConfiguration.UUID = "MagicLeap"; pnConfiguration.ReconnectionPolicy = PNReconnectionPolicy.LINEAR; PubNub pubnub = new PubNub(pnConfiguration); pubnub.Publish() .Channel("cube") .Message("BumperPress") .Async((result, status) => { if (!status.Error) { Debug.Log("Bumper Press"); } else { Debug.Log(status.Error); Debug.Log(status.ErrorData.Info); } }); }
void ButtonPublishHandler() { //for(int i =0; i<1000; i++){ //pubnub.Publish().Channel("channel1").Message("test message" +i+ " " + DateTime.Now.Ticks.ToString()).Async((result, status) => { pubnub.Publish().Channel("channel1").Message("test message" + DateTime.Now.Ticks.ToString()).Async((result, status) => { Debug.Log("in Publish"); if (!status.Error) { Debug.Log(string.Format("DateTime {0}, In Publish Example, Timetoken: {1}", DateTime.UtcNow, result.Timetoken)); Display(string.Format("Published: {0}", result.Timetoken)); } else { Debug.Log(status.Error); Debug.Log(status.ErrorData.Info); } }); //} }
// send a message throught pub nub public void PublishMessage(String channel, Dictionary <string, object> messageToSend) { _pubnub.Publish() .Channel(channel) .Message(messageToSend) .Async((result, status) => { if (!status.Error) { return; } Debug.Log(status.Error); Debug.Log(status.ErrorData.Info); }); }
public async Task Publish(int number) { int delay = int.Parse(ConfigurationManager.AppSettings["delay"] ?? "200"); string channel = ConfigurationManager.AppSettings["channel"] ?? "testchannel"; for (int i = 0; i < number; i++) { string message = $"Message {i}"; await PubNub.Publish().Channel(channel).Message(message).ExecuteAsync(); Log.PublishLog(message); //PubNub.Publish().Channel(channel).Message(message).Execute // (new PNPublishResultExt((result, status) => { Log.PublishLog(message); })); Thread.Sleep(delay); // delay between calls } }
///------------------------------------------------------------------------------------------------- /// <summary> Sends a message to Alexa Skill. NOTE: Skill will only recieve the message if it is listening for a response. </summary> /// /// <remarks> Austin Wilson, 9/15/2018. </remarks> /// /// <param name="message"> The message. </param> /// <param name="callback"> The callback. </param> ///------------------------------------------------------------------------------------------------- public void SendToAlexaSkill(object message, Action <MessageSentEventData> callback) { pubnub.Publish() .Channel(pubChannel) .Message(message) .Async((result, status) => { if (!status.Error) { // log("SendToAlexa: " + "Message sent!"); RaiseMessageSent(false, message, callback); } else { // log("SendToAlexa: " + status.ErrorData.Ex, true); RaiseMessageSent(true, null, callback, status.ErrorData.Ex); } }); }
void HandleOnTriggerDown(byte controllerId, float value) { if (looking) // Send a message to take the game object if the user is looking and the trigger was pulled. { pubnub.Publish() .Channel(meshRenderer.name) // Send a message to the channel for the game object. .Message(pn_uuid) // Send the UUID for this client. .Async((result, status) => { if (!status.Error) { Debug.Log(string.Format("Publish Timetoken: {0}", result.Timetoken)); } else { Debug.Log(status.Error); Debug.Log(status.ErrorData.Info); } }); } }
void CriarRanking() { //var usernametext = FieldUsername.text; //var scoretext = FieldScore.text; MyClass myObject = new MyClass(); myObject.username = Variables.player_name; myObject.score = Variables.points.ToString(); string json = JsonUtility.ToJson(myObject); // Use this for initialization PNConfiguration pnConfiguration = new PNConfiguration(); pnConfiguration.PublishKey = "<PUT-HERE-THE-PUBNUB-PUBLISH-KEY>"; pnConfiguration.SubscribeKey = "<PUT-HERE-THE-PUBNUB-SUBSCRIBE-KEY>"; pnConfiguration.LogVerbosity = PNLogVerbosity.BODY; pnConfiguration.UUID = Random.Range(0f, 999999f).ToString(); pubnub = new PubNub(pnConfiguration); pubnub.Publish() .Channel("beach_cg_channel") .Message(json) .Async((result, status) => { if (!status.Error) { Debug.Log(string.Format("Publish Timetoken: {0}", result.Timetoken)); } else { Debug.Log(status.Error); Debug.Log(status.ErrorData.Info); } }); //Output this to console when the Button is clicked Debug.Log("You have clicked the button!"); }
void CriarRanking() { //var usernametext = FieldUsername.text; //var scoretext = FieldScore.text; MyClass myObject = new MyClass(); myObject.username = Variables.player_name; myObject.score = Variables.points.ToString(); string json = JsonUtility.ToJson(myObject); // Use this for initialization PNConfiguration pnConfiguration = new PNConfiguration(); pnConfiguration.PublishKey = "pub-c-552fdd0f-5c19-4557-baa4-1f8c2263b4ed"; pnConfiguration.SubscribeKey = "sub-c-b55b4074-8312-11e9-84b9-2e401b25e788"; pnConfiguration.LogVerbosity = PNLogVerbosity.BODY; pnConfiguration.UUID = Random.Range(0f, 999999f).ToString(); pubnub = new PubNub(pnConfiguration); pubnub.Publish() .Channel("beach_cg_channel") .Message(json) .Async((result, status) => { if (!status.Error) { Debug.Log(string.Format("Publish Timetoken: {0}", result.Timetoken)); } else { Debug.Log(status.Error); Debug.Log(status.ErrorData.Info); } }); //Output this to console when the Button is clicked Debug.Log("You have clicked the button!"); }
public void TaskOnClick() { MyClass myObject = new MyClass(); myObject.username = Variables.player_name; myObject.score = Variables.points.ToString(); string json = JsonUtility.ToJson(myObject); pubnub.Publish() .Channel("beach_cg_channel") .Message(json) .Async((result, status) => { if (!status.Error) { Debug.Log(string.Format("Publish Timetoken: {0}", result.Timetoken)); } else { Debug.Log(status.Error); Debug.Log(status.ErrorData.Info); } }); }
void HandleOnTriggerDown(byte controllerId, float value) { if (currentColor == level) { matchCount.text = level + " / 3"; // Update countdown. if (level == 1) { pubnub.Publish() .Channel("tp") .Message("l2") .Async((result, status) => { if (!status.Error) { Debug.Log(string.Format("Publish Timetoken: {0}", result.Timetoken)); } else { Debug.Log(status.Error); Debug.Log(status.ErrorData.Info); } }); } else if (level == 2) { pubnub.Publish() .Channel("tp") .Message("l3") .Async((result, status) => { if (!status.Error) { Debug.Log(string.Format("Publish Timetoken: {0}", result.Timetoken)); } else { Debug.Log(status.Error); Debug.Log(status.ErrorData.Info); } }); } else if (level == 3) { pubnub.Publish() .Channel("tp") .Message("release") .Async((result, status) => { if (!status.Error) { Debug.Log(string.Format("Publish Timetoken: {0}", result.Timetoken)); } else { Debug.Log(status.Error); Debug.Log(status.ErrorData.Info); } }); MLInput.OnTriggerDown -= HandleOnTriggerDown; MLInput.Stop(); StartCoroutine(NextScene()); // Game over - win } level = level + 1; } else { if (level <= 3) // Back to L1 { level = 1; matchCount.text = "0 / 3"; // Reset countdown. pubnub.Publish() .Channel("tp") .Message("l1") .Async((result, status) => { if (!status.Error) { Debug.Log(string.Format("Publish Timetoken: {0}", result.Timetoken)); } else { Debug.Log(status.Error); Debug.Log(status.ErrorData.Info); } }); } } }
//Original Pubnub Update /* * void Update() * { * if (sendTimeController <= Time.deltaTime) * { // Restrict how often messages can be sent. * if (GetGesture(MLHandTracking.Left, MLHandTracking.HandKeyPose.Thumb) || GetGesture(MLHandTracking.Right, MLHandTracking.HandKeyPose.Thumb)) * { * pubnub.Publish() * .Channel("control") * .Message("on") * .Async((result, status) => { * if (!status.Error) * { * Debug.Log(string.Format("Publish Timetoken: {0}", result.Timetoken)); * } * else * { * Debug.Log(status.Error); * Debug.Log(status.ErrorData.Info); * } * }); * sendTimeController = 0.1f; // Stop multiple messages from being sent. * } * else if (GetGesture(MLHandTracking.Left, MLHandTracking.HandKeyPose.Fist) || GetGesture(MLHandTracking.Right, MLHandTracking.HandKeyPose.Fist)) * { * pubnub.Publish() * .Channel("control") * .Message("off") * .Async((result, status) => { * if (!status.Error) * { * Debug.Log(string.Format("Publish Timetoken: {0}", result.Timetoken)); * } * else * { * Debug.Log(status.Error); * Debug.Log(status.ErrorData.Info); * } * }); * sendTimeController = 0.1f; // Stop multiple messages from being sent. * } * else if (GetGesture(MLHandTracking.Left, MLHandTracking.HandKeyPose.Finger)) * { * pubnub.Publish() * .Channel("control") * .Message("changel") * .Async((result, status) => { * if (!status.Error) * { * Debug.Log(string.Format("Publish Timetoken: {0}", result.Timetoken)); * } * else * { * Debug.Log(status.Error); * Debug.Log(status.ErrorData.Info); * } * }); * sendTimeController = 0.9f; // Stop multiple messages from being sent. * } * else if (GetGesture(MLHandTracking.Right, MLHandTracking.HandKeyPose.Finger)) * { * pubnub.Publish() * .Channel("control") * .Message("changer") * .Async((result, status) => { * if (!status.Error) * { * Debug.Log(string.Format("Publish Timetoken: {0}", result.Timetoken)); * } * else * { * Debug.Log(status.Error); * Debug.Log(status.ErrorData.Info); * } * }); * sendTimeController = 0.9f; // Stop multiple messages from being sent. * } * } * else * { * sendTimeController -= Time.deltaTime; // Update the timer. * } * } */ void Update() { if (sendTimeController <= Time.deltaTime) { // Restrict how often messages can be sent. //Light 1 if (GetGesture(MLHandTracking.Left, MLHandTracking.HandKeyPose.Thumb)) { pubnub.Publish() .Channel("control") .Message("lgt-1-on") .Async((result, status) => { if (!status.Error) { Debug.Log(string.Format("Publish Timetoken: {0}", result.Timetoken)); } else { Debug.Log(status.Error); Debug.Log(status.ErrorData.Info); } }); Debug.Log("Light 1 on"); sendTimeController = 0.1f; // Stop multiple messages from being sent. } else if (GetGesture(MLHandTracking.Left, MLHandTracking.HandKeyPose.Fist)) { pubnub.Publish() .Channel("control") .Message("lgt-1-off") .Async((result, status) => { if (!status.Error) { Debug.Log(string.Format("Publish Timetoken: {0}", result.Timetoken)); } else { Debug.Log(status.Error); Debug.Log(status.ErrorData.Info); } }); Debug.Log("Light 1 off"); sendTimeController = 0.1f; // Stop multiple messages from being sent. } else if (GetGesture(MLHandTracking.Left, MLHandTracking.HandKeyPose.Finger)) { pubnub.Publish() .Channel("control") .Message("lgt-1-changel") .Async((result, status) => { if (!status.Error) { Debug.Log(string.Format("Publish Timetoken: {0}", result.Timetoken)); } else { Debug.Log(status.Error); Debug.Log(status.ErrorData.Info); } }); sendTimeController = 0.9f; // Stop multiple messages from being sent. } else if (GetGesture(MLHandTracking.Right, MLHandTracking.HandKeyPose.Thumb)) //--------------- Light 2 ------------------------------ { pubnub.Publish() .Channel("control") .Message("lgt-2-on") .Async((result, status) => { if (!status.Error) { Debug.Log(string.Format("Publish Timetoken: {0}", result.Timetoken)); } else { Debug.Log(status.Error); Debug.Log(status.ErrorData.Info); } }); sendTimeController = 0.1f; // Stop multiple messages from being sent. Debug.Log("Light 2 on"); } else if (GetGesture(MLHandTracking.Right, MLHandTracking.HandKeyPose.Fist)) { pubnub.Publish() .Channel("control") .Message("lgt-2-off") .Async((result, status) => { if (!status.Error) { Debug.Log(string.Format("Publish Timetoken: {0}", result.Timetoken)); } else { Debug.Log(status.Error); Debug.Log(status.ErrorData.Info); } }); sendTimeController = 0.1f; // Stop multiple messages from being sent. Debug.Log("Light 2 off"); } else if (GetGesture(MLHandTracking.Right, MLHandTracking.HandKeyPose.Finger)) { pubnub.Publish() .Channel("control") .Message("lgt-2-changer") .Async((result, status) => { if (!status.Error) { Debug.Log(string.Format("Publish Timetoken: {0}", result.Timetoken)); } else { Debug.Log(status.Error); Debug.Log(status.ErrorData.Info); } }); sendTimeController = 0.9f; // Stop multiple messages from being sent. } } else { sendTimeController -= Time.deltaTime; // Update the timer. } }
void Update() { if (sendTimeController <= Time.deltaTime) // Restrict how often messages can be sent. { if (GetGesture(MLHands.Left, MLHandKeyPose.Thumb) || GetGesture(MLHands.Right, MLHandKeyPose.Thumb)) { pubnub.Publish() .Channel("control") .Message("on") .Async((result, status) => { if (!status.Error) { Debug.Log(string.Format("Publish Timetoken: {0}", result.Timetoken)); } else { Debug.Log(status.Error); Debug.Log(status.ErrorData.Info); } }); onText.color = Color.green; // Set color to green. onGesture.color = Color.green; // Set color to green. onTimeLeft = 1.0f; // Transition color back to white. sendTimeController = 0.1f; // Stop multiple messages from being sent. } else if (GetGesture(MLHands.Left, MLHandKeyPose.Fist) || GetGesture(MLHands.Right, MLHandKeyPose.Fist)) { pubnub.Publish() .Channel("control") .Message("off") .Async((result, status) => { if (!status.Error) { Debug.Log(string.Format("Publish Timetoken: {0}", result.Timetoken)); } else { Debug.Log(status.Error); Debug.Log(status.ErrorData.Info); } }); offText.color = Color.green; // Set color to green. offGesture.color = Color.green; // Set color to green. offTimeLeft = 1.0f; // Transition color back to white. sendTimeController = 0.1f; // Stop multiple messages from being sent. } else if (GetGesture(MLHands.Left, MLHandKeyPose.Finger)) { pubnub.Publish() .Channel("control") .Message("changel") .Async((result, status) => { if (!status.Error) { Debug.Log(string.Format("Publish Timetoken: {0}", result.Timetoken)); } else { Debug.Log(status.Error); Debug.Log(status.ErrorData.Info); } }); changeText.color = Color.green; // Set color to green. changeGesture.color = Color.green; // Set color to green. changeTimeLeft = 1.0f; // Transition color back to white. sendTimeController = 0.9f; // Stop multiple messages from being sent. } else if (GetGesture(MLHands.Right, MLHandKeyPose.Finger)) { pubnub.Publish() .Channel("control") .Message("changer") .Async((result, status) => { if (!status.Error) { Debug.Log(string.Format("Publish Timetoken: {0}", result.Timetoken)); } else { Debug.Log(status.Error); Debug.Log(status.ErrorData.Info); } }); changeText.color = Color.green; // Set color to green. changeGesture.color = Color.green; // Set color to green. changeTimeLeft = 1.0f; // Transition color back to white. sendTimeController = 0.9f; // Stop multiple messages from being sent. } } else { sendTimeController -= Time.deltaTime; // Update the timer. } if (onTimeLeft > Time.deltaTime) { onText.color = Color.Lerp(onText.color, Color.white, Time.deltaTime / onTimeLeft); // Calculate interpolated color. onGesture.color = Color.Lerp(onGesture.color, Color.white, Time.deltaTime / onTimeLeft); // Calculate interpolated color. onTimeLeft -= Time.deltaTime; // Update the timer. } if (offTimeLeft > Time.deltaTime) { offText.color = Color.Lerp(offText.color, Color.white, Time.deltaTime / offTimeLeft); // Calculate interpolated color. offGesture.color = Color.Lerp(offGesture.color, Color.white, Time.deltaTime / offTimeLeft); // Calculate interpolated color. offTimeLeft -= Time.deltaTime; // Update the timer. } if (changeTimeLeft > Time.deltaTime) { changeText.color = Color.Lerp(changeText.color, Color.white, Time.deltaTime / changeTimeLeft); // Calculate interpolated color. changeGesture.color = Color.Lerp(changeGesture.color, Color.white, Time.deltaTime / changeTimeLeft); // Calculate interpolated color. changeTimeLeft -= Time.deltaTime; // Update the timer. } }