Exemple #1
0
        public virtual void Update()
        {
            positionPrev = position;

            if (usePhysics)
            {
                PhysicsUpdate();
            }
            else
            {
                position += movement;
            }

            if (Math.Abs(movement.X) < .1f)
            {
                movement.X = 0;
            }
            if (Math.Abs(movement.Y) < .1f)
            {
                movement.Y = 0;
            }
            if (Math.Abs(movement.Z) < .1f)
            {
                movement.Z = 0;
            }

            selectionHitbox = new Rectangle((int)Math.Round(position.X) - origin.X, (int)Math.Round(position.Y) - origin.Y, size.X, size.Y);

            if (SelectionHandler.TrySelect && selectionHitbox.Contains(Game1.mousePosInWorld))
            {
                SelectionHandler.SelectGameObject(id, type);
            }

            currentTile = Terrain.WorldPosToTile(PositionXY.ToPoint());

            if (collider != null)
            {
                UpdateColliderPosition();
            }
        }
Exemple #2
0
 public override void Draw(DrawBatch drawBatch)
 {
     DrawName(drawBatch, .6f);
     item.DrawIcon(drawBatch, new Rectangle(PositionXY.ToPoint() - new Point(8), new Point(16)), DrawBatch.CalculateDepth(PositionXY));
     base.Draw(drawBatch);
 }