• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C# Geometry.Vector2F类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C#中ZeldaOracle.Common.Geometry.Vector2F的典型用法代码示例。如果您正苦于以下问题:C# Vector2F类的具体用法?C# Vector2F怎么用?C# Vector2F使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



Vector2F类属于ZeldaOracle.Common.Geometry命名空间,在下文中一共展示了Vector2F类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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);
        }
开发者ID:trigger-death,项目名称:ZeldaOracle,代码行数:29,代码来源:Unit.cs


示例2: PlayerJumpToState

 //-----------------------------------------------------------------------------
 // Constructors
 //-----------------------------------------------------------------------------
 public PlayerJumpToState()
 {
     destination				= Vector2F.Zero;
     destinationZPosition	= 0.0f;
     jumpDuration			= 26;
     endAction				= null;
 }
开发者ID:trigger-death,项目名称:ZeldaOracle,代码行数:10,代码来源:PlayerJumpToState.cs


示例3: ViewControl

 //-----------------------------------------------------------------------------
 // Constructors
 //-----------------------------------------------------------------------------
 public ViewControl()
 {
     this.viewSize		= GameSettings.VIEW_SIZE;
     this.panSpeed		= GameSettings.VIEW_PAN_SPEED;
     this.position		= Vector2F.Zero;
     this.shakeOffset	= Vector2F.Zero;
 }
开发者ID:trigger-death,项目名称:ZeldaOracle,代码行数:10,代码来源:ViewControl.cs


示例4: OnSwingTilePeak

 public override void OnSwingTilePeak(int angle, Vector2F hitPoint)
 {
     if ((angle == Directions.ToAngle(SwingDirection)
         || !limitTilesToDirection) && player.IsOnGround)
     {
         CutTilesAtPoint(hitPoint);
     }
 }
开发者ID:trigger-death,项目名称:ZeldaOracle,代码行数:8,代码来源:PlayerBaseSwingSwordState.cs


示例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);
 }
开发者ID:trigger-death,项目名称:ZeldaOracle,代码行数:12,代码来源:EventTile.cs


示例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;
        }
开发者ID:trigger-death,项目名称:ZeldaOracle,代码行数:12,代码来源:EffectFallingObject.cs


示例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);
     }
 }
开发者ID:trigger-death,项目名称:ZeldaOracle,代码行数:12,代码来源:Line2F.cs


示例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;
 }
开发者ID:trigger-death,项目名称:ZeldaOracle,代码行数:11,代码来源:DamageInfo.cs


示例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();
        }
开发者ID:trigger-death,项目名称:ZeldaOracle,代码行数:13,代码来源:AnalogStick.cs


示例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;
        }
开发者ID:dreamsxin,项目名称:ZeldaOracle,代码行数:16,代码来源:CollisionModel.cs


示例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;
 }
开发者ID:trigger-death,项目名称:ZeldaOracle,代码行数:17,代码来源:TileGraphicsComponent.cs


示例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;
 }
开发者ID:dreamsxin,项目名称:ZeldaOracle,代码行数:17,代码来源:Entity.cs


示例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;
        }
开发者ID:trigger-death,项目名称:ZeldaOracle,代码行数:27,代码来源:Entity.cs


示例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;
        }
开发者ID:trigger-death,项目名称:ZeldaOracle,代码行数:23,代码来源:Graphics2D.cs


示例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;
     }
 }
开发者ID:trigger-death,项目名称:ZeldaOracle,代码行数:20,代码来源:Direction.cs


示例16: OnBegin

        //-----------------------------------------------------------------------------
        // Overridden Methods
        //-----------------------------------------------------------------------------
        public override void OnBegin(MonsterState previousState)
        {
            monster.IsPassable = true;

            if (galeEffect != null) {
                monster.SetPositionByCenter(galeEffect.Position);
                galeEffect.DestroyAndTransform(monster);
                galeEffect = null;
            }

            timer			= 0;
            isRising		= false;
            galeZPosition	= monster.ZPosition;
            monsterPosition	= monster.Position;

            monster.Physics.Velocity = Vector2F.Zero;
            monster.Graphics.PauseAnimation();
            monster.DisablePhysics();

            galeAnimationPlayer.Play(GameData.ANIM_EFFECT_SEED_GALE);
        }
开发者ID:trigger-death,项目名称:ZeldaOracle,代码行数:24,代码来源:MonsterGaleState.cs


示例17: PhysicsComponent

        private float zVelocity; // Z-Velocity in pixels per frame.

        #endregion Fields

        #region Constructors

        //-----------------------------------------------------------------------------
        // Constructors
        //-----------------------------------------------------------------------------
        // By default, physics are disabled.
        public PhysicsComponent(Entity entity)
        {
            this.isEnabled			= false;
            this.flags				= PhysicsFlags.None;
            this.entity				= entity;
            this.velocity			= Vector2F.Zero;
            this.zVelocity			= 0.0f;
            this.gravity			= GameSettings.DEFAULT_GRAVITY;
            this.maxFallSpeed		= GameSettings.DEFAULT_MAX_FALL_SPEED;
            this.collisionBox		= new Rectangle2F(-4, -10, 8, 9);		// TEMPORARY: this is the player collision box.
            this.softCollisionBox	= new Rectangle2F(-6, -14, 12, 13);	// TEMPORARY: this is the player collision box.
            this.topTileFlags		= TileFlags.None;
            this.allTileFlags		= TileFlags.None;
            this.isColliding		= false;
            this.autoDodgeDistance	= 6;

            this.hasLanded			= false;

            this.collisionInfo = new CollisionInfo[Directions.Count];
            for (int i = 0; i < Directions.Count; i++)
                collisionInfo[i].Clear();
        }
