Exemplo n.º 1
0
    void OnLand(Landable landable, Vector3 landPoint)
    {
        landable.OnSeedHit(this);

        landable.Infest(landPoint, InfestOnLanding);

        var plant = Instantiate <CannonPlant> (GrowOnLanding);

        plant.Attach(landable, landPoint, transform.forward);

        if (!Dummy)
        {
            PlayerControl.SceneInstance.ActiveControllable = plant;
        }

        var plantParticles = GetComponentInChildren <ParticleSystem> ();

        plantParticles.transform.SetParent(landable.transform);
        plantParticles.Play();
        Destroy(plantParticles, 2f);

        var trail = GetComponentInChildren <TrailRenderer> ();

        trail.transform.SetParent(null);
        Destroy(trail, trail.time);

        Destroy(gameObject);
    }