本文整理汇总了C#中ZeldaOracle.Common.Geometry.Vector2F类的典型用法代码示例。如果您正苦于以下问题:C# Vector2F类的具体用法?C# Vector2F怎么用?C# Vector2F使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Vector2F类属于ZeldaOracle.Common.Geometry命名空间,在下文中一共展示了Vector2F类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Unit
//-----------------------------------------------------------------------------
// Constructors
//-----------------------------------------------------------------------------
public Unit()
{
EnablePhysics();
isKnockbackable = true;
isDamageable = true;
isPassable = false;
knockbackSpeed = GameSettings.UNIT_KNOCKBACK_SPEED;
knockbackDuration = GameSettings.UNIT_KNOCKBACK_DURATION;
hurtInvincibleDuration = GameSettings.UNIT_HURT_INVINCIBLE_DURATION;
hurtFlickerDuration = GameSettings.UNIT_HURT_FLICKER_DURATION;
knockbackTimer = 0;
hurtFlickerTimer = 0;
invincibleTimer = 0;
knockbackVelocity = Vector2F.Zero;
tools = new HashSet<UnitTool>();
syncAnimationWithDirection = false;
direction = Directions.Right;
health = 1;
healthMax = 1;
direction = Directions.Right;
centerOffset = new Point2I(8, 8);
}
示例2: PlayerJumpToState
//-----------------------------------------------------------------------------
// Constructors
//-----------------------------------------------------------------------------
public PlayerJumpToState()
{
destination = Vector2F.Zero;
destinationZPosition = 0.0f;
jumpDuration = 26;
endAction = null;
}
示例3: ViewControl
//-----------------------------------------------------------------------------
// Constructors
//-----------------------------------------------------------------------------
public ViewControl()
{
this.viewSize = GameSettings.VIEW_SIZE;
this.panSpeed = GameSettings.VIEW_PAN_SPEED;
this.position = Vector2F.Zero;
this.shakeOffset = Vector2F.Zero;
}
示例4: OnSwingTilePeak
public override void OnSwingTilePeak(int angle, Vector2F hitPoint)
{
if ((angle == Directions.ToAngle(SwingDirection)
|| !limitTilesToDirection) && player.IsOnGround)
{
CutTilesAtPoint(hitPoint);
}
}
示例5: EventTile
//-----------------------------------------------------------------------------
// Constructors
//-----------------------------------------------------------------------------
public EventTile()
{
roomControl = null;
eventData = null;
position = Vector2F.Zero;
size = Point2I.One;
properties = new Properties();
collisionBox = new Rectangle2I(0, 0, 16, 16);
}
示例6: Initialize
//-----------------------------------------------------------------------------
// Overridden methods
//-----------------------------------------------------------------------------
public override void Initialize()
{
base.Initialize();
// Find the center position of the hole tile.
Point2I location = RoomControl.GetTileLocation(position);
holeCenterPosition = (Vector2F) location + new Vector2F(0.5f, 0.5f);
holeCenterPosition *= GameSettings.TILE_SIZE;
}
示例7: Line2F
/** <summary> Constructs a line with the specified position and size. </summary> */
public Line2F(Vector2F point, float width, float height, bool asSize)
{
if (!asSize) {
this.End1 = point;
this.End2 = point + new Vector2F(width, height);
}
else {
this.End1 = point;
this.End2 = new Vector2F(width, height);
}
}
示例8: DamageInfo
public DamageInfo(int amount, Vector2F sourcePosition)
{
this.amount = amount;
this.hasSource = true;
this.sourcePosition = sourcePosition;
this.applyKnockBack = true;
this.knockbackDuration = -1;
this.flicker = true;
this.flickerDuration = GameSettings.MONSTER_HURT_FLICKER_DURATION;
this.invincibleDuration = -1;
}
示例9: AnalogStick
//========= CONSTRUCTORS =========
/** <summary> Constructs the default control. </summary> */
public AnalogStick()
{
this.directions = new InputControl[4];
this.disabledState = DisableState.Enabled;
this.position = Vector2F.Zero;
this.deadZone = 0.28;
this.directionDeadZone = new Vector2F(0.83f, 0.83f);
for (int i = 0; i < 4; i++)
this.directions[i] = new InputControl();
}
示例10: Intersecting
//-----------------------------------------------------------------------------
// Static methods
//-----------------------------------------------------------------------------
public static bool Intersecting(CollisionModel model,
Vector2F modelPosition,
Rectangle2F box,
Vector2F boxPosition)
{
Rectangle2F boxTranslated = Rectangle2F.Translate(box, boxPosition - modelPosition);
for (int i = 0; i < model.boxes.Count; i++) {
Rectangle2F modelBox = model.boxes[i];
if (boxTranslated.Intersects(modelBox))
return true;
}
return false;
}
示例11: TileGraphicsComponent
//-----------------------------------------------------------------------------
// Constructor
//-----------------------------------------------------------------------------
public TileGraphicsComponent(Tile tile)
{
this.tile = tile;
this.animationPlayer = new AnimationPlayer();
this.isVisible = true;
this.depthLayer = DepthLayer.TileLayer1;
this.imageVariant = 0;
this.raisedDrawOffset = Point2I.Zero;
this.drawOffset = Point2I.Zero;
this.syncPlaybackWithRoomTicks = true;
this.isAnimatedWhenPaused = false;
this.absoluteDrawPosition = Vector2F.Zero;
this.useAbsoluteDrawPosition = false;
}
示例12: Entity
//-----------------------------------------------------------------------------
// Constructors
//-----------------------------------------------------------------------------
public Entity()
{
roomControl = null;
isAlive = false;
isInRoom = false;
isInitialized = false;
position = Vector2F.Zero;
zPosition = 0.0f;
physics = new PhysicsComponent(this);
graphics = new GraphicsComponent(this);
originOffset = Point2I.Zero;
centerOffset = Point2I.Zero;
actionAlignDistance = 5;
}
示例13: into
private Entity transformedEntity; // The entity this entity has transformed into (bomb -> explosion)
#endregion Fields
#region Constructors
//-----------------------------------------------------------------------------
// Constructors
//-----------------------------------------------------------------------------
public Entity()
{
entityIndex = -1;
roomControl = null;
isAlive = false;
isInRoom = false;
isInitialized = false;
transformedEntity = null;
soundBounce = null;
position = Vector2F.Zero;
zPosition = 0.0f;
previousPosition = Vector2F.Zero;
previousZPosition = 0.0f;
physics = new PhysicsComponent(this);
graphics = new GraphicsComponent(this);
centerOffset = Point2I.Zero;
actionAlignDistance = 5;
}
示例14: Graphics2D
//-----------------------------------------------------------------------------
// Constructors
//-----------------------------------------------------------------------------
// Constructs a 2D graphics object containing the sprite batch.
public Graphics2D(SpriteBatch spriteBatch)
{
// Containment
this.spriteBatch = spriteBatch;
this.preivousRenderTargets = new Stack<RenderTargetBinding[]>();
// Drawing Settings
this.translation = Vector2F.Zero;
this.useTranslation = true;
this.useIntPrecision = false;
// Vector Graphics
this.white1x1 = new Texture2D(spriteBatch.GraphicsDevice, 1, 1);
this.white2x2 = new Texture2D(spriteBatch.GraphicsDevice, 2, 2);
this.white1x1.SetData(new Color[] { Color.White });
this.white2x2.SetData(new Color[] { Color.White, Color.White, Color.White, Color.White });
this.drawingColor = XnaColor.White;
}
示例15: NearestFromVector
public static int NearestFromVector(Vector2F vector)
{
// Cheap algorithm for turning a vector into an axis-aligned direction.
if (vector.X > 0) {
if (vector.X >= Math.Abs(vector.Y))
return Directions.Right;
else if (vector.Y < 0)
return Directions.Up;
else
return Directions.Down;
}
else {
if (-vector.X >= Math.Abs(vector.Y))
return Directions.Left;
else if (vector.Y < 0)
return Directions.Up;
else
return Directions.Down;
}
}