2019-07-18 03:30:08 +08:00
|
|
|
using System;
|
|
|
|
using System.Collections.Generic;
|
|
|
|
using System.Linq;
|
|
|
|
using System.Text;
|
|
|
|
using System.Threading.Tasks;
|
|
|
|
using Microsoft.Xna.Framework;
|
|
|
|
|
|
|
|
namespace Revitalize.Framework.Minigame.SeasideScrambleMinigame
|
|
|
|
{
|
|
|
|
public class SSCCamera
|
|
|
|
{
|
|
|
|
|
|
|
|
public xTile.Dimensions.Rectangle viewport;
|
|
|
|
|
2019-07-19 13:10:05 +08:00
|
|
|
public Vector2 Position
|
|
|
|
{
|
|
|
|
get
|
|
|
|
{
|
|
|
|
return new Vector2(this.viewport.X, this.viewport.Y);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2019-07-18 03:30:08 +08:00
|
|
|
public SSCCamera()
|
|
|
|
{
|
|
|
|
this.viewport = new xTile.Dimensions.Rectangle(StardewValley.Game1.viewport);
|
|
|
|
}
|
|
|
|
|
|
|
|
public void snapToPosition(Vector2 position)
|
|
|
|
{
|
|
|
|
this.viewport.Location = new xTile.Dimensions.Location((int)position.X, (int)position.Y);
|
|
|
|
}
|
|
|
|
|
|
|
|
public void centerOnPosition(Vector2 position)
|
|
|
|
{
|
|
|
|
this.viewport.Location = new xTile.Dimensions.Location((int)position.X - (int)(SeasideScramble.self.camera.viewport.Width / 2), (int)position.Y - (int)(SeasideScramble.self.camera.viewport.Height / 2));
|
|
|
|
}
|
|
|
|
|
2019-07-18 07:26:37 +08:00
|
|
|
public Rectangle getXNARect()
|
|
|
|
{
|
|
|
|
return new Rectangle(this.viewport.X, this.viewport.Y, this.viewport.Width, this.viewport.Height);
|
|
|
|
}
|
|
|
|
|
2019-07-18 03:30:08 +08:00
|
|
|
public void update(GameTime time)
|
|
|
|
{
|
|
|
|
|
|
|
|
}
|
2019-07-21 03:36:31 +08:00
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// Checks to see if the given position is inside the viewport.
|
|
|
|
/// </summary>
|
|
|
|
/// <param name="position"></param>
|
|
|
|
/// <returns></returns>
|
|
|
|
public bool positionInsideViewport(Vector2 position)
|
|
|
|
{
|
|
|
|
return this.getXNARect().Contains((int)position.X, (int)position.Y);
|
|
|
|
}
|
2019-07-21 03:44:47 +08:00
|
|
|
|
|
|
|
public bool positionInsideViewport(Point position)
|
|
|
|
{
|
|
|
|
return this.getXNARect().Contains((int)position.X, (int)position.Y);
|
|
|
|
}
|
2019-07-18 03:30:08 +08:00
|
|
|
}
|
|
|
|
}
|