SamplyGame.Aircraft.Explode C# (CSharp) Method

Explode() public method

Explode the aircraft with animation
public Explode ( ) : System.Threading.Tasks.Task
return System.Threading.Tasks.Task
		public async Task Explode()
		{
			Health = 0;
			//create a special independent node in the scene for explosion
			var explosionNode = Scene.CreateChild();
			SoundSource soundSource = explosionNode.CreateComponent<SoundSource>();
			soundSource.Play(Application.ResourceCache.GetSound(Assets.Sounds.BigExplosion));
			soundSource.Gain = 0.5f;

			explosionNode.Position = Node.WorldPosition;
			OnExplode(explosionNode);
			var scaleAction = new ScaleTo(1f, 0f);
			Node.RemoveAllActions();
			Node.Enabled = false;
			await explosionNode.RunActionsAsync(scaleAction, new DelayTime(1f));
			liveTask.TrySetResult(true);
			explosionNode.Remove();
		}