I need a game over(UI image) to appear after timer reaches 0

So here is my timer script that works fine. I need it to activate the game over(UI image ) when the timer reaches 0.I tried attaching a game over script to the UI image ( GOS script)….. no luck

using System.Collections; using System.Collections.Generic; using UnityEngine; using UnityEngine.UI;

public class Timer : MonoBehaviour { public Text gametimer; public float timeLeft; public GameObject Gameover; public Text gameovertext;

// Start is called before the first frame update void Start() {       }  // Update is called once per frame void Update() {     if (timeLeft > 0)      {         timeLeft -= Time.deltaTime;     }     else      {         timeLeft = 0;      }      displaytime(timeLeft);  } void displaytime(float timeToDisplay) {     if (timeToDisplay < 0)     {         timeToDisplay = 0;         Debug.Log("Game Ova YOung!!!");              }          float minutes = Mathf.FloorToInt(timeToDisplay / 60);     float seconds = Mathf.FloorToInt(timeToDisplay % 60);      gametimer.text = string.Format("{0:00}:{1:00}", minutes, seconds); }            } 

//////// Game over screen script below

using System.Collections; using System.Collections.Generic; using UnityEngine;

public class GOS : MonoBehaviour { GameObject GameOverScreen; public Timer timer;

// Start is called before the first frame update void Start() {     timer = GetComponent<Timer>();     GameOverScreen.SetActive(false); }  // Update is called once per frame void Update() 

{ if (timer = null) { GameOverScreen.SetActive(true); }

} 

}

Determine whether there exists a path in a directed acyclical graph that reaches all nodes without revisiting a node

For this I came up with a DFS recursion.

Do DFS from any node and keep doing it until all nodes are Exhausted. I.E. pick the next unvisited node once you cant keep recursing.

The element with the highest post number or the last element you visit should be the first element in your topological ordering.

Now do another DFS recursion that executes on every node called DFS_find:

DFS_find(Node): if (node has no neighbors): return 1; otherwise: return 1 + the maximum of DFS_find(Node) for all neighboring nodes

Execute DFS_find(Node) on the first node in your topological ordering. If it returns a number equal to the number of vertices, then a directed path that crosses every node once, exists. Otherwise it does not.

How can I prove whether or not this algorithm is correct?

I think this may be a little less time efficient than the classical way to just do a topological sort and then check if each consecutive pair has an edge between them.

Find where an InterpolatingFunction reaches over a certain value

I used NDSolve in order to solve some PDE, and got a solution $ u(x,t)$ in the type of InterpolatingFunction.

I know that $ u(x,t)$ is strictly monotonically decreasing in $ x$ at all times $ t$ (namely $ \forall t \quad x_1\!<x_2 \Rightarrow u(x_1,t) < u(x_2,t)$ ). My goal is to calculate, for each time $ t$ , what is the minimal value $ x_0$ that satisfies $ u(x_0,t) \leq u_0$ for some constant $ u_0$ .

What I tried is

xt = {}; For[t = 0.1, t <= 10, t = t + 0.1,  x0 = NSolve[u[x, t] == u0, x];  xt = Join[xt, {{x /. x0[[1]], t}}];  ] 

but apart from probably being inefficient, I am afraid NSolve is not the appropriate function here (since it does not exploit my knowledge of monotony). Any other suggestions?

By the way, I know where $ x_0$ should approximately be, so I tried also FindRoot with this initial guess, but it was not any better.

Thanks a lot!

MATE – Language swtiching using shortcut stops once it reaches the last language in the list

I had 3 languages (EN, RU, HE) which were switched by win+space and everything worked fine. Now I have added SK to the list, and once the cycle comes to SK it never continues to the start of the list, while this works perfectly with alt+shift. I guess something is wrong with win key on Slovak layout, could you please give some directions on how to fix this? Attached layout configuration. Ubuntu 18.04.2 LTS, MATE 1.20.1

enter image description here

What is the best way to write a loop that never reaches it’s end (continue/return) in python

# Standard multi choice question template def multiChoiceQuestion(options: list):     while True:         print("\nEnter the number of your choice - ")         for x in len(options):             print(str((x + 1)) + ". " + options[x])         print("\n")         try:             answer = int(input())         except ValueError:             print("Doesn't seem like a number! Try again!")             continue         if answer < 1 or answer > len(options):             print("That option does not exist! Try again!")             continue         return answer 

I created a template to ask a multi choice question in python. The loop will never reach it’s end, since there is always a continue or a return statement. Is the while True condition appropriate for it?

What happens if a wizard reaches level 20 but has no 3rd-level spells that they can use with the Signature Spells feature?

At level 20, a wizard gains the Signature Spells feature. This allows them to choose two 3rd-level spells, and from then on they always have those spells prepared and can cast them once each without using a spell slot between rests.

What happens though, if a wizard reaches level 20 and does not have two 3rd-level spells in their spellbook for some reason? Is the ability suspended until they scribe two such spells in their spellbook?

sql – rolling sum till it reaches certain value and calculate duration

I have a requirement where I need to know when the sum(value) reaches certain point and calculate duration. Below is the sample table.

create table sample (dt timestamp, value real); insert into sample values (‘2019-01-20 00:29:43+00 ‘,0.2948),(‘2019-01-20 00:35:06+00 ‘,0.2948),(‘2019-01-20 00:35:50+00 ‘,0.2948), (‘2019-01-20 00:36:32+00 ‘,0.2948),(‘2019-01-20 00:37:20+00 ‘,0.2948),(‘2019-01-20 00:41:30+00 ‘,0.4261), (‘2019-01-20 00:42:28+00 ‘,0.4261),(‘2019-01-20 00:43:14+00 ‘,0.4261),(‘2019-01-20 00:44:18+00 ‘,0.4261);

select * from sample order by dt; dt | value
———————+——–

2019-01-20 00:29:43 | 0.2948

2019-01-20 00:35:06 | 0.2948

2019-01-20 00:35:50 | 0.2948

2019-01-20 00:36:32 | 0.2948

2019-01-20 00:37:20 | 0.2948

2019-01-20 00:41:30 | 0.4261

2019-01-20 00:42:28 | 0.4261

2019-01-20 00:43:14 | 0.4261

2019-01-20 00:44:18 | 0.4261

Now my requirement is to calculate cumulative sum of next records to see when the sum(value) reaches above 1.0 (it can be 1 records or n number of records) and once I find that point, I need to calculate time difference between current record and record where sum(value) reaches 1.

Essentially I want output in below format.

