void FixedUpdate() { timeLeft -= 1; if (timeLeft > 50) { this.transform.position = Vector3.Lerp(this.transform.position, targetPosition, 0.3f); this.transform.localScale = Vector3.Lerp(this.transform.localScale, Vector3.one * 0.015f, 0.08f); thisRenderer.material.color = Color.Lerp(thisRenderer.material.color, Color.red, 0.07f); } else if (timeLeft == 50) { GameObject bomb = (GameObject)Instantiate( PrefabMaster.BlockPrefabs[23].gameObject, this.transform.position, this.transform.rotation); ExplodeOnCollideBlock eocb = bomb.GetComponent <ExplodeOnCollideBlock>(); eocb.SimPhysics = true; eocb.Explodey(); DestroyImmediate(this.gameObject); } else if (timeLeft > 10 && timeLeft < 50) { this.transform.localScale = Vector3.Lerp(this.transform.localScale, Vector3.one * 15f, 0.02f); thisRenderer.material.color = Color.Lerp(thisRenderer.material.color, new Color(20, 0, 0, 5), 0.07f); } if (timeLeft <= -30) { Destroy(this.gameObject); } }
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); } } }
public Target(Collider collider) { this.collider = collider; if (Enable) { this.transform = collider.transform; this.rigidbody = collider.GetComponentInAll <Rigidbody>(); block = collider.GetComponentInAll <BlockBehaviour>(); entity = collider.GetComponentInAll <GenericEntity>(); fireTag = collider.GetComponentInAll <FireTag>(); rocket = collider.GetComponentInAll <TimedRocket>(); bomb = collider.GetComponentInAll <ExplodeOnCollideBlock>(); joint = collider.GetComponentInAll <Joint>(); RefreshWarningValue(); } }
public virtual void UponDestroyed() { GameObject bomb = (GameObject)Instantiate( PrefabMaster.BlockPrefabs[23].gameObject, this.transform.position, this.transform.rotation); ExplodeOnCollideBlock eocb = bomb.GetComponent <ExplodeOnCollideBlock>(); eocb.radius = 70; bomb.transform.localScale = UnityEngine.Vector3.one * 20; eocb.explosionEffectPrefab.localScale = Vector3.one * 8; eocb.explosionEffectPrefab.GetComponent <ExplosionEffect>().explosionGrowthSpeed *= 15f; eocb.explosionEffectPrefab.GetComponent <ExplosionEffect>().explosionMoveUpSpeed *= 0f; eocb.explosionEffectPrefab.GetComponent <ExplosionEffect>().explosionShrinkSpeed *= 2f; eocb.SimPhysics = true; eocb.Explodey(); DestroyImmediate(this.gameObject); }