doExplosion() public method

create an explosion force
public doExplosion ( Vector3 position ) : void
position Vector3 location of the explosion
return void
Esempio n. 1
0
    private void ExplodeBrick(GameObject brick, GameObject icon)
    {
        var audioManager = FindObjectOfType <AudioManager>();

        audioManager.Play("Stone");
        brick.GetComponent <Rigidbody2D>().simulated = true;
        brick.GetComponent <Explodable>().explode();
        ExplosionForce ef = GameObject.FindObjectOfType <ExplosionForce>();

        ef.doExplosion(brick.transform.position);
        icon.GetComponent <Rigidbody2D>().simulated = true;
        icon.GetComponent <Explodable>().explode();
        ef = GameObject.FindObjectOfType <ExplosionForce>();
        ef.doExplosion(brick.transform.position);
    }
Esempio n. 2
0
    void OnMouseDown()
    {
        _explodable.explode();
        ExplosionForce ef = FindObjectOfType <ExplosionForce>();

        ef.doExplosion(transform.position);
    }
    private void explodebottle()
    {
        _explodable.explode();
        ExplosionForce explosionForce = UnityEngine.Object.FindObjectOfType <ExplosionForce>();

        explosionForce.doExplosion(base.transform.position);
    }
Esempio n. 4
0
    /// <summary>
    /// Death
    /// function to handle the killing of the enemy
    /// </summary>
    public virtual void Die()
    {
        m_explodable.explode();
        ExplosionForce ef = GameObject.FindObjectOfType <ExplosionForce>();

        ef.doExplosion(transform.position);
    }
Esempio n. 5
0
    // Update is called once per frame
    void OnTriggerEnter2D(Collider2D other)
    {
        _explodable.explode();
        ExplosionForce ef = GameObject.FindObjectOfType <ExplosionForce>();

        ef.doExplosion(transform.position);
        noise1.Play();
    }
Esempio n. 6
0
    public void Death()
    {
        GameController.AddPoints(points);
        _explodable.explode();
        ExplosionForce ef = GameObject.FindObjectOfType <ExplosionForce>();

        ef.doExplosion(transform.position);
    }
    public IEnumerator waitExplode()
    {
        yield return(new WaitForSeconds(0.01f));

        _explodable.explode();
        ExplosionForce ef = GameObject.FindObjectOfType <ExplosionForce>();

        ef.doExplosion(transform.position);
    }
Esempio n. 8
0
    public void Explode()
    {
        Debug.Log("Mouse down");
        _explodable.GetComponent <Rigidbody2D>().simulated = true;
        _explodable.explode();
        ExplosionForce ef = GameObject.FindObjectOfType <ExplosionForce>();

        ef.doExplosion(transform.position);
    }
Esempio n. 9
0
 private void OnTriggerEnter2D(Collider2D col2d)
 {
     if (col2d.tag == "Player")
     {
         isDestroy = true;
         _explodable.explode();
         ExplosionForce ef = GameObject.FindObjectOfType <ExplosionForce>();
         ef.doExplosion(transform.position);
     }
 }
Esempio n. 10
0
 private void OnTriggerEnter2D(Collider2D col2d)
 {
     if (PlayerController.isFeverTouch && col2d.tag == "Player")
     {
         wallBreak.isDestroy = true;
         _explodable.explode();
         ExplosionForce ef = GameObject.FindObjectOfType <ExplosionForce>();
         ef.doExplosion(transform.position);
     }
 }
Esempio n. 11
0
    void OnMouseDown()
    {
        // Exploding force
        _explodable.explode();
        ExplosionForce ef = GameObject.FindObjectOfType <ExplosionForce>();

        ef.doExplosion(transform.position);

        // Particle and background effects
        if (explosionFx == true)
        {
            explosionFx.transform.position = transform.position;
            explosionFx.Play();
        }
        else
        {
        }

        if (backgroundVfx == true)
        {
            backgroundVfx.gameObject.SetActive(true);
        }
        else
        {
        }

        if (BgVfx == true)
        {
            BgVfx.SetActive(true);
        }
        else
        {
        }

        //OnClick Sound
        sounds.GetComponent <AudioSource>().Play();

        // Displaying next target
        if (raceSet.transform.childCount > 1)
        {
            raceSet.transform.GetChild(1).gameObject.SetActive(true);
        }

        if (raceSet.transform.childCount == 1)
        {
            finish.SetActive(true);
        }


        // Reference for Score display
        ScoreDisplay.score                += 50;
        ScoreDisplay.backgroundScore      += 50;
        SavingHighScore.scoreForHighScore += 50;
    }
