A base class for all aircrafts including the player and enemies
Inheritance: Urho.Component
Esempio n. 1
0
		public virtual void OnHit(Aircraft target, bool killed, Node bulletNode)
		{
			var body = bulletNode.GetComponent<RigidBody>();
			if (body != null)
				body.Enabled = false;
			bulletNode.SetScale(0);
		}
Esempio n. 2
0
		public override void OnHit(Aircraft target, bool killed, Node bulletNode)
		{
			var soundSource = Node.CreateComponent<SoundSource>();
			soundSource.Gain = 0.1f;
			soundSource.Play(Application.ResourceCache.GetSound(Assets.Sounds.Powerup));
			base.OnHit(target, killed, bulletNode);
			((SamplyGame)Application).OnCoinCollected();
		}
Esempio n. 3
0
		public override async void OnHit(Aircraft target, bool killed, Node bulletNode)
		{
			// show a small explosion when the cube reaches an aircraft. 
			base.OnHit(target, killed, bulletNode);
			var cache = Application.ResourceCache;
			var explosionNode = Scene.CreateChild();
			SoundSource soundSource = explosionNode.CreateComponent<SoundSource>();
			soundSource.Play(Application.ResourceCache.GetSound(Assets.Sounds.SmallExplosion));
			soundSource.Gain = 0.3f;
			explosionNode.Position = target.Node.WorldPosition;
			explosionNode.SetScale(1.6f);
			var particleEmitter = explosionNode.CreateComponent<ParticleEmitter2D>();
			particleEmitter.Effect = cache.GetParticleEffect2D(Assets.Particles.Explosion);
			ScaleBy scaleBy = new ScaleBy(0.3f, 0.1f);
			await explosionNode.RunActionsAsync(scaleBy, new DelayTime(1f));
			explosionNode.Remove();
		}