protected override IEnumerator ExplodeRoutine() { if (bumpRoutine != null) { StopCoroutine(bumpRoutine); } if (movementRoutine != null) { StopCoroutine(movementRoutine); } EffectPooler.PlayEffect(explosionAnim, transform.position, false, 0); playerTransform = transform; yield return(new WaitForSeconds(explosionAnim.GetSecondsUntilFrame(2))); SoundManager.RandomizeSFX(deathSound); CameraControl.instance.StartShake(0.1f, 0.1f, true, true); for (int i = 0; i < 4; i++) { float randXOffset = Random.Range(-1, 1); float randYOffset = Random.Range(-1, 1); Vector3 spawnPosition = transform.position + new Vector3(randXOffset, randYOffset, 0); GameManager.instance.SpawnEnemy(spawnPosition, prefab); } gameObject.SetActive(false); }
public override void Execute() { base.Execute(); Vector3 pos = posGenerator.GetGeneratedPosition(); EffectPooler.PlayEffect(effect, pos, false, fadeOutTime); }
private IEnumerator DeathAnimation() { print("Start dying"); CameraControl cam = CameraControl.instance; anim.CrossFade("Dead", 0f); while (OtherBossesDying()) { yield return(null); } dying = true; cam.SetFocus(this.transform); yield return(new WaitForSeconds(1f)); EffectPooler.PlayEffect(deathEffect, transform.position); float delay = deathEffect.SecondsPerFrame * 3f; yield return(new WaitForSeconds(delay)); SoundManager.instance.RandomizeSFX(deathSound); cam.StartShake(0.5f, 0.05f, false, true); cam.StartFlashColor(Color.white, 1, 0, 0, 1); dying = false; cam.secondaryFocus = null; cam.ResetFocus(); SpawnSouls(); base.Die(); yield return(null); }
protected override void Action() { base.Action(); int numHealed = 0; Collider2D[] cols = Physics2D.OverlapCircleAll(transform.position, radius); foreach (Collider2D col in cols) { if (col.CompareTag("Enemy")) { Enemy enemy = col.GetComponentInChildren <Enemy>(); if (enemy != this.e && enemy.healable) { //Debug.Log("Healing"); enemy.Heal(Mathf.RoundToInt(HealAmt())); numHealed++; EffectPooler.PlayEffect(healEffect, enemy.transform.position); if (numHealed >= maxNumHealed) { break; } } } } }
protected override void Init() { poolType = EFFECT_POOL_NAME; base.Init(); instance = this; print(instance); }
private void CheckKnightShieldHit() { if (shieldTimer <= 0 || timeSinceLastShieldHit < 0.5f) return; timeSinceLastShieldHit = 0; if (OnKnightShieldHit != null) OnKnightShieldHit(); EffectPooler.PlayEffect(shieldHitAnim, transform.position, false, 0.2f); sound.RandomizeSFX(shieldHitSound); }
public void DamageEnemy(Enemy e) { if (!e.invincible && e.health > 0) { e.Damage(damage); EffectPooler.PlayEffect(hitEffect, e.transform.position, true, 0.2f); player.TriggerOnEnemyDamagedEvent(damage); player.TriggerOnEnemyLastHitEvent(e); } }
public override void Execute() { Quaternion angle = Quaternion.identity; if (randomAngle) { angle = Quaternion.Euler(new Vector3(0, 0, Random.Range(0, 360))); } EffectPooler.PlayEffect(anim, transform.position, effectInfo); }
private IEnumerator SpawnEnemyDelayed(GameObject prefab) { float halfMapSize = MapGenerator.MAP_SIZE / 2f; float randX = Random.Range(-halfMapSize + MAP_SPAWN_BUFFER, -halfMapSize + MapGenerator.MAP_SIZE - MAP_SPAWN_BUFFER); float randY = Random.Range(-halfMapSize + MAP_SPAWN_BUFFER, -halfMapSize + MapGenerator.MAP_SIZE - MAP_SPAWN_BUFFER); Vector3 spawnPosition = new Vector3(randX, randY); EffectPooler.PlayEffect(spawnAnim, spawnPosition, false, 2.0f); yield return(new WaitForSeconds(1.5f)); SpawnEnemy(spawnPosition, prefab); }
public void DamageEnemy(Enemy e, int damage) { if (!e.invincible && e.health > 0) { e.Damage(damage); EffectPooler.PlayEffect(ninja.hitEffect, e.transform.position, true, 0.2f); SoundManager.instance.PlaySingle(ninja.dashOutSound); ninja.player.TriggerOnEnemyLastHitEvent(e); } }
public override void Execute() { base.Execute(); e.movementMethod = conditionalMoveState; if (switchEffect.frames.Length > 0) { EffectPooler.PlayEffect(switchEffect, e.transform.position + e.healthBarOffset * 1.1f, false, 0.2f); } if (onActionFinished != null) { onActionFinished(); } }
public void DamageEnemy(Enemy e, int dmg, SimpleAnimation effect, bool tempSlowDown, AudioClip[] sfx) { if (!e.invincible && e.health > 0) { e.Damage (dmg); EffectPooler.PlayEffect(effect, e.transform.position, true, 0.1f); player.TriggerOnEnemyDamagedEvent(dmg); player.TriggerOnEnemyLastHitEvent (e); sound.RandomizeSFX(sfx[Random.Range(0, sfx.Length)]); if (tempSlowDown) player.StartTempSlowDown(0.3f); } }
/** Parry */ private IEnumerator ListenForParry() { EffectPooler.PlayEffect(player.parryEffect, transform.position, true, 0.1f); player.StrobeColor(Color.yellow, PARRY_TIME - 0.1f); body.Move(Vector2.zero); player.input.enabled = false; sound.PlaySingle(player.parrySound); yield return(new WaitForSeconds(PARRY_TIME)); player.FlashColor(Color.gray, PARRY_COOLDOWN_TIME); player.OnPlayerTryHit -= Parry; yield return(new WaitForSeconds(PARRY_COOLDOWN_TIME)); player.sr.color = Color.white; player.input.enabled = true; }
public void AwakeGeneralGameStatePoolers() { Data.ObjectPoolersHolder = this; BattleUnitPooler.AwakePooler(); RoadPooler.AwakePooler(); ObstaclePooler.AwakePooler(); StoneBlockagePooler.AwakePooler(); EffectPooler.AwakePooler(); EventPooler.AwakePooler(); TrucksFirePointPooler.AwakePooler(); RoadBlocksFirePointPooler.AwakePooler(); HelicoptersFirePointPooler.AwakePooler(); GunsPooler.AwakePooler(); TrucksPooler.AwakePooler(); EnemyPooler.AwakePooler(); }
protected override void DoAction() { // Set the rotation for the effect Quaternion rot = GetRotation(); // Initialize the effect properties TempObjectInfo info = new TempObjectInfo(); info.targetColor = color; if (duration < 0) { duration = effect.TimeLength; } info.lifeTime = duration; info.fadeOutTime = 0.1f; lastPlayedEffect = EffectPooler.PlayEffect(effect, position, info); }
private IEnumerator GoToPlayer() { yield return(new WaitForSeconds(Random.Range(1f, 2f))); float distance = Vector3.Distance(transform.position, player.position); while (distance > 1.0f) { distance = Vector3.Distance(transform.position, player.position); Vector3 dir = (player.position - transform.position).normalized; rb2d.velocity = dir * distance * 5; yield return(null); } BattleSceneManager.instance.AddMoney(this.value); SoundManager.instance.PlaySingle(coinPickupSound); EffectPooler.PlayEffect(pickupEffect, transform.position); Destroy(gameObject); }
protected virtual IEnumerator ExplodeRoutine() { if (bumpRoutine != null) { StopCoroutine(bumpRoutine); } if (movementRoutine != null) { StopCoroutine(movementRoutine); } rb2d.velocity = Vector2.zero; EffectPooler.PlayEffect(explosionAnim, transform.position, false, 0); SoundManager.RandomizeSFX(deathSound); playerTransform = transform; yield return(new WaitForSeconds(explosionAnim.GetSecondsUntilFrame(2))); gameObject.SetActive(false); }
// Damage an enemy and spawn an effect private void DamageEnemy(Enemy e, int amt) { if (!e.invincible && e.health > 0) { e.Damage(damage); if (specialActivated) { EffectPooler.PlayEffect(specialHitEffect, e.transform.position, true); } else { EffectPooler.PlayEffect(hitEffect, e.transform.position, true, 0.2f); } player.TriggerOnEnemyDamagedEvent(amt); player.TriggerOnEnemyLastHitEvent(e); } }
protected virtual IEnumerator DieRoutine() { anim.CrossFade("Die", 0f); yield return(new WaitForSeconds(0.5f)); SpawnDeathProps(); Destroy(transform.parent.gameObject, 1.0f); EffectPooler.PlayEffect(deathEffect, transform.position, false, 0f); yield return(new WaitForSeconds(0.2f)); CameraControl.instance.StartShake(0.2f, 0.05f, false, true); SoundManager.instance.RandomizeSFX(deathSound); yield return(new WaitForSeconds(0.3f)); EffectPooler.PlayEffect(trappedHeroPickupEffect, transform.position, false, 0.5f); transform.parent.gameObject.SetActive(false); SoundManager.instance.RandomizeSFX(acquireHeroSound); }
private void AdditionalDamage(int amt) { enemy.DecreaseHealth(Mathf.RoundToInt(amt * 0.5f)); EffectPooler.PlayEffect(hitAnim, transform.position, true); }
private IEnumerator Spawn() { EffectPooler.PlayEffect(player.spawnEffect, transform.position); yield return(new WaitForSeconds(player.spawnEffect.GetSecondsUntilFrame(10))); }
private void DestroySelf() { gameObject.SetActive(false); EffectPooler.PlayEffect(hitAnimation, transform.position); }
public override void Execute() { base.Execute(); EffectPooler.PlayEffect(anim, location.position, info); }