Beispiel #1
0
        public override void Update(UpdateParameters p)
        {
            base.Update(p);

            if (!animation.InProgress || animation.IsPaused)
                return;
			
			double newTime = Math.Max(timeReader.GetValue(), 0.0);
			
			if (this.CurrentTime != newTime)
			{
				this.CurrentTime = newTime;
				
				for(int i = 0; i < animation.curves.Count; i++)
				{
					animation.curves[i].Keys.Remove(this.CurveKeys[i]);
                    this.CurveKeys[i] = new CurveKey((float)this.CurrentTime, (float)this.valueReaders[i].GetValue());
					animation.curves[i].Keys.Add(this.CurveKeys[i]);
				}
			} 
			else
			{
		        for (int i = 0; i < this.valueReaders.Count; i++)
		        {
		            this.CurveKeys[i].Value = (float)this.valueReaders[i].GetValue();
		        }
			}
        }
Beispiel #2
0
        public ScreenEngine(GameEngine game, string fileName)
        {
            this.game     = game;
            this.Content  = new ContentManager(game.Services, GameEngine.ContentRootDirectory);
            this.FileName = fileName;

            this.CurrentEvents = new Dictionary <string, bool>();
            this.tapAreas      = new List <XTapArea>();
            this.obstacles     = new List <XElement>();

            this.spriteBatch = new SpriteBatchWithFloats(this.game.GraphicsDevice);

            if (this.game.Scale != Vector3.One)
            {
                scaleMatrix = Matrix.CreateScale(this.game.Scale);
            }

            this.initializeParameters = new InitializeParameters()
            {
                Game = game, ScreenEngine = this
            };
            this.updateParameters = new UpdateParameters()
            {
                Game = game, ScreenEngine = this
            };
            this.drawParameters = new DrawParameters()
            {
                Game = game, ScreenEngine = this, SpriteBatch = spriteBatch
            };
        }
Beispiel #3
0
		internal override void UpdateProgress(UpdateParameters p)
		{
			if (this.objects != null)
			{
				for(int i = 0; i < this.objects.Count; i++)
				{
					var obj = this.objects[i];

					if (obj.Enabled)
					{
						this.Current = this.objects[i];
						this.UpdateChildren(p);
					}
				}
			}
			else
			{
				p.ScreenEngine.RootComponent.TraveseTree(o => {
					if (this.TypeFilterType.IsAssignableFrom(o.GetType()))
					{
						if (o.Enabled)
						{
							this.Current = o;
							this.UpdateChildren(p);
						}
					}
				});
			}
		}
Beispiel #4
0
		public override void Update(UpdateParameters p)
		{
			base.Update(p);
			
			time += p.GameTime.ElapsedGameTime;
			
			Radius = p.LevelEngine.Tower.SignalSpeed * time.TotalSeconds;
			Diameter = Radius * 2.0;

			if (Radius > GameEngine.MaxWaveTravelDistance)
				return;

            if (Diameter <= GameEngine.MinWaveTextureDiameter)
                textureDiameter = GameEngine.MinWaveTextureDiameter;
            else if (Diameter >= GameEngine.MaxWaveTextureDiameter)
                textureDiameter = GameEngine.MaxWaveTextureDiameter;
			else {
                textureDiameter = Diameter - Diameter % GameEngine.WaveTextureDiameterStep;
			}

            texture = p.Game.WaveTextures[(int)textureDiameter / GameEngine.WaveTextureDiameterStep - 1];

            bounds.Width = (int)(Radius + p.LevelEngine.Tower.Bounds.Width / 2);
            bounds.Height = (int)(Radius + p.LevelEngine.Tower.Bounds.Height / 2);
		}
Beispiel #5
0
        public override void Update(UpdateParameters p)
        {
            base.Update(p);

            time += p.GameTime.ElapsedGameTime;

            Radius   = p.LevelEngine.Tower.SignalSpeed * time.TotalSeconds;
            Diameter = Radius * 2.0;

            if (Radius > GameEngine.MaxWaveTravelDistance)
            {
                return;
            }

            if (Diameter <= GameEngine.MinWaveTextureDiameter)
            {
                textureDiameter = GameEngine.MinWaveTextureDiameter;
            }
            else if (Diameter >= GameEngine.MaxWaveTextureDiameter)
            {
                textureDiameter = GameEngine.MaxWaveTextureDiameter;
            }
            else
            {
                textureDiameter = Diameter - Diameter % GameEngine.WaveTextureDiameterStep;
            }

            texture = p.Game.WaveTextures[(int)textureDiameter / GameEngine.WaveTextureDiameterStep - 1];

            bounds.Width  = (int)(Radius + p.LevelEngine.Tower.Bounds.Width / 2);
            bounds.Height = (int)(Radius + p.LevelEngine.Tower.Bounds.Height / 2);
        }
Beispiel #6
0
		public override void Update(UpdateParameters p)
		{
			if (!CacheContent || !updated)
			{
				base.Update(p);
				updated = true;
			}
			else
				this.TraveseTree(o => o.PreventUpdate());
		}
