public void Update() { switch (type) { case "CHEST": { if (Game1.DistanceBetweenPoints(new Vector2(rec.X, rec.Y), Player.pos) < 100 && Game1.ButtonPressedCamera(rec, Game1.playerCam) == "PRESSED" && oneTime) { animation = new Animation(Game1.objectsAnimationTex[1], 5, 5, 23, 1, 23, Animation.ANIMATE_ONCE, 10, new Vector2(rec.X, rec.Y), 1f, true); animation.destRec = rec; oneTime = false; } break; } case "CHEST TRAP": { if (Game1.DistanceBetweenPoints(new Vector2(rec.X, rec.Y), Player.pos) < 100 && Game1.ButtonPressedCamera(rec, Game1.playerCam) == "PRESSED" && oneTime) { animation = new Animation(Game1.objectsAnimationTex[2], 6, 7, 41, 1, 41, Animation.ANIMATE_ONCE, 10, new Vector2(rec.X, rec.Y), 1f, true); animation.destRec = rec; oneTime = false; } break; } } animation.Update(Game1.gameTimePublic); }