// Start is called before the first frame update void Start() { if (PlayerPrefs.GetString("KeyboardScheme") == null) { PlayerPrefs.SetString("KeyboardScheme", "Keyboard_1"); } if (PlayerPrefs.GetString("ControlScheme") == null) { PlayerPrefs.SetString("ControlScheme", "Standard"); } animator = gameObject.GetComponent <Animator>(); // Adds this script as a listener for the event when the player falls from a platform ghostCatcher.AddFallenGhostListener(FallenGhostHandler); // Adds this script as a listener for the game paused event GameManager.AddGamePausedEventListener(GamePausedHandler); // Initialize start position startPosition = transform.position; // Initialize current horizontal Curve to acceleration. currentHCurve = accelerationCurve; // Initialize current vertical Curve to acceleration currentVCurve = accelerationCurve; rb = gameObject.GetComponent <Rigidbody2D>(); sr = GetComponentInChildren <SpriteRenderer>(); availablePortals = GameObject.FindGameObjectWithTag("availablePortals").GetComponent <AvailablePortals>(); InputSystem.onDeviceChange += DeviceChange; gamepadMode = CheckGamepadState(); if (gamepadMode) { // Set preferred control scheme, use standard if none set player.bindingMask = new InputBinding { groups = PlayerPrefs.GetString("ControlScheme", "Standard") }; } else { // Set preferred control scheme, use standard if none set player.bindingMask = new InputBinding { groups = PlayerPrefs.GetString("KeyboardScheme", "Keyboard_1") }; } sounds = GetComponents <AudioSource>(); jumpSound = sounds[0]; landSound = sounds[1]; shootSound = sounds[2]; stompSound = sounds[3]; }
private void Start() { pop = gameObject.GetComponent <AudioSource>(); availablePortals = GameObject.FindGameObjectWithTag("availablePortals").GetComponent <AvailablePortals>(); portals = availablePortals.GetPortals(); PopulateButtons(); }
private void Start() { availablePortals = GameObject.FindGameObjectWithTag("availablePortals").GetComponent <AvailablePortals>(); availablePortals.isInPlaylistMode = false; portals = availablePortals.GetPortals(); PopulateButtons(); }
private void Start() { availablePortals = GameObject.FindGameObjectWithTag("availablePortals").GetComponent <AvailablePortals>(); scoreController = GameObject.FindGameObjectWithTag("scoreController").GetComponent <ScoreController>(); timer = GameObject.FindGameObjectWithTag("Timer").GetComponent <Timer>(); Cursor.visible = true; Time.timeScale = 0; resumeButton.GetComponent <Button>().Select(); DisplayFinalScore(); }
// Start is called before the first frame update void Start() { // Add this script's delegate as a listener for the game paused event GameManager.AddGamePausedEventListener(Pause); // Get a reference to the canvas with buttons attached to this gameobject pauseCanvas = GetComponentInChildren <Canvas>(); // Create a fade canvas pauseCanvas.enabled = false; availablePortals = GameObject.FindGameObjectWithTag("availablePortals").GetComponent <AvailablePortals>(); }
// Start is called before the first frame update void Start() { // Get reference to availablePortals singlton object availablePortals = GameObject.FindGameObjectWithTag("availablePortals").GetComponent <AvailablePortals>(); // Get a reference to the reward for finishing the current level LevelObject newPortal = availablePortals.ActivePortal.reward; // Place portal name in rewardButton rewardButton.text = newPortal.levelName; // Add the new portal to the available portals availablePortals.AwardPortal(newPortal); }
// Start is called before the first frame update void Start() { player = GameObject.FindGameObjectWithTag("Player").transform; // Listen for when player takes damage player.gameObject.GetComponent <playerController>().damageTaken.AddListener(HandleHealthLoss); parentObject = gameObject.transform.parent; availablePortals = GameObject.FindGameObjectWithTag("availablePortals").GetComponent <AvailablePortals>(); healthBar = GetComponent <Image>(); healthBar.fillAmount = 1f; offsetFromPlayer = new Vector3(.035f, .8f, 0f); repairRate = damage / 3f; animator = barObject.GetComponent <Animator>(); animator.SetBool("isPulsating", false); }