Пример #1
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);
		}
Пример #2
0
		public override void Initialize (InitializeParameters p)
		{
			base.Initialize (p);

            if (string.IsNullOrEmpty(this.TextureId))
                throw new InvalidOperationException(string.Format(
                    "TextureId must be specified. Image: '{0}'", this.Id
                ));

            this.texture = this.FindGlobal(this.TextureId) as XTextureResource;
			
			if (this.texture == null)
				throw new InvalidOperationException(string.Format(
					"Texture was not found. Image: '{0}' TextureId: '{1}'", this.Id, this.TextureId
                ));

            this.SourceRectangle = this.texture.SourceRectangle;
		}
Пример #3
0
        public override void Initialize(InitializeParameters p)
        {
            base.Initialize(p);

            if (string.IsNullOrEmpty(this.TextureId))
            {
                throw new InvalidOperationException(string.Format(
                                                        "TextureId must be specified. Image: '{0}'", this.Id
                                                        ));
            }

            this.texture = this.FindGlobal(this.TextureId) as XTextureResource;

            if (this.texture == null)
            {
                throw new InvalidOperationException(string.Format(
                                                        "Texture was not found. Image: '{0}' TextureId: '{1}'", this.Id, this.TextureId
                                                        ));
            }

            this.SourceRectangle = this.texture.SourceRectangle;
        }