Example #1
0
        private void OnEntityRotationChanged(object sender, Atom.ChangedValue <float> e)
        {
            if (this.body == null)
            {
                return;
            }

            if (this.body.Rotation != e.NewValue)
            {
                this.body.Rotation = e.NewValue;
            }
        }
Example #2
0
        private void OnEntityPositionChanged(object sender, Atom.ChangedValue <Vector2> e)
        {
            if (this.body == null)
            {
                return;
            }

            var physicsPosition = this.body.Position;
            var entityPosition  = e.NewValue;

            if (physicsPosition.X != entityPosition.X ||
                physicsPosition.Y != entityPosition.Y)
            {
                this.body.Position = entityPosition.ToXna();
            }
        }