// Update is called once per frame void Update() { if (transform.position.z < -15.0f) { alive = false; squadManager.DecreaseNumber(); Destroy(gameObject); } if ((Mathf.Abs(transform.position.x - player.transform.position.x) < 0.1f) && !turbo) { turbo = true; gameObject.transform.parent = null; propellerStart.SetActive(true); propellerOn.SetActive(true); } if (!turbo) { transform.position += new Vector3(speed * Time.deltaTime * direction * tb.scaleOfTime, 0.0f, 0.0f); } else { transform.position += new Vector3(0.0f, 0.0f, -turbospeed * Time.deltaTime * tb.scaleOfTime); } ManageHit(); }
public void DecreaseNumber() { --numOfMembers; if (numOfMembers == 0) { if (isSubsquad) { squadManagerParent.DecreaseNumber(); Destroy(gameObject); } else { Manager.StartWait(); Destroy(gameObject); ScoreScript.score = ScoreScript.score + (int)(500 * ScoreScript.multiplierScore); } } }
private void OnTriggerEnter(Collider other) { if (other.gameObject.tag == "PlayerProjectile") { hitAudioSource.Play(); if (!shielded) { life -= other.gameObject.GetComponent <Projectile>().damage; } if (life <= 0.0f) { Instantiate(Resources.Load("Explosion"), transform.position, transform.rotation); squadManager.DecreaseNumber(); Destroy(gameObject); ScoreScript.score = ScoreScript.score + (int)(1500 * ScoreScript.multiplierScore); } } }
private void OnTriggerEnter(Collider other) { if (other.gameObject.tag == "PlayerProjectile" && life > 0.0f) { if (!hitAudioSource.enabled) { hitAudioSource.enabled = true; } hitAudioSource.Play(); if (!shielded) { life -= other.gameObject.GetComponent <Projectile>().damage; hit = true; } if (life <= 0.0f) { if (gameObject.name != "AlienArmored") { Instantiate(Resources.Load("Explosion"), transform.position, transform.rotation); } else { Instantiate(Resources.Load("ExplosionBig"), transform.position, transform.rotation); } //Testing Plugin Vibrator GamePad.SetVibration(0, 0.0f, 2.0f); //Testing Plugin Vibrator GamePad.SetVibration(0, 0.0f, 0.0f); vibratorOn(); ScoreScript.score = ScoreScript.score + (int)(100 * ScoreScript.multiplierScore); if (enemyDestroyed) { enemyDestroyed.SetActive(true); } squadManager.DecreaseNumber(); Destroy(gameObject); } } }