예제 #1
0
 public void Explode()
 {
     bombVisual.SetActive(false);
     Instantiate(explosionEffect, bombVisual.transform.position, Quaternion.identity);
     explosionController.Explode();
     GameManager.Instance.BombHasExploded();
 }
예제 #2
0
 private void OnTriggerEnter(Collider collider)
 {
     if (collider.gameObject.tag == "Player")
     {
         Debug.Log("Explosion!");
         StartCoroutine(exController.Explode());
     }
 }
예제 #3
0
    public void SpawnExplosion(Vector3 pos, float scale)
    {
        ExplosionController ec = op.InstantiatePooled(
            pos,
            Quaternion.identity,
            false
            ).GetComponent <ExplosionController>();

        ec.Initialize(op, scale);
        StartCoroutine(ec.Explode());
    }
예제 #4
0
    public void TakeDamage(int damage)
    {
        health            -= damage;
        healthSlider.value = health;

        if (health <= 0)
        {
            explosionController.Explode(tankExplosionParticle);
            Destroy(gameObject);
            TankService.Instance.playerDead = true;
        }
    }
예제 #5
0
    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);
 }
예제 #7
0
    public void TakeDamage(int damage)
    {
        health            -= damage;
        healthSlider.value = health;

        if (health <= 0)
        {
            EventService.Instance.InvokeEnemyKilledEvent();
            explosionController.Explode(tankExplosionParticle);

            Destroy(gameObject);
        }
    }
예제 #8
0
    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);
    }
예제 #9
0
    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;
    }
예제 #10
0
    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();
    }
예제 #11
0
    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();
    }
예제 #12
0
 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);
     }
 }
예제 #13
0
    // 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();
        }
    }
예제 #14
0
    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);
    }
예제 #15
0
 void Fire1()
 {
     // 課題: 以下のコードでは Muzzle の場所で爆発するが、レーザーが障害物に衝突した位置で爆発するように修正せよ
     m_explosionObject.Explode(m_muzzle.position);
 }