void Update() { if (transform.position.y < -1) { ObjectPoolHelper.Destroy(gameObject); } }
void Update() { transform.Translate(Vector3.up * liftSpeed * Time.deltaTime); if (timer > 0f) { timer -= Time.deltaTime; } if (timer <= 0f) { ObjectPoolHelper.Destroy(gameObject); } }
private void ReportImpact() { if (!isEnemy) { GameObject.FindGameObjectWithTag("GameController") .GetComponent <SkillActionController> () .CallbackCannonballHit(endPosition); } else { // report the impact to the game controller or the fort? GameObject.FindGameObjectWithTag("Fort").GetComponent <FortController> ().DoDamage(fortDamage); ObjectPoolHelper.Destroy(gameObject); } }
void Update() { Animation += Time.deltaTime; if (Animation > flightTime) { ReportImpact(); ObjectPoolHelper.Destroy(gameObject); } Animation = Animation % flightTime; transform.position = MathParabola.Parabola( startPosition, endPosition, maxHeight, Animation / flightTime); }
void Explode() { fort.GetComponent <FortController> ().DoDamage(fortImpactDamage); ObjectPoolHelper.Destroy(gameObject); }