// Called when the scene is loaded, instanciate a few gameojbect private void Start() { _controller = GetComponent <Controller2D>(); _animator = GetComponentInChildren <Animator>(); _del = GetComponent <DeletePlayerPrefs>(); _spriteR = GetComponentInChildren <SpriteRenderer>(); // Reset health on scene start maxHealth = 100f; currentHealth = maxHealth; // Calculate once the gravity and the jump velocity using those two physics formula : // dx = v*t + (a*t^2)/2 // vf = v + a*t gravity = -(2 * jumpHeight / Mathf.Pow(timeToJumpApex, 2)); jumpVelocity = Mathf.Abs(gravity) * timeToJumpApex; print("Gravity " + gravity + " jumpVelocity " + jumpVelocity); if (SceneManager.GetActiveScene().buildIndex == 3) { if (PlayerPrefs.GetInt("firstTimeLvl1", 0) == 0) { _controller.showTextBubble("Oh no my spaceship crashed onto this weird looking planet ! I have to look for some items or ressources to try and repair it."); PlayerPrefs.SetInt("firstTimeLvl1", 1); } } }
public override void OnInspectorGUI() { DeletePlayerPrefs dpp = (DeletePlayerPrefs)target; if (GUILayout.Button("Delete PlayerPrefs")) { dpp.DeleteAll(); } }
// Called when the scene is loaded, instanciate a few gameojbect private void Start() { del = GetComponent <DeletePlayerPrefs>(); }
static void Init() { DeletePlayerPrefs window = (DeletePlayerPrefs)EditorWindow.GetWindow(typeof(DeletePlayerPrefs)); window.Show(); }