private void ApplyTitle() { switch (pointController.type) { case EnumPointType.Player: Title.text = pointController.GetComponent <SpaceshipController>().Title; break; case EnumPointType.Point: Title.text = LocalizationManager.Instance.Get(pointController.title).ToUpper(); break; case EnumPointType.Enemy: Title.text = pointController.GetComponent <SpaceshipController>().Title; break; default: Title.text = LocalizationManager.Instance.Get("na").ToUpper(); break; } }
public void DestroySelf() { if (currentTime > timeToDestroy) { controller.GetComponent <PointController>().pointsQuant--; //control.text = "destruiu"; //Debug.Log("destruiu"); currentTime = 0; Destroy(gameObject); } else { currentTime += Time.deltaTime; } }
private void OnTriggerEnter(Collider other) { if (other.gameObject.CompareTag("PikUp")) { GameObject NovaParticula = Instantiate(particulaPoint); NovaParticula.transform.position = other.transform.position; Destroy(other.gameObject); count = count + 20; pointControl.GetComponent <PointController>().pointsQuant--; SetCountText(); eventAudio.PlayOneShot(pikup); } if (other.gameObject.CompareTag("PikUp1")) { GameObject NovaParticula = Instantiate(particulaPoint); NovaParticula.transform.position = other.transform.position; Destroy(other.gameObject); count = count + 50; pointControl.GetComponent <PointController>().pointsQuant--; SetCountText(); eventAudio.PlayOneShot(pikup); } if (other.gameObject.CompareTag("PikUp2")) { GameObject NovaParticula = Instantiate(particulaPoint); NovaParticula.transform.position = other.transform.position; Destroy(other.gameObject); count = count + 100; pointControl.GetComponent <PointController>().pointsQuant--; SetCountText(); eventAudio.PlayOneShot(pikup); } if (other.gameObject.CompareTag("PikUp3")) { GameObject NovaParticula = Instantiate(particulaPoint); NovaParticula.transform.position = other.transform.position; Destroy(other.gameObject); count = count + 200; pointControl.GetComponent <PointController>().pointsQuant--; SetCountText(); eventAudio.PlayOneShot(pikup); } if (other.gameObject.CompareTag("speed")) { GameObject NovaParticula = Instantiate(particulaSpeed); NovaParticula.transform.position = transform.position; NovaParticula.transform.parent = transform; eventAudio.PlayOneShot(healpotion); cameraAudio.clip = speedBust; cameraAudio.Play(); delayVel = 8.0f; Destroy(other.gameObject); } if (other.gameObject.CompareTag("power")) { GameObject NovaParticula = Instantiate(particulaPower); NovaParticula.transform.position = transform.position; NovaParticula.transform.parent = transform; eventAudio.PlayOneShot(healpotion); cameraAudio.clip = PowerBust; cameraAudio.Play(); delayPower = 8.0f; Destroy(other.gameObject); } if (other.gameObject.CompareTag("cure")) { eventAudio.PlayOneShot(healpotion); if (life <= 300) { life = life + 100; GameObject NovaParticula = Instantiate(particulahit); NovaParticula.transform.position = transform.position; NovaParticula.transform.parent = transform; delay = 0; } Destroy(other.gameObject); } if (other.gameObject.CompareTag("enemy")) { if (delay > timeToDamage) { GameObject NovaParticula = Instantiate(particulahit); NovaParticula.transform.position = transform.position; NovaParticula.transform.parent = transform; rb.AddForce(jump * jumpForce); other.GetComponent <EnemyBehavior>().destroy = true; //Destroy(other.gameObject); count = count + 100; SetCountText(); eventAudio.PlayOneShot(enemyhit); enemyControl.text = "diminui"; delay = 0; } } if (other.gameObject.CompareTag("death")) { life = 0; eventAudio.PlayOneShot(deathTouch); } if (other.gameObject.CompareTag("walldeath")) { gameObject.transform.position = new Vector3(20.9f, 4.63f, 21.2f); } if (other.gameObject.CompareTag("slow") && gameObject.tag == "Player") { speed = 4; velStart = true; } }