当前位置: 首页>>代码示例>>C#>>正文


C# Facing.ToVector2方法代码示例

本文整理汇总了C#中Facing.ToVector2方法的典型用法代码示例。如果您正苦于以下问题:C# Facing.ToVector2方法的具体用法?C# Facing.ToVector2怎么用?C# Facing.ToVector2使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Facing的用法示例。


在下文中一共展示了Facing.ToVector2方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: CanMove

		public bool CanMove(Facing dir, int amount) {
			int tileX = (int) this.Position.X / 16;
			int tileY = (int) this.Position.Y / 16;

			Vector2 directionalVector = dir.ToVector2();
			tileX += (int) directionalVector.X * amount;
			tileY += (int) directionalVector.Y * amount;

			//GameConsole.WriteLine("CanMove at xt: {0}, yt: {0}", tileX, tileY);

			return this.CanMove(tileX, tileY);
		}
开发者ID:Hakua,项目名称:PokeSharp,代码行数:12,代码来源:LivingEntity.cs

示例2: MoveDirection

 public IEnumerator MoveDirection(Facing direction, float dist)
 {
     return MoveDirection(direction.ToVector2(), dist);
 }
开发者ID:Bungee54,项目名称:symposium2016,代码行数:4,代码来源:NPCController.cs

示例3: ForceMove

		public virtual void ForceMove(Facing dir, MovementSpeed speed) {
			if (MovementState == MovementState.None) {
				this.Initialize();
				BeginMoving.SafeInvoke(this, EventArgs.Empty);
				if (this.Facing != dir) FacingChanged.SafeInvoke(this, new FacingChangedArgs(this.Facing, dir));
				this.Facing = dir;

				switch (dir) {
					case Facing.Up:
						if (speed == MovementSpeed.Walking)
							Animator.Play("walking-up");
						else if (speed == MovementSpeed.Running)
							Animator.Play("running-up");
						break;
					case Facing.Down:
						if (speed == MovementSpeed.Walking)
							Animator.Play("walking-down");
						else if (speed == MovementSpeed.Running)
							Animator.Play("running-down");
						break;
					case Facing.Left:
						if (speed == MovementSpeed.Walking)
							Animator.Play("walking-left");
						else if (speed == MovementSpeed.Running)
							Animator.Play("running-left");
						break;
					case Facing.Right:
						if (speed == MovementSpeed.Walking)
							Animator.Play("walking-right");
						else if (speed == MovementSpeed.Running)
							Animator.Play("running-right");
						break;
				}

				this.movement = -(dir.ToVector2() * new Vector2(16, 16));
				this.MovementSpeed = speed;
				this.MovementState = MovementState.Walking;
				this.Position -= this.movement;
			}
		}
开发者ID:Hakua,项目名称:PokeSharp,代码行数:40,代码来源:LivingEntity.cs


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