// Update is called once per frame void Update() { percent1 = Game_.health / Game_.maxHealth; percent2 = Game_.fire / Game_.maxFire; //Debug.Log (percent1); if (percent1 < 0) { percent1 = 0; } if (percent2 < 0) { percent2 = 0; } text1.text = Game_.round(percent2 * 100) + "%"; text2.text = Game_.round(percent1 * 100) + "%"; bar1.GetComponent <RectTransform> ().localPosition = new Vector3((mult * percent1) - b, originalPos1.y, 0); bar2.GetComponent <RectTransform> ().localPosition = new Vector3((mult * percent2) - b, originalPos2.y, 0); if (Game_.isDead) { bar1.gameObject.SetActive(false); bar2.gameObject.SetActive(false); health.gameObject.SetActive(false); ammo.gameObject.SetActive(false); } }
void Start() { this.GetComponent <Text> ().text = "" + Game_.Adjust(displaySpeed) + "%"; //this.GetComponent<Text>().text = ""+Game_.calcSpeed(); Game_.debugMode = debugMode; timer = timerCap; //PlayerPrefs.SetInt("blackMatter", 0); PlayerPrefs.SetInt("totalBlackMatter", (int)Game_.darkMatterTotal); }
static void Main(string[] args) { Console.WriteLine("CardDeck"); CardDeckManager CSM = new CardDeckManager(); //CSM.Output(); Game_ game = new Game_(); game.Run(); Console.ReadLine(); }
void OnCollisionEnter2D(Collision2D other) { if (other.gameObject.tag == "ship" && !Game_.isDead) { Debug.Log("bump"); //health -= 0.25f; transform.localScale = new Vector3(health, health, 1); Game_.health -= damage; if (Random.Range(0, 1) > .5f) { Game_.gotDarkMatter(); } //screateDarkMatter (Random.Range(0,4),startHere); } }
void Start() { Game_.initiStats(); Game_.registerStats(); Game_.time = 0; health = Game_.maxHealth; //if (!Input.gyro.enabled) {Input.gyro.enabled = true;} originalZ = transform.position.z; yPos = transform.position.y; for (int i = 0; i < starCount; i++) { Instantiate(star, new Vector3(0, -10, 0), Quaternion.identity); } for (int i = 0; i < Game_.rockCount; i++) { int index = Random.Range(0, 3); Instantiate(SpaceRocks[index], new Vector3(0, -10, 0), Quaternion.identity); } //Game_.gameTime = Game_.timeUnit * -30; }
// Update is called once per frame void Update() { timer += Time.deltaTime; goHere = GameObject.FindGameObjectWithTag("core").transform.position; //goHere = new Vector3(2.5f,-4,0); float speed = Time.deltaTime * rate; transform.position = Vector3.Lerp(transform.position, goHere, speed); if (Vector3.Magnitude(transform.position - goHere) < 1) { Game_.gotDarkMatter(); Destroy(transform.gameObject); } if (timer > 2) { //Game_.darkMatter += 1; Destroy(transform.gameObject); } }
void Update() { //Debugging tool for the health bar if (Game_.health <= 0.5) { Game_.health = 0; Game_.isDead = true; } if (!Game_.isDead) { Vector3 accel = Input.acceleration; travelPos = new Vector3(accel.x / limit, 0, originalZ); newPos = travelPos + transform.position; if (newPos.y > yPos || newPos.y < yPos) { transform.position = Vector3.Lerp(transform.position, new Vector3(transform.position.x, yPos, transform.position.z), Time.deltaTime * 5); } transform.rotation = Quaternion.identity; if (travelPos.x < 3.5 || travelPos.x > -3.5) { transform.Translate(travelPos); } //Debug.Log (transform.position.x); if (transform.position.x > 3 || transform.position.x < -3) { Game_.health -= edgeDamage; Debug.Log("offEdge"); } if (Input.touchCount > 0 && Game_.fire > 0 && !hold) { count += Time.deltaTime; //Debug.Log(Game_.fire); if (slot) { bulletPos = Fire [0].transform.position; } else { bulletPos = Fire [1].transform.position; } bulletPos = new Vector3(bulletPos.x, bulletPos.y, 0); if (count > Game_.countTime) { Game_.fire -= 2; slot = !slot; GameObject clone = (GameObject)Instantiate(bullet, bulletPos, transform.rotation); //clone.transform.rotation = transform.rotation; clone.GetComponent <Rigidbody2D> ().AddForce(bulletSpeed * transform.forward); //clone.transform.parent = GameObject.FindGameObjectsWithTag ("mainCamera"); count = 0; } } else if (Input.touchCount < 1) { if (Game_.fire < Game_.maxFire) { Game_.fire += 1; } } else { //Debug.Log("On Empty"); if (Game_.fire <= 0) { hold = true; } if (hold) { holdTime += Time.deltaTime; if (holdTime > holdThreshold) { hold = false; } } } } else { transform.GetComponent <Rigidbody2D> ().gravityScale = .5f; float calcSpeed = Game_.calcSpeed(); if (PlayerPrefs.GetFloat("maxSpeed") < Game_.Adjust(calcSpeed - Game_.startTime)) { PlayerPrefs.SetFloat("maxSpeed", Game_.Adjust(calcSpeed - Game_.startTime)); } Game_.time = 0; } }
void FixedUpdate() { if (Game_.isDead && !Game_.countDown && !trap) { this.transform.localPosition = Vector3.Lerp(this.transform.localPosition, new Vector3(0, 20, 0), rateChange * Time.deltaTime); //darkMatterTittle.transform.parent.transform.localPosition = // Vector3.Lerp(darkMatterTittle.transform.parent.transform.localPosition, new Vector3 (20000,20000,0),rateChange*999*Time.deltaTime); //darkMatterTittle.text=""; darkMatterTittle.transform.parent.gameObject.SetActive(false); //Debug.Log (Game_.time); buttonSet.transform.localPosition = Vector3.Lerp(buttonSet.transform.localPosition, new Vector3(0, -250, 0), rateChange * 9 * Time.deltaTime); } else if (Game_.countDown || trap) { trap = true; this.transform.localPosition = Vector3.Lerp(this.transform.localPosition, new Vector3(0, 500, 0), rateChange * Time.deltaTime); //darkMatterTittle.transform.parent.transform.localPosition = // Vector3.Lerp(darkMatterTittle.transform.parent.transform.localPosition, new Vector3 (20000,20000,0),rateChange*999*Time.deltaTime); //darkMatterTittle.text=""; darkMatterTittle.transform.parent.gameObject.SetActive(false); //Debug.Log (Game_.time); buttonSet.transform.localPosition = Vector3.Lerp(buttonSet.transform.localPosition, new Vector3(0, 500, 0), rateChange * 9 * Time.deltaTime); } if (!Game_.debugMode && !Game_.isDead) { Game_.time += Time.deltaTime; timer -= Time.deltaTime; displaySpeed = Game_.calcSpeed(); //displaySpeed = 100/(1+(Mathf.Exp((float) -0.08f * (Game_.time-60)))); Game_.starSpeed = Game_.calcSpeed(); //displaySpeed * 0.24f; } else { //Game_.time = Game_.debugTime; timer = -1; } if (displaySpeed > 90) { Camera.GetComponent <Camera> ().backgroundColor = Color.Lerp(Camera.GetComponent <Camera>().backgroundColor, colorTo, Time.deltaTime * .01f); } if (timer < 0) { if (displaySpeed < 100) { this.GetComponent <Text> ().text = "" + Game_.Adjust(displaySpeed - Game_.startTime) + "%"; } else { this.GetComponent <Text> ().text = "HYPERSPACE"; subText.GetComponent <Text> ().text = "velocity has been achieved!"; } timer = timerCap; } if (Game_.darkMatter >= Game_.darkMatterCapacity) { Game_.darkMatter = Game_.darkMatterCapacity; //PlayerPrefs.SetInt("darkMatter",Game_.darkMatter); } darkMatterTittle.text = Game_.darkMatter + " kg"; }