Exemple #1
0
    public void FireAction()
    {
        if (currentAnimation != null && currentAnimation.IsPlaying())
        {
            return;
        }

        if (SeedControl.SceneInstance.CanUseSeed())
        {
            currentAnimation = ShootAnimation(() => {
                SeedControl.SceneInstance.UseSeed();

                var shotParticles = CannonHead.GetComponentInChildren <ParticleSystem>();
                if (shotParticles != null)
                {
                    shotParticles.Play();
                }

                SeedPod projectile  = Instantiate <SeedPod> (SeedPodProjectile, CannonHead.transform.position, Quaternion.LookRotation(aimDirection, transform.up));
                projectile.Velocity = aimDirection * GameParametersControl.ProjectileSpeed;
                PlayerControl.SceneInstance.ActiveControllable = projectile;
                projectile.Creator = this;
            });
        }
    }
Exemple #2
0
    void Start()
    {
        SeedPod pod = GetComponent <SeedPod> ();

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

        pod.Velocity           = (Target.position - transform.position).normalized * GameParametersControl.ProjectileSpeed;
        pod.transform.rotation = Quaternion.LookRotation(pod.Velocity, transform.up);

        Destroy(this);
    }
    void OnSeeded(SeedPod seedPod)
    {
        if (Harvested)
        {
            return;
        }

        if (SeedControl.SceneInstance != null)
        {
            SeedControl.SceneInstance.AddSeeds(SeedYield);
        }

        Harvested = true;

        if (GoalControl.SceneInstance != null)
        {
            GoalControl.SceneInstance.HarvestPlanet(this);
        }
    }
Exemple #4
0
 public void OnSeedHit(SeedPod pod)
 {
     SendMessage("OnSeeded", pod);
 }