Esempio n. 1
0
 void Update()
 {
     if (transform.position.y < -1)
     {
         ObjectPoolHelper.Destroy(gameObject);
     }
 }
Esempio n. 2
0
    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);
    }
Esempio n. 5
0
 void Explode()
 {
     fort.GetComponent <FortController> ().DoDamage(fortImpactDamage);
     ObjectPoolHelper.Destroy(gameObject);
 }