/**************************************************************************************** * * * * * Additional_methods * * * * * ****************************************************************************************/ void findControls() { ControllerInputManager.VerticalControl(useController); ControllerInputManager.HorizontalControl(useController); ControllerInputManager.JumpControl(useController); ControllerInputManager.GrabControl(useController); ControllerInputManager.FireControl(useController); ControllerInputManager.PauseControl(useController); ControllerInputManager.WeaponsControl(useController); }
void Awake() { FindPlayer(); if (gm == null) //if gm is null, find the GameMaster object { gm = this; } DontDestroyOnLoad(gm); useController = true; onLadder = false; healthTiles.Add(Instantiate(full, healthTileSpawn1) as Image); healthTiles.Add(Instantiate(full, healthTileSpawn2) as Image); healthTiles.Add(Instantiate(full, healthTileSpawn3) as Image); healthTiles.Add(Instantiate(full, healthTileSpawn4) as Image); healthTiles.Add(Instantiate(full, healthTileSpawn5) as Image); healthTiles.Add(Instantiate(full, healthTileSpawn6) as Image); healthTiles.Add(Instantiate(full, healthTileSpawn7) as Image); healthTiles.Add(Instantiate(full, healthTileSpawn8) as Image); maxHealth = healthContainers * 10; currentHealth = maxHealth; /* Instantiates all the necessary gem counter tiles */ gemCount = 0; counterDigits = 4; gemCounterDigits = new Image[counterDigits]; GameObject counter = GameObject.Find("Gem Counter"); for (int i = 0; i < counterDigits; i++) { gemCounterDigits[i] = counter.transform.GetChild(i).GetComponent <Image>(); } /* Puts number tiles into the array */ numbers = new Sprite[numbersSprites.Length]; for (int i = 0; i < numbersSprites.Length; i++) { numbers[i] = numbersSprites[i]; } /* Gets the weapon counter */ weaponCounter = GameObject.Find("Weapon Counter"); blasterSprite = blaster; swordSprite = sword; /* Instantiates ammo counter tiles */ GameObject ammoCounter = GameObject.Find("Ammo Counter"); ammoDigits = 2; ammoCounterDigits = new Image[ammoDigits]; for (int i = 0; i < ammoDigits; i++) { ammoCounterDigits[i] = ammoCounter.transform.GetChild(i).GetComponent <Image>(); } /* upgrade counter stuff */ upgradeCounter = GameObject.Find("Powerup_counter"); neutralSprite = neutral; joySprite = joy; angerSprite = anger; joyG = joyGauge; joyG.fillAmount = 0; angerG = angerGauge; angerG.fillAmount = 0; upgradedSword = false; upgradedBlaster = false; audioManager = AudioManager.instance; if (audioManager == null) { Debug.LogError("No audio manager found."); } /* Pause menu and controller options */ PauseMenu.isPaused = false; useController = false; swordAttack = true; shooter = false; foreach (string s in Input.GetJoystickNames()) { print("device name: " + s); if (s.Equals("Wireless Controller") || s.Equals("Sony Interactive Entertainment Wireless Controller")) { useController = true; } } print("controller? " + useController); ControllerInputManager.VerticalControl(useController); ControllerInputManager.HorizontalControl(useController); ControllerInputManager.JumpControl(useController); ControllerInputManager.GrabControl(useController); ControllerInputManager.FireControl(useController); ControllerInputManager.PauseControl(useController); ControllerInputManager.WeaponsControl(useController); }