Ejemplo n.º 1
0
 public void DetachTrail()
 {
     if (TrailEffect != null)
     {
         TrailEffect.transform.parent = null;
         TrailEffect.enabled          = true;
         ParticleSystem ps = TrailEffect.GetComponent <ParticleSystem>();
         if (ps != null)
         {
             ps.Stop();
         }
     }
 }
Ejemplo n.º 2
0
    // Update is called once per frame
    void FixedUpdate()
    {
        if (state == Modes.Exploding)
        {
            if (counter.Count(ExplosionTime))
            {
                explosionObject.transform.parent = null;
                explosionObject.enabled          = true;
                explosionObject.GetComponent <ParticleSystem>().Stop();
                GameObject.Destroy(gameObject);
            }
        }
        else
        {
            float dist = (transform.position - Planet.transform.position).magnitude;

            if (state != Modes.Flying && dist > camController.MaxSize)
            {
                StartDestruction();
            }

            if (state == Modes.Orbiting)
            {
                if (counter.Count(FirePeriod))
                {
                    animator.SetTrigger("Fire");
                    counter.Reset(Random.Range(0, FirePeriod * 0.15f));
                }
            }
            else if (state == Modes.Appearing)
            {
                if (counter.Count(AppearingTime))
                {
                    counter.Reset();
                    state = Modes.Orbiting;
                    GetComponent <Collider2D>().enabled = true;
                }
            }
        }
    }