Пример #1
0
        private void UpdateProps()
        {
            if (PropState.PropCycle == GameEngine.Instance.CycleNumber)
            {
                return;
            }

            if (this.IsRoot || this.ParentElement == null)
            {
                PropState.PropCycle = GameEngine.Instance.CycleNumber;
                PropState.Opacity   = 1;
                PropState.Rotation  = 0;
                PropState.Depth     = DefaultDepth;
                PropState.Scale     = Vector2.One;
                PropState.BackColor = Color.White;
            }
            else
            {
                this.ParentElement.UpdateProps();
                PropState = this.ParentElement.PropState;
            }

            PropState.ScreenBounds = null;
            //---
            PropState.Rotation += this.Rotation;
            PropState.Scale    *= (float)this.Scale;

            if (!this.Bounds.IsEmpty)
            {
                PropState.Size.X = this.Bounds.Width;
                PropState.Size.Y = this.Bounds.Height;
            }

            if (this.depth.HasValue)
            {
                PropState.Depth = this.depth.Value;
            }

            if (this.backColor.HasValue)
            {
                PropState.BackColor = this.backColor.Value;
            }

            PropState.Opacity *= this.Opacity;
        }
Пример #2
0
		private void UpdateProps()
		{
			if (PropState.PropCycle == GameEngine.Instance.CycleNumber)
				return;
			
			if  (this.IsRoot || this.ParentElement == null)
			{
				PropState.PropCycle = GameEngine.Instance.CycleNumber;
				PropState.Opacity = 1;
				PropState.Rotation = 0;
                PropState.Depth = DefaultDepth;
				PropState.Scale = Vector2.One;
				PropState.BackColor = Color.White;
			}
			else
			{
				this.ParentElement.UpdateProps();
				PropState = this.ParentElement.PropState;
			}
			
			PropState.ScreenBounds = null;
			//---
			PropState.Rotation += this.Rotation;
			PropState.Scale *= (float)this.Scale;
			
			if (!this.Bounds.IsEmpty)
			{
				PropState.Size.X = this.Bounds.Width;
				PropState.Size.Y = this.Bounds.Height;
			}
			
			if (this.depth.HasValue)
				PropState.Depth = this.depth.Value;
			
			if (this.backColor.HasValue)
				PropState.BackColor = this.backColor.Value;
			
			PropState.Opacity *= this.Opacity;
		}