public void Explode() { bombVisual.SetActive(false); Instantiate(explosionEffect, bombVisual.transform.position, Quaternion.identity); explosionController.Explode(); GameManager.Instance.BombHasExploded(); }
private void OnTriggerEnter(Collider collider) { if (collider.gameObject.tag == "Player") { Debug.Log("Explosion!"); StartCoroutine(exController.Explode()); } }
public void SpawnExplosion(Vector3 pos, float scale) { ExplosionController ec = op.InstantiatePooled( pos, Quaternion.identity, false ).GetComponent <ExplosionController>(); ec.Initialize(op, scale); StartCoroutine(ec.Explode()); }
public void TakeDamage(int damage) { health -= damage; healthSlider.value = health; if (health <= 0) { explosionController.Explode(tankExplosionParticle); Destroy(gameObject); TankService.Instance.playerDead = true; } }
private void OnCollisionEnter(Collision other) { explosionController.Explode(explosionParticle); Destroy(gameObject); IDamagable damagable = other.gameObject.GetComponent <IDamagable>(); if (damagable != null) { damagable.TakeDamage(10); } }
private void SelfDestruct() { if (explosiveSize > 0 && explosionPrefab) { ExplosionController explosion = Instantiate(explosionPrefab); explosion.transform.position = transform.position + transform.forward * (explosiveSize / 2); explosion.explosionSize = explosiveSize; //explosion.pushForce = thrustForce; explosion.explosionDamage = hullDamage; explosion.Explode(); } Destroy(gameObject); }
public void TakeDamage(int damage) { health -= damage; healthSlider.value = health; if (health <= 0) { EventService.Instance.InvokeEnemyKilledEvent(); explosionController.Explode(tankExplosionParticle); Destroy(gameObject); } }
private void Die() { _isAlive = false; ExplosionController explosion = ExplosionManager.Get(explodeEffect); explosion.transform.position = transform.position; explosion.Explode(); if (explodeSound) { AudioManager.PlayAtPoint(explodeSound, transform.position); } CancerManager.Recycle(this); GameSceneController.OnCancerDeath(identifierName); }
private void Die(string reason) { foreach (var weapon in weapons) { (weapon as ShooterController)?.CancelAttack(); } gameObject.SetActive(false); ExplosionController explosion = ExplosionManager.Get(explodeEffect); explosion.transform.position = transform.position; explosion.Explode(); onDeath?.Invoke(reason); if (_displayChemoTreatmentCoroutine != null) { StopCoroutine(_displayChemoTreatmentCoroutine); } _displayChemoTreatmentCoroutine = null; }
void ExplosionCreator(Vector3 position) { ExplosionController explosion = null; for (int i = 0; i < explosionPool.Count; i++) { if (!explosionPool[i].gameObject.activeSelf) { explosion = explosionPool[i]; break; } } if (explosion == null) { explosion = Instantiate(explosionPrefab) as ExplosionController; explosionPool.Add(explosion); } explosion.gameObject.SetActive(true); explosion.transform.position = position; explosion.Explode(); }
public void SpawnExplosion(Vector3 pos) { ExplosionController explosion = null; for (int i = 0; i < explosionPool.Count; i++) { ExplosionController e = explosionPool [i]; if (!e.gameObject.activeSelf) { explosion = e; break; } } if (explosion == null) { explosionPool.Add(explosion = Instantiate(explosionPrefab) as ExplosionController); } explosion.transform.position = pos; explosion.gameObject.SetActive(true); explosion.Explode(); }
private void CheckDeath() { if (health <= 0) { DestroyAllPowerups(); Freeze(true); SetSmoke(0); SetFire(0); if (vehicleObject) { vehicleObject.SetActive(false); } if (explosion) { explosion.explosionSize = 4; explosion.explosionDamage = 50; explosion.Explode(); //yield return new WaitForSeconds(explosion.duration); } //gameObject.SetActive(false); //if (vehicleObject) vehicleObject.SetActive(true); } }
// Coroutine that waits for a certain amount of time and then makes explosion effects + destruction of the palace happen IEnumerator ExplosionsAfterDelay(float delayTime, RaycastHit hit) { yield return(new WaitForSeconds(delayTime)); // Turn off the lights so that the explosion looks more spectacular LightGO = GameObject.Find("DirLight"); Light mainLight = LightGO.GetComponent <Light>(); mainLight.intensity = 0f; Destroy(hit.transform.gameObject, palaceExplosionDelay); for (int i = 0; i < explosionCount; i++) { //pick a location for your explosion Vector3 explosionPos = hit.transform.GetComponent <PalaceController>().GetPositionInsideObject(); // Instantiate an explosion there and give it a clean name ExplosionController new_exp = (ExplosionController)Instantiate(exp, explosionPos, Quaternion.identity); new_exp.transform.name = "explosion_" + i; // Make it go boom new_exp.Explode(); } }
public void Recycle() { _isAlive = false; ExplosionController explosion = ExplosionManager.Get(explodeEffect); explosion.transform.position = transform.position; explosion.Explode(); if (explodeSound) { AudioManager.PlayAtPoint(explodeSound, transform.position); } if (_isStunned) { StopCoroutine(_stunCoroutine); } _isStunned = false; _stunCoroutine = null; if (_isAttacking) { CancelAttack(); } EnemyManager.Recycle(this); }
void Fire1() { // 課題: 以下のコードでは Muzzle の場所で爆発するが、レーザーが障害物に衝突した位置で爆発するように修正せよ m_explosionObject.Explode(m_muzzle.position); }