private void OnMouseOver() { if (EventSystem.current.IsPointerOverGameObject() || !canBeBuild) { return; } if (GameManager.Instance.toolToBuild != null && currentObject == null) { spr.color = targetColor; // build if (Input.GetMouseButtonDown(0)) { if (ShopSystem.CanBuild()) { PlaceTool(); } else { shake.CameraShake(); // Show not enought money UI shake.ShowNotEnoughMoney(); // sound AudioManager.Play(Sound.MoneyNotEnoughSound); } } else { return; } } return; }
// Ths function runs when the player hits an obstacle // Information about the collision is collected and called "collisionInfo" void OnCollisionEnter(Collision collisionInfo) { // Check if object collided with has a tag called "Obstacle" if (collisionInfo.collider.tag == "Obstacle") { movement.enabled = false; // Player stops moving FindObjectOfType <GameManager>().EndGame(); shake.CameraShake(); FindObjectOfType <AudioManager>().PlaySound("DeathSound"); //Destroy(gameObject); } }
public void OnHit(InputValue value) { if (gameStart == false) { return; } if (m_move == locks[0]) { lockHit -= skill; Debug.Log("click!"); if (lockHit <= 0) { shaker.CameraShake(); Debug.Log("clank!!"); locks.Remove(locks[0]); lockHit = lockDur; } } }
private void OnTriggerEnter2D(Collider2D other) { if (other.CompareTag("PlayerBullet")) { health--; if (health > 0) { FindObjectOfType <AudioManager>().Play("EnemyHit"); _material.color = flashColor; Invoke(nameof(ResetMaterial), 0.15f); } else { _material.color = flashColor; _shake.CameraShake(); FindObjectOfType <AudioManager>().Play("EnemyDeath"); GameObject effect = Instantiate(deathEffect, transform.position, Quaternion.identity); Destroy(effect, 2f); Destroy(gameObject, 0.2f); } } }
// Camera: public void shakeCamera() { StartCoroutine(shakeScript.CameraShake()); }