예제 #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
파일: XImage.cs 프로젝트: valsavva/dynacat
		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;
        }