Beispiel #7
0
        public override void Update(UpdateParameters p)
		{
			if (!this.inProgress || this.isPaused)
				return;

			this.elapsedTime += p.GameTime.ElapsedGameTime;
			
			if (this.elapsedTime.TotalSeconds > this.durationReader.GetValue())
				this.Stop();
			
			base.Update(p);
		}
Beispiel #8
0
 public override void Update(UpdateParameters p)
 {
     if (!CacheContent || !updated)
     {
         base.Update(p);
         updated = true;
     }
     else
     {
         this.TraveseTree(o => o.PreventUpdate());
     }
 }
Beispiel #9
0
        /// <inheritdoc />
        public override void Update(UpdateParameters p)
        {
			if (!this.inProgress || this.isPaused)
				return;
		
			UpdateTime(p);
			
			if (!this.inProgress || this.isPaused)
				return;
		
			UpdateProgress(p);
        }
Beispiel #10
0
        public override void Update(UpdateParameters p)
        {
            if (p.Game.ScreenEngine.CurrentEvents.ContainsKey("system:levelLoaded"))
            {
                p.GameTime = new GameTime(
                    p.GameTime.TotalGameTime, TimeSpan.Zero
                );

            }

#if IPHONE
			if (updates <= 3)
			{
				if (updates == 3)
					MonoTouch.UIKit.UIApplication.SharedApplication.EndIgnoringInteractionEvents();
				updates++;
			}
#endif

            base.Update(p);
        }
Beispiel #11
0
        internal override void UpdateProgress(UpdateParameters p)
		{
			if (currentRunnable == null)
			{	
				currentRunnable = runnables[currentIndex];
				currentRunnable.Start();
			}
			
			currentRunnable.Update(p);
			
			if (!currentRunnable.InProgress)
			{
				currentRunnable = null;
				currentIndex++;
				
				if (currentIndex >= runnables.Count)
				{	
					repeatsDone++;
					currentIndex -= runnables.Count;
				}
			}
		}
Beispiel #12
0
		public override void Update(UpdateParameters p)
		{
			bool oldIsTriggered = this.isTriggered;
			
			if (oldIsTriggered && this.StayTriggered)
			{
				// once we're triggered, we stay triggered
			}
			// if we belong to a group of triggers and one of them has already signaled - get out
			else if (this.Group != null
			         && this.Parent.GetTriggerGroups().ContainsKey(this.Group)
			          && this.Parent.GetTriggerGroups()[this.Group] == p.Game.CycleNumber)
			{
				this.isTriggered = false;
			}
			else
			{
				// get new state
				this.isTriggered = this.IsTriggered();
			}
			
			// if triggered and belong to a group - need to signal it for others in the group
			if (this.isTriggered && this.Group != null)
				this.Parent.GetTriggerGroups()[this.Group] = p.Game.CycleNumber;
			
			// fire appropriate actions
			if (this.isTriggered && !oldIsTriggered && enterActions != null)
				enterActions.ForEach(a => a.Call());
			if (this.isTriggered && actions != null)
				actions.ForEach(a => a.Call());
			if (!this.isTriggered && oldIsTriggered && exitActions != null)
				exitActions.ForEach(a => a.Call());

			if (this.isTriggered)
				base.Update(p);
		}
Beispiel #13
0
        /// <exclude />
        internal override void UpdateProgress(UpdateParameters p)
		{
			// update keyframes first
			this.UpdateChildren(p);

			this.UpdateAnimation();
			
			if (this.EnableTrace && this.trace.Count < this.trace.Capacity)
				this.trace.Add(new Tuple<double, double>(p.GameTime.ElapsedGameTime.TotalMilliseconds,targets[0].GetValue()));
        }
Beispiel #14
0
		public override void Update(UpdateParameters p)
		{
			base.Update(p);


            if (this.TapType == XTapType.None)
            {
                // noop
            }
            else if (pressActions != null && this.TapType == XTapType.Press)
            {
                pressActions.ForEach(a => a.Call());
            }
            else if (moveActions != null && (this.TapType == XTapType.Press || this.TapType == XTapType.Move))
            {
                moveActions.ForEach(a => a.Call());
            }
            else if (releaseActions != null && this.TapType == XTapType.Release)
            {
                releaseActions.ForEach(a => a.Call());
            }
			
			this.TapType = XTapType.None;
		}
Beispiel #15
0
        internal override void UpdateProgress(UpdateParameters p)
		{
            actions.ForEach(a => a.Call());
			this.repeatsDone++;
		}		
Beispiel #16
0
		internal virtual void UpdateTime(UpdateParameters p)
		{
			this.elapsedTime += p.GameTime.ElapsedGameTime.TotalSeconds;
        	
    		if (this.RepeatTime != 0f)
			{
				if (this.elapsedTime > this.RepeatTime)
					  Stop();
			}
			else if (this.RepeatCount != 0f)
			{
				repeatsDone = CalculateRepeatsDone();

				if (repeatsDone >= this.RepeatCount)
					Stop();
			} 
		}
Beispiel #17
0
		internal abstract void UpdateProgress(UpdateParameters p);
Beispiel #18
0
        internal void UpdateChildren(UpdateParameters p)
		{
			base.Update(p);
		}