Esempio n. 12
0
 // Update is called once per frame
 void Update()
 {
     time += Time.deltaTime;
     if (time >= breaktime)
     {
         explodable.explode();
         ExplosionForce ef = GameObject.Find("Force").GetComponent <ExplosionForce>();
         ef.doExplosion(transform.position);
         breakflg = true;
     }
 }
Esempio n. 13
0
    /// <summary>
    /// Sent when an incoming collider makes contact with this object's
    /// collider (2D physics only).
    /// </summary>
    /// <param name="other">The Collision2D data associated with this collision.</param>
    void OnCollisionEnter2D(Collision2D other)
    {
        if (other.gameObject.tag == "Enemy")
        {
            other.gameObject.GetComponent <Explodable>().explode();
            _force.doExplosion(transform.position);
            other.gameObject.GetComponent <RPGun_Enemy>().KillEnemy();
        }

        Destroy(this.gameObject);
    }
Esempio n. 14
0
    private void DestroyMatchesAt(int column, int row)
    {
        if (allDots[column, row].GetComponent <Dot>().isMatched)
        {
            if (breakableTiles[column, row] != null)
            {
                //if it does need to break take one hit
                breakableTiles[column, row].TakeHit(1);

                if (breakableTiles[column, row].hitPoints <= 0)
                {
                    breakableTiles[column, row] = null;
                }
            }

            if (goalManager != null)
            {
                goalManager.CompareGoal(allDots[column, row].tag.ToString());
                goalManager.UpdateGoals();
            }

            if (AllJuice == true || someJuice == true)
            {
                GameObject particale = Instantiate(destroyEffect, allDots[column, row].transform.position, Quaternion.identity);

                Destroy(particale, .5f);
            }

            if (AllJuice == true)
            {
                allDots[column, row].GetComponent <Dot>().explodable.generateFragments();
                ExplosionForce ef = GameObject.FindObjectOfType <ExplosionForce>();
                ef.doExplosion(transform.position);
            }

            //StartCoroutine(DestroysAfter(column, row, allDots[column, row]));

            if (AllJuice == true || someJuice == true)
            {
                audioSource.enabled = true;

                if (!audioSource.isPlaying)
                {
                    audioSource.clip = connectNormal;
                    audioSource.Play();
                }
            }

            Destroy(allDots[column, row]);
            //allDots[column, row].GetComponent<Renderer>().enabled = false;
            scoreManager.IncreaseScore(basePieceValue * streakValue);
            allDots[column, row] = null;
        }
    }
Esempio n. 15
0
    public override void ProcessFrame(Playable playable, FrameData info, object playerData)
    {
        bool alreadyExploded = false;

        GameObject ARTIFACT   = GameObject.Find("ARTIFACT");
        var        explodable = ARTIFACT.GetComponent <Explodable>();

        if (explodable != null && exploded == true && alreadyExploded == false)
        {
            alreadyExploded = true;
            explodable.explode();
            ExplosionForce ef = GameObject.FindObjectOfType <ExplosionForce>();
            ef.doExplosion(ARTIFACT.transform.position);
        }
    }
Esempio n. 16
0
    void OnMouseDown()
    {
        _explodable.explode();
        ExplosionForce ef = GameObject.FindObjectOfType <ExplosionForce>();

        ef.doExplosion(transform.position);

        sounds.GetComponent <AudioSource>().Play();

        ScoreIndicator.GetComponent <Text>().text = "+ 500";
        ScoreIndicator.GetComponent <Animator>().Play("ScoreGained");
        ScoreDisplay.score                += 500;
        ScoreDisplay.backgroundScore      += 500;
        SavingHighScore.scoreForHighScore += 500;
    }
Esempio n. 17
0
    void OnCollisionEnter2D(Collision2D col)
    {
        if (col.collider.GetComponent <Stick>() != null)
        {
            var stickRigidbody = col.collider.GetComponent <Rigidbody2D>();
            _isExploded = true;
            _explosionForce.upliftModifer = stickRigidbody.angularVelocity / 50;
            _explosionForce.hitNormal     = col.contacts[0].normal;
            _explosionForce.doExplosion(col.contacts[0].point);
            GetComponent <Explodable>().generateFragments();
            GetComponent <Explodable>().explode();

            stickRigidbody.angularVelocity = -stickRigidbody.angularVelocity / 2;
            FindObjectOfType <Ui>().OnScore();
            //FindObjectOfType<Ui>().Screenshake();
        }
    }
