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; }); } }
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); } }
public void OnSeedHit(SeedPod pod) { SendMessage("OnSeeded", pod); }