Example #1
0
        public virtual void UpdateLogic(OfficeWorld officeWorld, Time timeElapsed)
        {
            if (this.isFocused != this.previousIsFocused)
            {
                officeWorld.NotifyObjectFocusChanged(this, this.isFocused);

                this.previousIsFocused = this.isFocused;
            }

            if (this.currentAnimationIndex != this.previousAnimationIndex)
            {
                officeWorld.NotifyObjectAnimationChanged(this, this.currentAnimationIndex);

                this.previousAnimationIndex = this.currentAnimationIndex;
            }

            if (this.speedVector != null &&
                (this.speedVector.X != 0 || this.speedVector.Y != 0))
            {
                this.position += this.speedVector * timeElapsed.AsSeconds();
            }

            if (this.previousPosition.X != this.position.X ||
                this.previousPosition.Y != this.position.Y)
            {
                officeWorld.NotifyObjectPositionChanged(this, this.position);

                this.previousPosition = new Vector2f(this.position.X, this.position.Y);
            }
        }