Esempio n. 18
0
    IEnumerator wait()
    {
        yield return(new WaitForSeconds(0.75f));

        audio.clip = DeathClip;
        audio.Play();
        Handheld.Vibrate();
        StartPlayer.SetActive(false);
        EndPlayer.SetActive(true);
        explodablePlayer.explode();
        ef.doExplosion(EndPlayer.transform.position);
        yield return(new WaitForSeconds(2f));

        pc2dTransition.TransitionExit();
        yield return(new WaitForSeconds(1.6f));
        //Application.LoadLevel(Application.loadedLevel);
    }
Esempio n. 19
0
    private void StartProcess()
    {
        if (pawnflg1 == false)
        {
            explodable = titleLogo.GetComponent <Explodable>();
            var _big_star = Instantiate(big_star);

            se_bigstar.Play();

            pawnflg1 = true;
        }

        if (pawnflg1 == true && pawnflg2 == false)
        {
            time += Time.deltaTime;
            if (time >= TitelBreakTime)
            {
                explodable.explode();
                ExplosionForce ef = GameObject.Find("Force").GetComponent <ExplosionForce>();
                ef.doExplosion(transform.position);

                se_titlebreak.Play();

                time     = 0f;
                pawnflg2 = true;
            }
        }

        if (pawnflg2 == true && pawnflg3 == false)
        {
            for (int i = 0; i < star_child.Length; i++)
            {
                var _vibe_star = Instantiate(vibe_star);
                _vibe_star.transform.position = star_child[i].transform.position;
            }

            Destroy(constellation);

            se_vibe.Play();
            Invoke("SeFalling", 1.5f);

            pawnflg3 = true;
        }
    }
Esempio n. 20
0
    protected void explode()
    {
        if (!alive)
        {
            return;
        }
        alive = false;
        float explosionForce  = explosionDamage * 200f;
        float explosionRadius = Mathf.Sqrt(explosionDamage) * 0.7f;

        Collider2D[] colliders = Physics2D.OverlapCircleAll(transform.position, explosionRadius);
        Vector2      dir;
        float        wearoff;
        Damageable   damageable;
        TerrainPiece terrainPiece;

        foreach (Collider2D coll in colliders)
        {
            damageable = coll.GetComponent <Damageable>();
            if (damageable != null)
            {
                dir     = (coll.transform.position - transform.position);
                wearoff = 1 - (dir.magnitude / explosionRadius);
                damageable.doDamage(explosionDamage * wearoff);
            }
            terrainPiece = coll.GetComponent <TerrainPiece>();
            if (terrainPiece != null)
            {
                terrainPiece.destroyTerrain(transform.position, explosionRadius * 0.6f);
            }
        }

        var position = transform.position;

        position.z = explosion.transform.position.z;
        Instantiate(explosion, position, transform.rotation);

        ExplosionForce ef = GameObject.FindObjectOfType <ExplosionForce>();

        ef.doExplosion(transform.position, explosionForce, explosionRadius);

        afterExposion();
    }
Esempio n. 21
0
    private void OnCollisionEnter2D(Collision2D collision)
    {
        if ((collision.gameObject.CompareTag("Ground") || collision.gameObject.CompareTag("Enemy") || collision.gameObject.CompareTag("BreakBlock")) && isThreadBreaked)
        {
            if (medKit != null)
            {
                medKit.transform.position = transform.position;
                medKit.SetActive(true);
                medKit.transform.GetChild(0).GetComponent <Rigidbody2D>().AddForce(new Vector2(0, 0.03f), ForceMode2D.Impulse);
            }

            effect.transform.position = transform.position;
            effect.SetActive(true);
            explodable.explode();
            ExplosionForce ef = GameObject.FindObjectOfType <ExplosionForce>();
            ef.doExplosion(transform.position);
            cameraShake.Shake(0.25f, 0.2f);
            SoundManagerV2.Instance.PlaySE(8);
        }
    }
Esempio n. 22
0
 private void DoExplosion()
 {
     exploder.explode();
     explosionForce.doExplosion(transform.position + (Vector3)UnityEngine.Random.insideUnitCircle);
 }