IEnumerator RestartEverything() { SceneManager.LoadScene("Floor 1"); yield return(new WaitForFixedUpdate()); player = Player_S.self.gameObject; AudioManager = AudioManager_S.self; canvas = Canvas_S.self; canvasAsset = Canvas_S.self.GetComponent <Canvas>(); judgingSystem = JudgingSystem_S.self; secondCamera = SecondCamera_S.self.GetComponent <Camera>(); secondCamera.enabled = false; mainCamera = Camera_S.self.GetComponent <Camera>(); level = 1; canvas.getLevelUIText().text = "level " + level; QnA_S[] array = Resources.LoadAll <QnA_S>("Questions"); // takes all the QnA_S files from Resources for (int i = 0; i < array.Length; i++) { qnaArray.Add(array[i]); } BuildLevel(); }
public void CannotChangeLevel() { Canvas_S.local().QuestUI.wrongSequence(); questionsWrong++; canEarnPoints = false; }
public void CanChangeLevel() { Debug.Log("Next Level Enabled"); Canvas_S.local().QuestUI.rightSequence(); if (canEarnPoints) { questionsRight++; } else { canEarnPoints = true; } canGoToNext = true; }
// Use this for initialization protected void Start() { gameController = GameController_S.self; mainCamera = Camera_S.self.GetComponent <Camera>(); playerSprite = transform.GetChild(0).gameObject; spriteRigid = playerSprite.GetComponent <Rigidbody>(); animator = playerSprite.GetComponent <Animator>(); rigid = GetComponent <Rigidbody2D>(); canvasResources = canvas.GetComponent <Canvas_S>(); cameraShake = gameController.gameObject.GetComponent <CameraShake_S>(); invincibilityFlashTicks = (int)((invincibilitySeconds - 0.28f) / 0.16f); }
void Awake() { if (self == null) { self = this; DontDestroyOnLoad(gameObject); // Basic method to remain even after scene load GameController_S.maintainedScripts.Add(gameObject); } else { Destroy(gameObject); } HealthUI = HealthUIAsset.GetComponent <Health_S>(); QuestUI = QuestUIAsset.GetComponent <QuestionText_S>(); }
// Start is called before the first frame update void Start() { playerSprite = transform.parent.GetChild(0).gameObject; cameraShake = GameController_S.self.gameObject.GetComponent <CameraShake_S>(); gunSprite = transform.GetChild(0).gameObject; muzzle = transform.GetChild(1).gameObject; firingSound = GetComponent <AudioSource>(); gunSprite.GetComponent <SpriteRenderer>().sprite = gun.weapon; // Sets Gun Sprite to the Scriptable Object's Sprite muzzle.transform.localPosition.Set(gun.muzzleLocationX, gun.muzzleLocationY, 0); // Sets the Muzzle Location if (gun.childGameObject != null) // Tests and Creates Child of Gun { childSprite = Instantiate(gun.childGameObject, gunSprite.transform); gunSprite.GetComponent <GunLayerManagement_S>().setChildSprite(childSprite); } animator = transform.GetChild(0).GetComponent <Animator>(); animator.runtimeAnimatorController = gun.animation; // Sets the Animation Controller of the Sprite // Sets different aspects of the gun firingSound.clip = gun.firingSound; fireRate = gun.fireRate; totalBullets = gun.bulletCount - gun.clipSize; clipSize = gun.clipSize; currentBullets = gun.clipSize; reloadSpeed = gun.reloadSpeed; reloadSound = gun.reloadSound; canvasResources = canvas.GetComponent <Canvas_S>(); // Gets Canvas Script of the game; gunUIText = canvasResources.getGunUIText(); // Gets the Gun UI Text from the Canvas Script; gunUIText.color = Color.blue; gunUIText.text = "staples x " + currentBullets; }
// Use this for initialization void Start() { instance = this; }