void Update() { if (Input.GetKeyDown(KeyCode.Q)) { Shake.ShakeObject(gameObject, shakePower, shakeTime); } }
//HOW THE ENEMY RESPONDS IEnumerator EnemyResponse(int type) { float modifier = 1f; switch (BattleController.BC.Enemy.enemyResistances[type]) { case 0: StartCoroutine(enemySway.StartSway(4f, 8f, 1f)); modifier = 1.5f; break; case 1: modifier = 1f; break; case 2: StartCoroutine(enemyShake.ShakeObject(.5f)); modifier = 0.5f; break; } float flo = GameControl.control.numMasks; int math = (int)Mathf.Round((flo + 1f) * modifier); BattleController.BC.EnemyTakeDamage(math); yield return(new WaitForSeconds(1f)); if (BattleController.BC.Enemy.enemyHealth <= 0) { yield return(StartCoroutine(BattleController.BC.ResolveCombat())); } else { StartCoroutine(BattleController.BC.EndTurnPlayer()); } }
void OnCollisionEnter2D(Collision2D col) { if (col.gameObject.tag == "BeDestroyedObject" && transform.GetComponent <Rigidbody2D>().velocity != Vector2.zero) { Time.timeScale = 0.7f; shake.ShakeObject(); col.gameObject.GetComponent <BeDestroyedObject>().BeginDamage(1); energy.AddEnergy(25.0f); Time.timeScale = 1f; } }
public IEnumerator ShakeCamera(float time, float intensity) { shaker.SetSpeed(intensity); yield return(StartCoroutine(shaker.ShakeObject(time))); }