IEnumerator Explode()
        {
            if (Exploding)
            {
                while (CountDownExplode >= 0)
                {
                    yield return(new WaitForFixedUpdate());

                    --CountDownExplode;
                    StartCoroutine(Explode());
                    yield break;
                }
                ECS = GameObject.Find("Exploding Cannonball Mod").GetComponent <ExplodingCannonballScript>();
                if (ECS.TypeOfExplosion == 1)
                {
                    GameObject explo = (GameObject)GameObject.Instantiate(PrefabMaster.BlockPrefabs[23].gameObject, this.transform.position, this.transform.rotation);
                    explo.transform.localScale = Vector3.one * 0.01f;
                    ExplodeOnCollideBlock ac = explo.GetComponent <ExplodeOnCollideBlock>();
                    ac.radius      = 7 * ECS.RangeMultiplierOfExplosion;
                    ac.power       = 2100f * ECS.PowerMultiplierOfExplosion;
                    ac.torquePower = 100000 * ECS.PowerMultiplierOfExplosion;
                    ac.upPower     = 0;
                    ac.Explodey();
                    explo.AddComponent <TimedSelfDestruct>();
                    Destroy(this.gameObject);
                }
                else if (ECS.TypeOfExplosion == 2)
                {
                    GameObject explo = (GameObject)GameObject.Instantiate(PrefabMaster.BlockPrefabs[54].gameObject, this.transform.position, this.transform.rotation);
                    explo.transform.localScale = Vector3.one * 0.01f;
                    ControllableBomb ac = explo.GetComponent <ControllableBomb>();
                    ac.radius      = 3 * ECS.RangeMultiplierOfExplosion;
                    ac.power       = 1500 * ECS.PowerMultiplierOfExplosion;
                    ac.randomDelay = 0.00001f;
                    ac.upPower     = 0f;
                    ac.StartCoroutine_Auto(ac.Explode());
                    explo.AddComponent <TimedSelfDestruct>();
                    Destroy(this.gameObject);
                }
                else if (ECS.TypeOfExplosion == 3)
                {
                    GameObject explo = (GameObject)GameObject.Instantiate(PrefabMaster.BlockPrefabs[59].gameObject, this.transform.position, this.transform.rotation);
                    explo.transform.localScale = Vector3.one * 0.01f;
                    TimedRocket ac = explo.GetComponent <TimedRocket>();
                    ac.SetSlip(Color.white);
                    ac.radius      = 3 * ECS.RangeMultiplierOfExplosion;
                    ac.power       = 1500 * ECS.PowerMultiplierOfExplosion;
                    ac.randomDelay = 0.000001f;
                    ac.upPower     = 0;
                    ac.StartCoroutine(ac.Explode(0.01f));
                    explo.AddComponent <TimedSelfDestruct>();
                    Destroy(this.gameObject);
                }
            }
        }
예제 #2
0
 /// <summary>
 /// Creates a Block handler.
 /// </summary>
 /// <param name="bb">BlockBehaviour object.</param>
 public Grenade(BlockBehaviour bb) : base(bb)
 {
     cb = bb.GetComponent <ControllableBomb>();
 }