// Update is called once per frame void Update() { if (!state.getDead()) { if (state.getDead() || !state.getLaunched()) { sacrifice_prompt.gameObject.SetActive(false); } if (state.getLaunched() && !state.getDead()) { launch_prompt.gameObject.SetActive(false); sacrifice_prompt.gameObject.SetActive(true); } if (!state.getDead() && !state.getLaunched()) { launch_prompt.gameObject.SetActive(true); } } else { launch_prompt.gameObject.SetActive(false); sacrifice_prompt.gameObject.SetActive(false); } }
private void OnTriggerEnter(Collider other) { if (other.transform.tag == "Player" && state.getDead() && !collided) { collided = false; switch (state.type) { case ballType.bounce: bounce(other.transform); break; case ballType.boost: boost(other.transform); break; case ballType.secondWind: secondWind(other.transform); break; case ballType.shrink: shrink(other.transform); break; case ballType.christmas: christmas(other.transform); break; default: Debug.Log("unimplemented balltype"); break; } } }
// Update is called once per frame void FixedUpdate() { if (timer < wait_time) { timer += Time.deltaTime; } else { if (!state.getLaunched() && !state.getDead()) { if (Input.GetKey(KeyCode.Space) || Input.GetMouseButton(0)) { cam.shake(tuner * 0.5f); tuner += tuner_adder; if (tuner > max_tuner_value) { tuner = max_tuner_value; tuner_adder *= -1; } else if (tuner < min_tuner_value) { tuner = min_tuner_value; tuner_adder *= -1; } } if (Input.GetKeyUp(KeyCode.Space) || Input.GetMouseButtonUp(0)) { state.num_launches += 1; audio.play("boost"); rb.AddForce(transform.right * speed * tuner); state.setLaunched(true); } } } }
// Update is called once per frame void Update() { if ((Input.GetKeyDown(KeyCode.K) || Input.GetMouseButtonDown(1)) && state.num_launches > 0 && !state.getDead()) { die(); state.setDead(true); } }