void RestartGame() {
SceneManager.LoadScene(SceneManager.GetActiveScene().name);
}void PauseGame () {
Time.timeScale = 0;
// ShowPauseMenu();| // short-hand functions | |
| const pythag = (a, b) => Math.sqrt(a * a + b * b); | |
| console.log(pythag(3, 4)); | |
| // es6 classes | |
| class Dog { | |
| constructor(anyType = 'nothing', cute = false) { | |
| this.talkThis = anyType; | |
| this.cute = cute; | |
| this.speak = this.speak.bind(this); |
| using UnityEngine; | |
| public class TopDownMovement : MonoBehaviour { | |
| public float walkSpeed = 5f; | |
| public Boundary boundary; // optional rectangle boundary | |
| float maxSpeed = 10f; | |
| float curSpeed; |
| using System.Collections; | |
| // using System.Collections.Generic; | |
| using UnityEngine; | |
| public class GetGoop : MonoBehaviour { | |
| Coroutine mining; | |
| void OnTriggerEnter (Collider coll) { |
| using UnityEngine; | |
| public class GlobalState { | |
| // bool paused = false; | |
| public static int goop = 80; | |
| public static int waveNumber = 1; | |
| public static bool paused = false; | |
| public static void AddGoop (int amount) { | |
| goop += amount; |
| /* GameStatus.cs */ | |
| using UnityEngine; | |
| using System.Collections; | |
| using UnityEngine.SceneManagement; | |
| public class GameStatus : MonoBehaviour { | |
| // There are 3 major ways to persist this data between scene changes. | |
| // 1) Save the info into something persist (PlayerPrefs, a save file) | |
| // - This preserves data even between game executions, not just scene changes |
| using UnityEngine; | |
| public class TopDownMovement : MonoBehaviour { | |
| public float walkSpeed = 5f; | |
| public Boundary boundary; // optional rectangle boundary | |
| float maxSpeed = 10f; | |
| float curSpeed; |
| var hashIndex = window.location.href.indexOf('#'); // 31 | |
| var stringBeforeHash = window.location.href.slice(0, hashIndex); | |
| console.info('new href', stringBeforeHash); | |
| window.location.href = stringBeforeHash; |