// The floor explodes public override void Activate() { //throw new System.NotImplementedException(); render.enabled = false; GetComponent <Collider2D>().enabled = false; hole.GetComponent <Hole>().onTopOfBridge = false; }
private void OnTriggerEnter2D(Collider2D collision) { if (collision.gameObject.name == "Player") { Debug.Log("animation should run"); hole.GetComponent <Hole>().onTopOfBridge = true; animator.SetBool("bridgeShake", true); colliderB = GetComponent <Collider2D>(); } }
IEnumerator deathEnumerator(Hole hole) { yield return(new WaitForSeconds(3)); GameControler.instance.board.GetComponent <Collider>().enabled = true; hole.GetComponent <Collider>().enabled = true; if (GameControler.instance.healthQuantity <= 0) { deathPanel.GetComponent <DeathPanel>().deathStyle(); deathPanel.SetActive(true); } else { currentCheckPoint.spawnBall(); } }
bool GAMESUBSTATE_IS_PLACING_PIECE = false;//fast 'hacked solution', indicates when the placing of the piece is happening void PlayerPlacingPiece() { if (GAMESUBSTATE_IS_PLACING_PIECE) { return; } RaycastHit hit; Ray ray = Camera.main.ScreenPointToRay(Input.mousePosition); if (Physics.Raycast(ray, out hit)) { Hole objectHit = hit.transform.GetComponent <Hole>(); if (objectHit != null) { if (Input.GetMouseButtonDown(0)) { Hole hole = objectHit.GetComponent <Hole>(); new_piece_hole = hole.transform; square2placePiece = Convert.ToInt32(hole.transform.parent.name.Substring(0, 1)); Pentago_Move mov = new Pentago_Move(square2placePiece, hole.x, hole.y); if (mov.is_move_possible(gameboard)) { mov.apply_move2board(gameboard); visual_cue.intensity = 0; time2ShutLight = 0; lightOwned = false; GAMESUBSTATE_IS_PLACING_PIECE = true; StartCoroutine("PLACE_PIECE_COUROUTINE"); return; } } if (previousCuedHole != null && previousCuedHole == objectHit.transform.gameObject || !lightOwned) { time2ShutLight = maxtime2ShutLight; visual_cue.transform.position = objectHit.transform.position; lightOwned = true; previousCuedHole = objectHit.transform.gameObject; } } } if (time2ShutLight > 0) { if (visual_cue.intensity < maxLightIntensity) { visual_cue.intensity += lightupspeed * Time.deltaTime; } time2ShutLight -= Time.deltaTime; } else { if (visual_cue.intensity > 0) { visual_cue.intensity -= lightupspeed * Time.deltaTime; } else { lightOwned = false; visual_cue.intensity = 0; } } }