Exemple #1
0
		public ScaleByState (ScaleTo action, Node target)
			: base (action, target)
		{ 
			DeltaX = StartScaleX * EndScaleX - StartScaleX;
			DeltaY = StartScaleY * EndScaleY - StartScaleY;
			DeltaZ = StartScaleZ * EndScaleZ - StartScaleZ;
		}
Exemple #2
0
 public ScaleByState(ScaleTo action, Node target)
     : base(action, target)
 {
     DeltaX = StartScaleX * EndScaleX - StartScaleX;
     DeltaY = StartScaleY * EndScaleY - StartScaleY;
     DeltaZ = StartScaleZ * EndScaleZ - StartScaleZ;
 }
Exemple #3
0
		public ScaleToState (ScaleTo action, Node target)
			: base (action, target)
		{
			var scale = target.Scale;
			StartScaleX = scale.X;
			StartScaleY = scale.Y;
			StartScaleZ = scale.Z;
			EndScaleX = action.EndScaleX;
			EndScaleY = action.EndScaleY;
			EndScaleZ = action.EndScaleZ;
			DeltaX = EndScaleX - StartScaleX;
			DeltaY = EndScaleY - StartScaleY;
			DeltaZ = EndScaleZ - StartScaleZ;
		}
Exemple #4
0
        public ScaleToState(ScaleTo action, Node target)
            : base(action, target)
        {
            var scale = target.Scale;

            StartScaleX = scale.X;
            StartScaleY = scale.Y;
            StartScaleZ = scale.Z;
            EndScaleX   = action.EndScaleX;
            EndScaleY   = action.EndScaleY;
            EndScaleZ   = action.EndScaleZ;
            DeltaX      = EndScaleX - StartScaleX;
            DeltaY      = EndScaleY - StartScaleY;
            DeltaZ      = EndScaleZ - StartScaleZ;
        }
Exemple #5
0
		/// <summary>
		/// Explode the aircraft with animation
		/// </summary>
		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();
		}
Exemple #6
0
		public override async void OnHit(Aircraft target, bool killed, Node bulletNode)
		{
			// show a small explosion when the missile reaches an aircraft. 
			base.OnHit(target, killed, bulletNode);
			var cache = Application.ResourceCache;
			var explosionNode = Scene.CreateChild();

			// play "boom" sound
			SoundSource soundSource = explosionNode.CreateComponent<SoundSource>();
			soundSource.Play(Application.ResourceCache.GetSound(Assets.Sounds.SmallExplosion));
			soundSource.Gain = 0.2f;

			explosionNode.Position = target.Node.WorldPosition;
			explosionNode.SetScale(1f);
			var particleEmitter = explosionNode.CreateComponent<ParticleEmitter2D>();
			particleEmitter.Effect = cache.GetParticleEffect2D(Assets.Particles.MissileTrace);
			var scaleAction = new ScaleTo(0.5f, 0f);
			await explosionNode.RunActionsAsync(scaleAction, new DelayTime(0.5f));
			explosionNode.Remove();
		}