void RestartGame() {
SceneManager.LoadScene(SceneManager.GetActiveScene().name);
}
void PauseGame () {
Time.timeScale = 0;
// ShowPauseMenu();
var hashIndex = window.location.href.indexOf('#'); // 31 | |
var stringBeforeHash = window.location.href.slice(0, hashIndex); | |
console.info('new href', stringBeforeHash); | |
window.location.href = stringBeforeHash; |
using UnityEngine; | |
public class TopDownMovement : MonoBehaviour { | |
public float walkSpeed = 5f; | |
public Boundary boundary; // optional rectangle boundary | |
float maxSpeed = 10f; | |
float curSpeed; |
/* 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 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; |
using System.Collections; | |
// using System.Collections.Generic; | |
using UnityEngine; | |
public class GetGoop : MonoBehaviour { | |
Coroutine mining; | |
void OnTriggerEnter (Collider coll) { |
using UnityEngine; | |
public class TopDownMovement : MonoBehaviour { | |
public float walkSpeed = 5f; | |
public Boundary boundary; // optional rectangle boundary | |
float maxSpeed = 10f; | |
float curSpeed; |
// 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); |
[ | |
{ | |
"name": "Aruba", | |
"callingCode": "297", | |
"translations": { | |
"de": "Aruba", | |
"jp": "アルバ" | |
}, | |
"code": "AW" | |
}, |
// toggle the show/hide for file diffs in github pull requests | |
// this script hides all files with 'zipkey-icons' in the name | |
// and the language files | |
var fileDiffs = document.querySelectorAll('.file-header.js-file-header'); | |
for (const fileDiff of fileDiffs) { | |
const text = fileDiff.innerText; | |
if (text.includes('zipkey-icons') || text.includes('/languages')) { | |
const hideButton = fileDiff.querySelector('.btn-octicon.js-details-target[aria-expanded="true"]'); | |
hideButton && hideButton.click() |