// Update is called once per frame void Update() { DroppyBarController db = Camera.main.GetComponent <DroppyBarController>(); if (state == "onSky") { onSky(); } if (state == "onCitySky") { onCitySky(); } else if (state == "skyToLand") { skyToLand(); } else if (state == "firstRightTurn") { firstRightTurn(); } else if (state == "secondRightTurn") { secondRightTurn(); } else if (state == "thirdRightTurn") { thirdRightTurn(); } else if (state == "lastLeftTurn") { lastLeftTurn(); } else if (state == "cityEnd") { cityEnd(); } else if (state == "Test") { Test(); } //if player needs to release a drop (if there is one), press O //since it released one, it will be faster and size will decrease. //droppy bar will decrease. if (Input.GetKeyDown(KeyCode.O)) { if (transform.localScale.x > minScale.x && transform.localScale.y > minScale.y && transform.localScale.z > minScale.z) { transform.localScale = sizeReducction(transform.localScale); db.ReduceBar(); } else { print("I can't reduce the size anymore"); return; } // IT IS FLYING SPEED THAT WILL HAVE DIFF STATES BASED ON THE LOCATION OF THE PLAYER reduceSpeed(flyingSpeed); } }
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); } }