void Start() { endText.text = ""; crosshairPos = new Vector3(Screen.width / 2, Screen.height / 2); objectiveActive = false; objectiveEnemy = null; // Objectives if (objectivesGameObject.active) { count = 0; objectiveDoneText.text = ""; ringsCollectedText.text = ""; countObjectives = countTotalObjectives(); setCountText(); } if (objectivesPlanes.active) { startText.text = "Objective: try to destroy the yellow plane"; Destroy(GameObject.FindWithTag("StartText"), 3); } // Explosions detonator = GetComponent("Detonator") as Detonator; // Sounds AudioSource[] aSources = this.GetComponents <AudioSource>(); gunShot = aSources [0]; explosionSound = aSources [1]; }
// Use this for initialization protected new void Start() { base.Start(); explosion = this.GetComponentInChildren<Detonator>(); player = (IPlayer)(GameObject.FindGameObjectWithTag("Player").GetComponents(typeof(IPlayer)))[0]; StartCoroutine("StartEngineLoop"); }
private void FillDefaultMaterials() { if (!this.fireballAMaterial) { this.fireballAMaterial = Detonator.DefaultFireballAMaterial(); } if (!this.fireballBMaterial) { this.fireballBMaterial = Detonator.DefaultFireballBMaterial(); } if (!this.smokeAMaterial) { this.smokeAMaterial = Detonator.DefaultSmokeAMaterial(); } if (!this.smokeBMaterial) { this.smokeBMaterial = Detonator.DefaultSmokeBMaterial(); } if (!this.shockwaveMaterial) { this.shockwaveMaterial = Detonator.DefaultShockwaveMaterial(); } if (!this.sparksMaterial) { this.sparksMaterial = Detonator.DefaultSparksMaterial(); } if (!this.glowMaterial) { this.glowMaterial = Detonator.DefaultGlowMaterial(); } if (!this.heatwaveMaterial) { this.heatwaveMaterial = Detonator.DefaultHeatwaveMaterial(); } }
public override void Awake() { base.Awake(); indexes.Add("Left_Tower_Turret_", new int[3]); indexes.Add("Left_Spike_01_Turret_", new int[3]); indexes.Add("Left_Spike_02_Turret_", new int[3]); indexes.Add("Right_Tower_Turret_", new int[3]); indexes.Add("Right_Spike_01_Turret_", new int[3]); indexes.Add("Right_Spike_02_Turret_", new int[3]); indexes.Add("Left_Base_Turret_", new int[2]); indexes.Add("Right_Base_Turret_", new int[2]); indexes.Add("_Ball_Turret", new int[1]); indexes.Add("_Canon_Turret", new int[2]); ondergrond.gameObject.SetActive(false); childDictionary = Functions.GetChildTransformDictionary(mainTrainsform, false); Detonator detonator = explosion.GetComponent <Detonator>(); if (detonator != null) { detonator.size = 2; //detonator.duration = 0.5f; } transform.position = new Vector3(21.56f, 3.4f, transform.position.z); }
private void Update() { if (!isLocalPlayer) { return; } //keeps the UI in the corner in case of resize... _guiRect = new Rect(7, Screen.height - 150, 250, 200); //keeps the play button from making an explosion //if ((Time.time + _spawnTime) > 0.5f) //{ //don't spawn an explosion if we're using the UI if (!checkRect.Contains(Input.mousePosition)) { if (Input.GetMouseButtonDown(0)) { Debug.Log("Is Local Player: " + base.isLocalPlayer); Ray ray = Camera.main.ScreenPointToRay(Input.mousePosition); RaycastHit hit; if (Physics.Raycast(ray, out hit, 1000)) { Detonator dTemp = (Detonator)currentDetonator.GetComponent("Detonator"); float offsetSize = dTemp.size / 3; Vector3 hitPoint = hit.point + ((Vector3.Scale(hit.normal, new Vector3(offsetSize, offsetSize, offsetSize)))); CmdSpawnExplosion(hitPoint, _currentExpIdx); } } } Time.timeScale = timeScale; //} }
// Update is called once per frame void Update() { if (Time.time > startTime + delayTime) { transform.localScale -= shrinkVector * Time.deltaTime; if (transform.localScale.x <= destroyCutoff) { Destroy(toDestroy); GameObject exp = Instantiate(explosion, transform.position, transform.rotation) as GameObject; Detonator d = exp.GetComponent <Detonator> (); if (d) { MeshRenderer renderer = GetComponent <MeshRenderer>(); if (!renderer) { renderer = GetComponentInChildren <MeshRenderer>(); } if (renderer) { d.color = renderer.material.color; } } } } }
void Awake() { if (instance == null) { instance = this; } fpsController = gameObject.GetComponentInParent <FirstPersonController>(); characterController = gameObject.GetComponentInParent <CharacterController>(); analogGlitch = gameObject.GetComponent <AnalogGlitch>(); digitalGlitch = gameObject.GetComponent <DigitalGlitch>(); tiltShift = gameObject.GetComponent <TiltShift>(); noiseAndGrain = gameObject.GetComponent <NoiseAndGrain>(); bloomAndFlares = gameObject.GetComponent <BloomAndFlares>(); ramp = gameObject.GetComponents <Ramp>()[1]; puffOfSmokeDetonator = puffOfSmoke.GetComponent <Detonator>(); cameraShake = gameObject.GetComponent <CameraShake>(); hudPowerText = hudPowerTextGroup.GetComponent <ShakyText>(); //Initialization digitalGlitch.intensity = .2f; analogGlitch.scanLineJitter = .414f; analogGlitch.verticalJump = .02f; analogGlitch.horizontalShake = .011f; analogGlitch.colorDrift = .11f; powerPercent = powerStartPercent; }
// Use this for initialization void Start() { _Detonator = GetComponent <Detonator>(); effectClone = GameObject.Instantiate(effect, this.transform.position, Quaternion.identity) as GameObject; effectClone.SetActive(false); // _Test = GameObject.Find("Player").GetComponent<Test>(); }
private void ExplodeAndDestroy() { detonation.transform.position = this.rigidbody.position; Detonator d = detonation.GetComponent <Detonator>(); d.Explode(); Destroy(gameObject); // Destruye el invader }
protected override void Awake() { base.Awake(); rb = GetComponent <Rigidbody2D>(); detonator = GetComponent <Detonator>(); gravity = rb.gravityScale; loot = GetComponent <DropPool>(); }
public override void ability2Up() { if(detonator != null && abilPressed2){ detonator.detonate(); detonator = null; } abilPressed2 = false; }
// Update is called once per frame void Update() { if (Time.time > startTime + delayTime) { MeshRenderer renderer = GetComponent <MeshRenderer>(); bool destroy = false; if (!renderer) { foreach (MeshRenderer r in GetComponentsInChildren <MeshRenderer>()) { if (!setToFade) { r.material.EnableKeyword("_ALPHABLEND_ON"); r.material.SetFloat("_Mode", 2f); } Color color = r.material.color; color.a -= rate * Time.deltaTime; r.material.color = color; destroy = r.material.color.a <= destroyCutoff; } } else { if (!setToFade) { renderer.material.EnableKeyword("_ALPHABLEND_ON"); renderer.material.SetFloat("_Mode", 2f); } Color color = renderer.material.color; color.a -= rate * Time.deltaTime; // Debug.Log (color.a); renderer.material.color = color; destroy = renderer.material.color.a <= destroyCutoff; } setToFade = true; if (destroy) { Destroy(toDestroy); if (explosion) { GameObject exp = Instantiate(explosion, transform.position, transform.rotation) as GameObject; Detonator d = exp.GetComponent <Detonator> (); if (d) { if (!renderer) { renderer = GetComponentInChildren <MeshRenderer>(); } if (renderer) { d.color = renderer.material.color; } } } } } }
public void Start() { ConstructFSM(); agent = gameObject.GetComponent <NavMeshAgent> (); detonator = gameObject.GetComponent <Detonator> (); shelter = GameObject.FindGameObjectWithTag("Shelter"); gameManager = GameObject.FindGameObjectWithTag("GameManager").GetComponent <GameManager>(); count = 0; }
private IEnumerator BlowAway() { GameObject detonator = GameObject.Find("Detonator"); Detonator det = gameObject.GetComponentInChildren <Detonator> (); //det.gameObject.transform.parent = null; //transform.DetachChildren (); Transform[] transforms = gameObject.GetComponentsInChildren <Transform> (); foreach (Transform childTransform in transforms) { //Debug.Log ("Boom for: " + childTransform.gameObject.name + " Mesh: " + childTransform.name); childTransform.parent = null; MeshFilter mesh = childTransform.gameObject.GetComponent <MeshFilter> (); if (mesh != null) { mesh.gameObject.AddComponent(typeof(Rigidbody)); mesh.gameObject.rigidbody.isKinematic = false; mesh.gameObject.rigidbody.useGravity = true; mesh.gameObject.rigidbody.mass = 10; } if (childTransform.gameObject != detonator) { // detonator kills itself Destroy(childTransform.gameObject, 5); } } //GameObject boom = GameObject.Find ("Detonator"); //if (boom != null) { //yield return new WaitForSeconds(1); //gameObject.transform.DetachChildren (); //Detonator det = GameObject.Find("Detonator").GetComponent<Detonator>(); if (det != null) { det.Explode(); } else { Debug.Log("Det is null"); } Destroy(gameObject, 5); exploded = true; yield return(new WaitForSeconds(3)); //} else { // Debug.Log ("Boom is null"); //} //goBoom = false; //Transform[] childs = gameObject.GetComponentsInChildren<Transform>(); //foreach(Transform child in childs){ //Debug.Log("Destroy " + child.gameObject.name + " Mesh: " + child.name); //} LandingPadGroup.GetInstance().SetGameOver(); }
private void SpawnExplosion() { Detonator dTemp = (Detonator)Go_Explosions.GetComponent("Detonator"); GameObject exp = (GameObject)Instantiate(Go_Explosions, new Vector3(0, 0, 0), Quaternion.identity); dTemp = (Detonator)exp.GetComponent("Detonator"); dTemp.detail = 1.0f; Debug.Log("Spawned EXPLOSION"); Destroy(exp, 10.0f); }
// Use this for initialization void Start() { sprite = GetComponent<OTSprite>(); detonator = GetComponent<Detonator>(); sprite.onCollision = onCollision; cannon = GameObject.Find("cannon"); GameObject.Find("gui").SendMessage("SetLifes", lifes); }
protected void CloneDetonator() { GameObject clone = (GameObject)Instantiate(explodeParticle.gameObject, transform.position, Quaternion.identity); if (mainRenderer != null) { Detonator clonedScript = clone.GetComponent <Detonator>(); clonedScript.color = mainRenderer.color; } }
void DestructImpl() { //Object exp = GameObject expl = Instantiate(explosionPrefab, gameObject.transform.position, gameObject.transform.rotation) as GameObject; Detonator det = expl.GetComponent <Detonator>(); if (det) { det.size = size; } }
protected void Init() { Destroy(gameObject, lifeTime); detonator = gameObject.GetComponent <Detonator> (); // Because the camera is to high, the raycast generate some error in the y axiz, we need to replenish that error // gameObject.transform.position = new Vector3 (transform.position.x, 0.5f, transform.position.z); transform.GetComponent <SphereCollider> ().radius = radius; }
public void ExplodeAndDestroy() { Detonation.transform.position = this.transform.position; Detonator d = Detonation.GetComponent <Detonator>(); d.Explode(); Debug.Log("Player: " + bike.name + " lost!"); Destroy(TronTrail); Destroy(TronTrailCollider); Destroy(this.bike); // Destruye al player porque pierde }
// Use this for initialization void Start () { ship = GameObject.Find("Ship"); moon = GameObject.Find("Moon"); earth = GameObject.Find("Earth"); setupScreenText (); det = ship.GetComponentInChildren<Detonator>(); laser = GameObject.Find("laser"); line = GetComponentInChildren<LineRenderer>(); audio.clip = engine_normal; audio.Play(); }
public void CmdSpawnExplosion(Vector3 hitPoint, int explosionType) { currentDetonator = detonatorPrefabs[explosionType]; GameObject exp = (GameObject)Instantiate(currentDetonator, hitPoint, Quaternion.identity); Detonator dTemp = (Detonator)exp.GetComponent("Detonator"); dTemp.detail = detailLevel; Destroy(exp, explosionLife); NetworkServer.Spawn(exp); }
// Update is called once per frame void Update() { timer += Time.deltaTime; //det.size = explosionSize; if (timer >= explosionDelay) { spawnedExplosion = (GameObject)Instantiate (explosion, transform.position, Quaternion.identity); det = spawnedExplosion.GetComponent<Detonator> (); det.size = explosionSize; det.Explode (); Destroy (gameObject); } }
// Use this for initialization public void Start() { _state = States.Alive; _detonator = DetonatorGameObject.GetComponent <Detonator>(); if (_detonator == null) { Debug.Break(); } SetFlightCourse(); }
public void ExplodeAndDestroy() { this.player = gameObject; if (this.player != null) { Detonation.transform.position = this.transform.position; Detonator d = Detonation.GetComponent <Detonator>(); d.Explode(); Debug.Log("Perdiste Capo!"); InvadersGameData.gameLost = true; Destroy(this.player); // Destruye al player porque pierde } }
/// <summary> /// Collisions the action for myself. /// </summary> /// <param name="kindOfCollision">Kind of collision.</param> protected override void CollisionActionForMyself(int kindOfCollision) { Detonator detonator = gameObject.GetComponent <Detonator>(); float explosionLength = explosionSound.clip.length; gameObject.GetComponent <Rigidbody>().constraints = RigidbodyConstraints.FreezePosition; gameObject.GetComponent <SphereCollider>().enabled = false; detonator.duration = explosionLength; detonator.destroyTime = explosionLength + 1; loopSound.enabled = false; explosionSound.enabled = true; explosionSound.PlayOneShot(explosionSound.clip); Destroy(gameObject.transform.FindChild("ShapeMeteorite").gameObject); gameObject.GetComponent <Detonator>().Explode(); }
public override void Awake() { base.Awake(); //GetComponent<ExplodeMesh>().Explode(); Detonator detonator = explosion.GetComponent <Detonator>(); if (detonator != null) { detonator.size = 7; detonator.duration = 2f; } mineDropRef = Functions.FindChildTransformsRecruisive(transform, "MineDrop_Ref", true)[0]; }
// Update is called once per frame void Update() { if (Input.GetButton("Fire2")) { RaycastHit hit; Ray bullet = new Ray(transform.position, transform.forward); GetComponent <AudioSource>().PlayOneShot(gunsound); if (Physics.Raycast(bullet, out hit, shootDistance)) { if (hit.transform.name == "Car1(Black)" || hit.collider.tag == "Desert") { Instantiate(bulletHole, hit.point, Quaternion.FromToRotation(Vector3.forward, hit.normal)); if (bulletImpact.gameObject != null) { Instantiate(bulletImpact, (hit.point + (hit.normal * 0.0001f)), Quaternion.LookRotation(hit.normal)); } } if (hit.transform.name == "Car1(Black)") { enemyHealthText.text = "Enemy Health: " + enemyHealth.maxHealth.ToString(); destroyed = enemyHealth.Applydamage(); if (destroyed == true) { Destroy(hit.collider.transform.root.gameObject); Detonator dTemp = (Detonator)currentDetonator.GetComponent("Detonator"); float offsetSize = dTemp.size / 3; Vector3 hitPoint = hit.point + ((Vector3.Scale(hit.normal, new Vector3(offsetSize, offsetSize, offsetSize)))); GameObject exp = (GameObject)Instantiate(currentDetonator, hitPoint, Quaternion.identity); dTemp = (Detonator)exp.GetComponent("Detonator"); dTemp.detail = detailLevel; GetComponent <AudioSource>().PlayOneShot(explosionsound); Destroy(exp, explosionLife); playerWonCanvas.enabled = true; enemyHealth.PlayerDeath.enabled = false; } EnemyHit = true; } } muzzleflash.SetActive(true); } else { muzzleflash.SetActive(false); } }
public override void Awake() { base.Awake(); //GetComponent<ExplodeMesh>().Explode(); gunTransforms = Functions.FindChildTransformsRecruisive(transform, "Turret", true); Detonator detonator = explosion.GetComponent <Detonator>(); if (detonator != null) { detonator.size = 7; detonator.duration = 2f; } startTime = Time.time; }
private void fire() { GameObject player = GameObject.Find("Junkman"); Junkman jm = player.GetComponent <Junkman>(); GameObject det_obj = player.transform.Find("DetonatorFire").gameObject; Detonator det = det_obj.GetComponent <Detonator>(); det.Explode(); det_obj.GetComponent <AudioSource>().Play(); applyDamage(); if (!jm.isShieldActive()) { damageEffectOn(); } }
// Use this for initialization void Start () { ship = GameObject.Find("Ship"); earth = GameObject.Find("Earth"); moon = GameObject.Find("Moon"); currentobj = gameObject; det = currentobj.GetComponent<Detonator>(); startPos = currentobj.transform.position; endPos = startPos; //faces earth if(ship.transform.eulerAngles.y<=90 || ship.transform.eulerAngles.y>270){ endPos.z = 15000; } //faces moon else{ endPos.z=-4000; } distance = Vector3.Distance(startPos, endPos); startTime = Time.time; }
void FixedUpdate() { //nav.SetDestination(playerPosition.transform.position); transform.position = Vector3.MoveTowards(transform.position, playerPosition.transform.position, .08f); if (Vector3.Distance(gameObject.transform.position, playerPosition.transform.position) < explodeRange) { GameObject explosion1 = (GameObject)Instantiate(explosion, transform.position, transform.rotation); Detonator detonation = explosion1.GetComponent <Detonator>(); suicide = true; Destroy(gameObject); detonationCounter += Time.deltaTime; if (Vector3.Distance(gameObject.transform.position, playerPosition.transform.position) < explodeRange) { CharacterController.health -= 10; } } }
private void SpawnExplosion() { Ray ray = Camera.main.ScreenPointToRay(Input.mousePosition); RaycastHit hit; if (Physics.Raycast(ray, out hit, 1000)) { Detonator dTemp = (Detonator)currentDetonator.GetComponent("Detonator"); float offsetSize = dTemp.size / 3; Vector3 hitPoint = hit.point + ((Vector3.Scale(hit.normal, new Vector3(offsetSize, offsetSize, offsetSize)))); GameObject exp = (GameObject)Instantiate(currentDetonator, hitPoint, Quaternion.identity); dTemp = (Detonator)exp.GetComponent("Detonator"); dTemp.detail = detailLevel; Destroy(exp, explosionLife); } }
void OnTriggerEnter(Collider other) { if (!paused) { if (other.tag == "WallDestroyer") { Destroy(gameObject); } else if (other.tag == "Player") { AtomicDetonation.transform.position = other.transform.position; Detonator d = AtomicDetonation.GetComponent <Detonator>(); d.Explode(); InvadersGameData.gameLost = true; Destroy(other.gameObject); // Destruye al player Destroy(gameObject); // Destruye el rocket } } }
void OnCollisionEnter(Collision col) { //Debug.Log (col.gameObject.name); //should just use collision layers if (col.gameObject.GetComponent <Car>() != null && !is_car_dead_) { //make car fall this.setCarDead(); GameObject c = (GameObject)Instantiate(Resources.Load("Detonator-Base")); Detonator explosion = c.GetComponent <Detonator>(); explosion.Explode(); audio_source_.PlayOneShot(audio_source_.clip); //Vector3 explosivePosition = new Vector3(this.transform.position.x,this.transform.position.y +.5f,this.transform.position.z); //this.gameObject.rigidbody.AddExplosionForce(500,explosivePosition,1.0f); } //else if (col) }
public override void ability2Down() { if(abilTimer2 < 0 && globalCD < 0){ abilTimer2 = abilCD2; globalCD = GLOBAL_CD; GameObject Rocket = (GameObject) GameObject.Instantiate(Resources.Load ("Prefabs/Rocket")); Projectile script = Rocket.GetComponent<Projectile>(); int dmg = 10; //Angle, spawn position, parent, ability num, damage, speed, Max_Distance script.setDirectionAndOrigin(rightStickAngle, transform.position, gameObject, 2, 0, 14, 16); tryToHome(Rocket, script); detonator = Rocket.GetComponent<Detonator>(); detonator.init (dmg, 2, gameObject); abilPressed2 = true; } }
private void GenerateNewTreat() { int index = UnityEngine.Random.Range(0, m_possibleTreats.Count); IItem item; int roll = UnityEngine.Random.Range(0, 100); if (roll < m_detonatorPercent) { item = new Detonator(); } else { item = new Treat(); //Treat treat = new Treat(); } item.Position = m_possibleTreats[index]; m_treats.Add(item); m_possibleTreats.RemoveAt(index); }
void Start() { _displayScore = this.GetComponent<UILabel>(); _goodEmiter = goodEmiter.GetComponent<Detonator>(); _badEmiter = badEmiter.GetComponent<Detonator>(); }
// Use this for initialization void Start() { //This gets called after SetWaveAI, because Unity. lastStateTime = Time.time; nextFire = 10000;//Time.time + Random.Range(0f, 1f); player = (IPlayer)(GameObject.FindGameObjectWithTag("Player").GetComponents(typeof(IPlayer)))[0]; explosion = this.GetComponentInChildren<Detonator>(); trench = GameObject.FindGameObjectWithTag("L4_Trench").transform; }
void Start() { explosion = gameObject.GetComponent<Detonator> (); //rend = GetComponent <MeshRenderer> () }
void Awake() { detonator = GetComponent<Detonator>(); }
void Awake() { _particlesDetonator = particlesDetonator.GetComponent<Detonator>(); }
public void CheckHandbrake() { //if(throttle <= -0.5f && Mathf.Abs(steer) >= 0.6f && relativeVelocity.z > 5.0f) if(pressBrake && Mathf.Abs(steer) >= 0.9f && CarSpeed > MinDragVel) { if(!handbrake) { handbrake = true; IsDrift = true; if(!enabledXShake) { enabledXShake = true; SendMessage(XShakeIt, SendMessageOptions.DontRequireReceiver); } steerDir = steer; handbrakeTime = Time.time; dragMultiplier.x = initialDragMultiplierX * handbrakeXDragFactor; // diff = initialDragMultiplierX - dragMultiplier.x; MyTransform.RotateAround((frontWheels[frontWheels.Length - 2].position + frontWheels[frontWheels.Length - 1].position) * 0.5f,//transform.position + transform.right * turnRadius * steer, transform.up, 5.0f * steer); if(fx == null) { fx = Instantiate(DriftFx,MyTransform.position,Quaternion.identity) as Detonator; fx.destroyTime = 0f; fx.Followed = transform; } //fx.parent = transform; // fx.transform.position = MyTransform.position; fx.Explode(); if(IsPlayer){ MySmoothFollow.height = MySmoothFollow.GetOriginalHeight() * 1.5f; } } } else { if(handbrake) { handbrake = false; StartCoroutine(StopHandbraking(Mathf.Min(5.0f, Time.time - handbrakeTime))); } // Get the x value of the dragMultiplier back to its initial value in the specified time. //dragMultiplier.x = Mathf.Clamp(dragMultiplier.x + diff * (Time.deltaTime / Mathf.Min(5, Time.deltaTime - handbrakeTime)), diff * (Time.deltaTime / Mathf.Min(5, Time.time - handbrakeTime)), initialDragMultiplierX); //dragMultiplier.x = initialDragMultiplierX; } }
public override void abilityLanded(int abilityNum, GameObject hitObject) { if(abilityNum == 1){ }else if(abilityNum == 2){ detonator.detonate(); detonator = null; }else if(abilityNum == 3){ homingTimer = homingTime; homingTarget = hitObject.GetComponent<CharacterClass>(); } }