// Use this for initialization void Start() { body = GetComponent <Rigidbody>(); sc = GetComponent <SphereCollider>(); //victoryText = GameObject.Find("Win").GetComponent<Text>(); myCam = GameObject.Find("Main Camera"); mc = GameObject.Find("MainTheme").GetComponent <Music_Controller>(); }
// Start is called before the first frame update void Awake() { if (instance == null) { instance = this; DontDestroyOnLoad(gameObject); } else if (instance != this) { Destroy(gameObject); } }
void Awake() { if (instance != null) { Debug.Log("More than one Music Manager in scene!"); DestroyImmediate(gameObject); return; } gameMusic = GetComponent <AudioSource> (); instance = this; DontDestroyOnLoad(gameObject); }
public void onCitySky() { print("My current state is : " + state); PlayerFollower pf = Camera.main.GetComponent <PlayerFollower>(); Music_Controller mc = Camera.main.GetComponent <Music_Controller>(); pf.buffer = new Vector3(0, 10, 0); transform.Translate(0, flyingSpeed * Time.deltaTime, 0); if (transform.position.y <= 1.5f) { mc.Tire(); changeState("skyToLand"); print("I am changing my state to state : " + state); } }
// 6) when player is in last street and hits the first LEFT turn public void lastLeftTurn() { print("My current state is : " + state); PlayerFollower pf = Camera.main.GetComponent <PlayerFollower>(); Music_Controller mc = Camera.main.GetComponent <Music_Controller>(); pf.buffer = new Vector3(10, 0, 0); transform.Translate(flyingSpeed * Time.deltaTime, 0, Input.GetAxis("Horizontal") * 0.3f); if (transform.position.x <= -6.5f) { mc.Tire(); changeState("cityEnd"); print("I am changing my state to state : " + state); } happenedOnce = false; }
// 3) when player is in first street and hits the first turn public void firstRightTurn() { print("My current state is : " + state); PlayerFollower pf = Camera.main.GetComponent <PlayerFollower>(); Music_Controller mc = Camera.main.GetComponent <Music_Controller>(); pf.buffer = new Vector3(0, 0, 10); transform.Translate(-Input.GetAxis("Horizontal") * 0.3f, 0, flyingSpeed * Time.deltaTime); if (transform.position.z <= -13) { mc.Tire(); changeState("secondRightTurn"); print("I am changing my state to state : " + state); } happenedOnce = false; }
// 2) when it is landing from sky to the city public void skyToLand() { print("My current state is : " + state); PlayerFollower pf = Camera.main.GetComponent <PlayerFollower>(); Music_Controller mc = Camera.main.GetComponent <Music_Controller>(); pf.buffer = new Vector3(-10, 0, 0); transform.Translate(-flyingSpeed * Time.deltaTime, 0, -Input.GetAxis("Horizontal") * 0.3f); print("Player position : " + transform.position); if (transform.position.x >= 41) { mc.Tire(); changeState("firstRightTurn"); print("I am changing my state to state : " + state); } happenedOnce = false; }
// Use this for initialization void OnEnable() { if (!music.isPlaying) { music.Play(); } if (instance != null && instance != this) { Destroy(this.gameObject); return; } else { instance = this; } DontDestroyOnLoad(this.gameObject); }
// Use this for initialization void Start() { highScoreCalculator = GameObject.Find("High Score Calculator").GetComponent <High_Score_Calculator> (); //first check if they're using the most recent version of the game if (PlayerPrefs.GetInt("Version", 0) != versionNumber) { highScoreCalculator.Reset_All_Scores(); foreach (High_Score_Displayer hsd in hsds) { hsd.update_scores(); } PlayerPrefs.SetInt("Version", versionNumber); } achievementHandler = GameObject.Find("Achievement Handler").GetComponent <Achievement_Script> (); gpgNotification = GameObject.Find("Google Play Notification").GetComponent <GPG_Notification> (); Goto_Game_Mode_Layer(); shutter.Begin_Vertical_Open(); GameObject MCobject = GameObject.FindGameObjectWithTag("Music Controller"); mc = MCobject.GetComponent <Music_Controller> (); mc.Play_Music("Menu"); //just in case this is the first time playing, set Wiz to be for sure unlocked PlayerPrefs.SetInt("Wiz unlocked", 1); //tell achievmement handler to check gamemodes that are supposed to be active achievementHandler.Check_Gamemode_Unlocked(); activeMode = 0; prevMode = 0; ScrollDown.BroadcastMessage("FadeOut", null, SendMessageOptions.DontRequireReceiver); for (int i = 0; i < 4; i++) { OrigButtonSprite[i] = GameButtons[i].GetComponent <Image>().sprite; OrigDescText[i] = Descriptions[i].GetComponent <Text>().text; } GameMode_Unlocker(); if (PlayerPrefs.GetInt("Played Before", 0) == 1) { Destroy(HTPEmphasizer); } }
private void Start() { music_Controller = FindObjectOfType <Music_Controller>(); }
public void OnTriggerEnter(Collider other) { print("What did I colide? " + other.name); print("What is the tag? " + other.tag); DroppyBarController db = Camera.main.GetComponent <DroppyBarController>(); //player collides with another droppy,(max size is 4) //it will get bigger and heavier //it will move slower //droppy bar will be increased if (other.tag == ("Droppy")) { Destroy(other.gameObject); //score++; if (transform.localScale.x < maxScale.x && transform.localScale.y < maxScale.y && transform.localScale.z < maxScale.z) { transform.localScale = sizeExpansion(transform.localScale); db.IncreaseBar(); } else { print("I can't increase the size anymore"); return; } // IT IS FLYING SPEED THAT WILL CHANGE AND UPDATE WILL TAKE CARE OF DIFFERENT STATES WITH DIFFERENT DIRECTIONS THA PLAYER IS MOVING increaseSpeed(flyingSpeed); } //else if (other.tag == "City_Done") //{ // print("I finished city level"); // SceneManager.LoadScene("SF_Info"); //} else if (other.tag == "Sky_Done") { print("I finished Sky level"); SceneManager.LoadScene("SkyToCity"); } else if (other.tag == "Good_Car") { Music_Controller mc = Camera.main.GetComponent <Music_Controller>(); print("What is my size:" + transform.localScale); if (transform.localScale.x >= fractionOfMaxScale.x && transform.localScale.y >= fractionOfMaxScale.y && transform.localScale.z >= fractionOfMaxScale.z) { mc.Accident(); Destroy(other.gameObject); } else { mc.Sad(); Invoke("reloadTheCityScene", 3); } } else if (other.tag == "Bad_Car") { Music_Controller mc = Camera.main.GetComponent <Music_Controller>(); mc.Sad(); Invoke("reloadTheCityScene", 3); } }
void Awake() { if (SceneManager.GetActiveScene().name == "Split Title Scene") { SceneManager.UnloadScene("Split Title Scene"); } achievementHandler = GameObject.FindGameObjectWithTag("Achievement Handler").GetComponent <Achievement_Script> (); //begin with the assumption that you're not in quick mode and there's not countdown isCountingDown = false; switch (PlayerPrefs.GetInt("Mode", 0)) { case 0: gameType = "Wiz"; break; case 1: gameType = "Quick"; break; case 2: gameType = "Wit"; break; case 3: gameType = "Holy"; break; } mainCamera = GameObject.FindGameObjectWithTag("MainCamera").GetComponent <Camera> (); //let's grab the music controller GameObject MCobject = GameObject.FindGameObjectWithTag("Music Controller"); mc = MCobject.GetComponent <Music_Controller> (); //reposition score to wherever it may be scoreText.transform.GetComponent <BoxCollider2D> ().offset = (mainCamera.ViewportToWorldPoint(scoreText.transform.position)) - scoreText.transform.position; multiRun = false; //instantiate the grids with their appropriate starting values for (int r = 0; r <= 7; r++) { for (int c = 0; c <= 15; c++) { grid[r, c] = null; colorGrid[r, c] = null; checkGrid[r, c] = false; } cluster[r] = null; } multiplier = 1; checkGameOver = false; piecesPlaced = 0; checkFlag = false; movesMade = 0; score = 0; //load the splitter with the spawned splitter object GameObject splitterObject = GameObject.Find("Splitter"); if (splitterObject != null) { splitter = splitterObject.GetComponent <Splitter_script>(); } gameOver = false; //load the side columns if they exist sideColumns [0] = null; sideColumns [1] = null; GameObject[] scols = GameObject.FindGameObjectsWithTag("Side Column"); GameObject spellHandlerObject = GameObject.Find("Spell Handler"); spellHandler = spellHandlerObject.GetComponent <SpellHandler> (); if (gameType == "Wit") { availableCount = 8; //no powers in Wit Destroy(spellHandlerObject); //Wit does not use the sidecolumns, get rid of them Destroy(scols[1]); Destroy(scols[0]); mc.Play_Music(gameType); } else if (gameType == "Quick") { availableCount = 4; if (scols [0] != null && scols [1] != null) { //make sure they're loaded properly, left is 0, right is 1 if (scols[0].GetComponent <SideColumn>().sideInt == 0) { sideColumns[0] = scols[0].GetComponent <SideColumn>(); sideColumns[1] = scols[1].GetComponent <SideColumn>(); } else { sideColumns[0] = scols[1].GetComponent <SideColumn>(); sideColumns[1] = scols[0].GetComponent <SideColumn>(); } } quickMoveSides = false; StartCoroutine("StartingCountDown"); splitter.setState("canShoot", false); // no powers in Quick, only Holy and Wiz Destroy(spellHandlerObject); } else if (gameType == "Wiz") { //powers are in Wiz, start out with 5 kinds of blocks availableCount = 5; if (scols [0] != null && scols [1] != null) { //make sure they're loaded properly, left is 0, right is 1 if (scols[0].GetComponent <SideColumn>().sideInt == 0) { sideColumns[0] = scols[0].GetComponent <SideColumn>(); sideColumns[1] = scols[1].GetComponent <SideColumn>(); } else { sideColumns[0] = scols[1].GetComponent <SideColumn>(); sideColumns[1] = scols[0].GetComponent <SideColumn>(); } } spellHandler.redReady = true; spellHandler.orangeReady = false; spellHandler.yellowReady = true; spellHandler.greenReady = true; spellHandler.blueReady = true; spellHandler.purpleReady = true; spellHandler.cyanReady = false; spellHandler.whiteReady = false; mc.Play_Music(gameType); } else if (gameType == "Holy") { //Holy has everything at once. Essentially hard mode availableCount = 8; if (scols [0] != null && scols [1] != null) { //make sure they're loaded properly, left is 0, right is 1 if (scols[0].GetComponent <SideColumn>().sideInt == 0) { sideColumns[0] = scols[0].GetComponent <SideColumn>(); sideColumns[1] = scols[1].GetComponent <SideColumn>(); } else { sideColumns[0] = scols[1].GetComponent <SideColumn>(); sideColumns[1] = scols[0].GetComponent <SideColumn>(); } } spellHandler.redReady = true; spellHandler.orangeReady = true; spellHandler.yellowReady = true; spellHandler.greenReady = true; spellHandler.blueReady = true; spellHandler.purpleReady = true; spellHandler.cyanReady = true; spellHandler.whiteReady = true; mc.Play_Music(gameType); } if (gameType != "Wit" && sideColumns != null && sideColumns[0].side == "Right") { SideColumn temp = sideColumns[0]; sideColumns[0] = sideColumns[1]; sideColumns[1] = temp; } sidesChecked = false; //initially update the moves and scores updateMoves(); updateScore(); //get the pause stuff in order isPaused = false; GameOverLayer.SetActive(false); shutter.Begin_Horizontal_Open(); //high score stuff newHighScore = false; HighScoreText.text = ""; tipText.text = ""; Score_Text_Canvas = GameObject.Find("Score Text Canvas"); }