开发者ID:dreamsxin,项目名称:ZeldaOracle,代码行数:32,代码来源:PhysicsComponent.cs


示例18: OnBegin

        //-----------------------------------------------------------------------------
        // Overridden methods
        //-----------------------------------------------------------------------------
        public override void OnBegin(PlayerState previousState)
        {
            // TODO: player.passable = true;
            player.IsStateControlled		= true;
            player.AutoRoomTransition		= true;
            player.Movement.IsStrafing		= true;
            player.Physics.CollideWithWorld = false;
            player.Graphics.PlayAnimation(GameData.ANIM_PLAYER_JUMP);

            // The player can hold his sword while ledge jumping.
            isHoldingSword = (previousState == player.HoldSwordState);

            if (isHoldingSword) {
                isHoldingSword = true;
                player.Graphics.PlayAnimation(GameData.ANIM_PLAYER_DEFAULT);
            }
            else {
                player.Direction = direction;
            }

            // Find the landing position, calculating the move distance in pixels.
            Vector2F pos = player.Position + Directions.ToVector(direction);
            int distance = 0;
            while (!CanLandAtPosition(pos)) {
                distance += 1;
                pos += Directions.ToVector(direction);
            }

            if (!player.RoomControl.RoomBounds.Contains(pos)) {
                // Fake jumping by using the xy-velocity instead of the z-velocity.
                hasRoomChanged = false;
                velocity = new Vector2F(0.0f, -1.0f);
                player.Physics.ZVelocity = 0;
                ledgeExtendsToNextRoom = true;
            }
            else {
                // Small ledge distances have special jump speeds.
                float jumpSpeed = 1.5f;
                if (distance >= 28)
                    jumpSpeed = 2.0f;
                else if (distance >= 20)
                    jumpSpeed = 1.75f;

                // Calculate the movement speed based on jump speed, knowing
                // they should take the same amount of time to perform.
                float jumpTime = (2.0f * jumpSpeed) / GameSettings.DEFAULT_GRAVITY;
                float speed    = distance / jumpTime;//  GMath.Clamp((float) distance / jumpTime, 0.7f, 2.5f);//5.0f);

                // For larger ledges, calculate the speed so that both
                // the movement speed and the jump speed equal eachother.
                if (speed > 1.5f) {
                    speed = GMath.Sqrt(0.5f * distance * GameSettings.DEFAULT_GRAVITY);
                    jumpSpeed = speed;
                }

                velocity = Directions.ToVector(direction) * speed;
                player.Physics.ZVelocity = jumpSpeed;
                ledgeExtendsToNextRoom = false;
            }

            player.Physics.Velocity = velocity;
            player.Position += velocity;
            AudioSystem.PlaySound(GameData.SOUND_PLAYER_JUMP);
        }
开发者ID:trigger-death,项目名称:ZeldaOracle,代码行数:67,代码来源:PlayerLedgeJumpState.cs


示例19: CanLandAtPosition

 private bool CanLandAtPosition(Vector2F position)
 {
     foreach (Tile tile in player.Physics.GetTilesMeeting(position, CollisionBoxType.Hard)) {
         if (tile.IsSolid && tile.CollisionStyle == CollisionStyle.Rectangular && !(tile is TileColorBarrier) && !tile.IsBreakable) {
             return false;
         }
     }
     return true;
 }
开发者ID:trigger-death,项目名称:ZeldaOracle,代码行数:9,代码来源:PlayerLedgeJumpState.cs


示例20: IsCollidingAt

 // Returns true if the entity would be clipping if it were placed at the given position.
 private bool IsCollidingAt(Entity entity, Vector2F position, bool onlyStatic, int clipDirection = -1, float clipDistance = 0.0f)
 {
     Rectangle2F entityBox = entity.Physics.CollisionBox;
     entityBox.Point += position;
     if (entity.Physics.CollideWithRoomEdge && !((Rectangle2F) roomControl.RoomBounds).Contains(entityBox))
         return true;
     foreach (CollisionCheck check in GetCollisions(entity, entityBox)) {
         if (onlyStatic && IsSolidObjectDynamic(check.SolidObject))
             continue;
         float allowedClipAmount = GetAllowedEdgeClipAmount(entity, check.SolidObject);
         Rectangle2F insetSolidBox = check.SolidBox.Inflated(-allowedClipAmount, -allowedClipAmount);
         if (clipDirection >= 0)
             insetSolidBox.ExtendEdge(Directions.Reverse(clipDirection), allowedClipAmount - clipDistance);
         if (entityBox.Intersects(insetSolidBox))
             return true;
     }
     return false;
 }
开发者ID:trigger-death,项目名称:ZeldaOracle,代码行数:19,代码来源:RoomPhysics.cs



注:本文中的ZeldaOracle.Common.Geometry.Vector2F类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# Shared.System类代码示例发布时间:2022-05-26
下一篇:
C# Geometry.Point2I类代码示例发布时间:2022-05-26
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap