// Awake void Awake() { // messageText = GameObject.Find("MessageText"); // messageText.SetActive(false); inst = gameObject.GetComponent <GCScript>(); anim = gameObject.GetComponent <Animator>(); }
void OnCollisionEnter(Collision collision) { if (collision.transform.tag == "Environment") { Destroy(gameObject); Instantiate(fragments, transform.position, transform.rotation); if (!GCScript.isTheGameOver()) { GCScript.updateScore(); } } else if (collision.transform.tag == "Player") { Destroy(gameObject); if (!PlayerScript.isPlayerInvincible()) { GCScript.gameOver(); } } }
void Start() { Cursor.visible = false; Cursor.lockState = CursorLockMode.Locked; level1.gameObject.SetActive(false); level2.gameObject.SetActive(false); level3.gameObject.SetActive(false); game = this; weak = false; gameOver = false; bricks = 0; score = 0; level = 0; scoreText.text = "Score:" + score; livesText.text = "Balls:" + lives; NextLevel(); }
void FixedUpdate() { float currentSlowFactor = slowFactor; if (!GCScript.isTheGameOver() && hasTouchedGround) { rb.drag = 4.0f; if (!isSlow) { currentSlowFactor = 1.0f; } // Keyboard if (Input.GetAxis("Horizontal") != 0.0f) { rb.AddForce(new Vector3(-Input.GetAxis("Horizontal") * speed / currentSlowFactor, 0.0f, 0.0f)); } //Touch Screen foreach (Touch touch in Input.touches) { if (touch.position.x < Screen.width / 2) { rb.AddForce(new Vector3(speed / currentSlowFactor, 0.0f, 0.0f)); } else if (touch.position.x > Screen.width / 2) { rb.AddForce(new Vector3(-speed / currentSlowFactor, 0.0f, 0.0f)); } } } else { rb.drag = 0.0f; } }
void Awake() { Instance = this; }
// Start is called before the first frame update void Start() { gcscript = GameObject.FindObjectOfType <GCScript>(); Destroy(gameObject, 5); }
// Start is called before the first frame update void Start() { gcscript = GameObject.FindObjectOfType <GCScript>(); }
void OnEnable() { scoreText.text = "Your final score is " + GCScript.getScore(); }