     dt         | value | sum(value)| time_at_sum(value)_1| Duration 

———————+——–+——————————————

2019-01-20 00:29:43| 0.29 | 1.01 | 2019-01-20 00:35:50 | 00:06:07

2019-01-20 00:35:06| 0.31 | 1.31 | 2019-01-20 00:37:20 | 00:02:14

2019-01-20 00:35:50| 0.41 | 1.00 | 2019-01-20 00:37:20 | 00:01:30

2019-01-20 00:36:32| 0.26 | 1.01 | 2019-01-20 00:41:30 | 00:04:58

2019-01-20 00:37:20| 0.33 | 1.10 | 2019-01-20 00:42:28 | 00:05:08

2019-01-20 00:41:30| 0.42 | 1.29 | 2019-01-20 00:43:14 | 00:01:44

2019-01-20 00:42:28| 0.35 | 1.12 | 2019-01-20 00:44:18 | 00:01:50

2019-01-20 00:43:14| 0.52 | NULL | – | –

2019-01-20 00:44:18| 0.25 | NULL | – | –

Anyone has ideas or pointers on how to deal with above requirement?

TableView: Get Notified When Scroll Reaches Bottom/ Top of Table

I can listen for scroll events:

tableView.addEventFilter(javafx.scene.input.ScrollEvent.SCROLL,         new EventHandler<javafx.scene.input.ScrollEvent>() {             @Override             public void handle(final javafx.scene.input.ScrollEvent scrollEvent) {             System.out.println("Scrolled.");              }         }); 

But How can I be notified if the bottom/ top of the table is reached?