本文整理汇总了C#中Facing类的典型用法代码示例。如果您正苦于以下问题:C# Facing类的具体用法?C# Facing怎么用?C# Facing使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
Facing类属于命名空间,在下文中一共展示了Facing类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Update
public void Update(PlayerButton input, Facing facing, Boolean paused)
{
m_inputbuffer.Add(input, facing);
if (paused == false)
{
foreach (BufferCount count in m_commandcount.Values) count.Tick();
}
foreach (Command command in Commands)
{
if (command.IsValid == false) continue;
if (CommandChecker.Check(command, m_inputbuffer) == true)
{
Int32 time = command.BufferTime;
if (paused == true) ++time;
m_commandcount[command.Name].Set(time);
}
}
m_activecommands.Clear();
foreach (var data in m_commandcount) if (data.Value.IsActive == true) m_activecommands.Add(data.Key);
}
示例2: FacingChanged
protected bool FacingChanged(Facing f)
{
if (f != pFaceDirection)
return true;
else
return false;
}
示例3: CacheMovement
public virtual void CacheMovement(Facing direction, MovementSpeed speed) {
if (this.CacheMovements) {
this.Queue.Enqueue(new Movement(direction, speed));
} else {
this.Entity.TryMove(direction, speed);
}
}
示例4: SetupRobotFixture
public static void SetupRobotFixture(this Mock<IRobot> mockRobot, int x, int y, Facing f, bool placed)
{
mockRobot.SetupProperty(r => r.X, x);
mockRobot.SetupProperty(r => r.Y, y);
mockRobot.SetupProperty(r => r.F, f);
mockRobot.SetupProperty(r => r.Placed, placed);
}
示例5: AddStructure
public AddStructure(Position position, StructureType structureType, Facing frontFace)
: this()
{
Position = position;
StructureType = structureType;
FrontFace = frontFace;
}
示例6: Sprite
public Sprite(Vector2 position, float maxSpeed, Facing facing)
{
this.position = position;
this.maxSpeed = maxSpeed;
this.facing = facing;
this.movement = Vector2.Zero;
}
示例7: Add
public void Add(PlayerButton input, Facing facing)
{
if (facing == Facing.Left)
{
if (((input & PlayerButton.Left) == PlayerButton.Left) != ((input & PlayerButton.Right) == PlayerButton.Right))
{
input ^= PlayerButton.Left;
input ^= PlayerButton.Right;
}
}
if (((input & PlayerButton.Up) == PlayerButton.Up) && ((input & PlayerButton.Down) == PlayerButton.Down))
{
input &= ~PlayerButton.Up;
input &= ~PlayerButton.Down;
}
if (((input & PlayerButton.Left) == PlayerButton.Left) && ((input & PlayerButton.Right) == PlayerButton.Right))
{
input &= ~PlayerButton.Left;
input &= ~PlayerButton.Right;
}
m_buffer.Add(input);
m_size = m_buffer.Size;
}
示例8: Update
// Update is called once per frame
void Update()
{
if (!Manager.DialogOpen)
{
if (Input.GetKey(KeyCode.D) && tr.position == position)
{
if(CanMove(Vector3.right))
position += Vector3.right * 0.32f;
direction = Facing.Right;
}
else if (Input.GetKey(KeyCode.A) && tr.position == position)
{
if (CanMove(Vector3.left))
position += Vector3.left * 0.32f;
direction = Facing.Left;
}
else if (Input.GetKey(KeyCode.W) && tr.position == position)
{
if (CanMove(Vector3.up))
position += Vector3.up * 0.32f;
direction = Facing.Up;
}
else if (Input.GetKey(KeyCode.S) && tr.position == position)
{
if (CanMove(Vector3.down))
position += Vector3.down * 0.32f;
direction = Facing.Down;
}
transform.position = Vector3.MoveTowards(transform.position, position, Time.deltaTime * moveSpeed);
}
}
示例9: FixedUpdate
// Update is called once per frame
void FixedUpdate()
{
rigidbody.AddForce(gravityBoost * down);
if (Input.touchCount > 0) {
if (Input.GetTouch(0).position.x > Screen.width/2) {
rigidbody.AddForce(jumpForceBoost * jumpRightVector);
if (facing == Facing.Left) {
transform.localScale =
new Vector3(
transform.localScale.x * -1,
transform.localScale.y,
transform.localScale.z
)
;
facing = Facing.Right;
}
} else {
rigidbody.AddForce(jumpForceBoost * jumpLeftVector);
if (facing == Facing.Right) {
transform.localScale =
new Vector3(
transform.localScale.x * -1,
transform.localScale.y,
transform.localScale.z
)
;
facing = Facing.Left;
}
}
gameObject.GetComponent<SpriteRenderer>().sprite = pig_wings_down;
} else {
gameObject.GetComponent<SpriteRenderer>().sprite = pig_wings_up;
}
if (Input.GetKeyDown(KeyCode.Escape)) {
Debug.Log("Escape key in pig behaviour");
Application.LoadLevel(0);
}
}
示例10: Animation
private TimeSpan timer; // Contador de tempo.
#endregion Fields
#region Constructors
protected Animation(Facing facing, State state)
{
timer = TimeSpan.Zero;
this.color = Color.White;
this.state = state;
this.facing = facing;
this.loopList = new List<Point>();
}
示例11: Update
public virtual void Update()
{
Facing f = CalculateFacing();
if (FacingChanged(f))
{
FaceDirection = f;
}
}
示例12: Application_Place_ValidPlacementParams_Allowed
void Application_Place_ValidPlacementParams_Allowed(string command, int xInput, int yInput, Facing fInput,
[Frozen] Mock<IRobotService> mockRobotService, Application sut)
{
sut.ProcessCommand(command);
mockRobotService.Verify(rs => rs.Place(It.Is<int>(x => x == xInput),
It.Is<int>(y => y == yInput),
It.Is<Facing>(f => f == fInput)), Times.Once());
}
示例13: ChangeWallInDirection
void ChangeWallInDirection(Facing direction, WallType newType)
{
GrabTilesFromSelection();
string prefabPath = "";
Wall newWall = null;
switch(newType) {
case WallType.Basic:
prefabPath = "Assets/Prefabs/Walls/Basic Wall.prefab";
break;
case WallType.Laser:
prefabPath = "Assets/Prefabs/Walls/Laser Wall.prefab";
break;
default:
Debug.Log("No path for replacement prefab!");
break;
}
var prefab = Resources.LoadAssetAtPath(prefabPath, typeof(Wall));
if (null == prefab) {
Debug.Log("Replacement prefab not found!");
return;
}
foreach (Tile tile in selectedTiles) {
Wall wallToChange = tile.adjacentWalls[(int)direction];
if (null == wallToChange) {
Debug.Log("Wall doesn't exist in that direction!");
continue;
}
if (wallToChange.wallType == newType) {
Debug.Log("Existing wall is already this type.");
continue;
}
newWall = (Wall)GameObject.Instantiate(prefab, wallToChange.transform.position, wallToChange.transform.rotation);
newWall.transform.parent = wallToChange.transform.parent;
newWall.facing = wallToChange.facing;
newWall.adjacentTiles = wallToChange.adjacentTiles;
newWall.Setup();
TileVisualizer.instance.SetVisualizationForWall(newWall);
foreach (Tile adjTile in wallToChange.adjacentTiles) {
if (adjTile.adjacentWalls[(int)direction] == wallToChange) {
adjTile.adjacentWalls[(int)direction] = newWall;
}
if (adjTile.adjacentWalls[(int)Utils.UTurnFacing(direction)] == wallToChange) {
adjTile.adjacentWalls[(int)Utils.UTurnFacing(direction)] = newWall;
}
}
DestroyImmediate(wallToChange.gameObject);
}
}
示例14: RobotService_Left_NotPlaced_Ignored
void RobotService_Left_NotPlaced_Ignored(Facing start, Facing expected, [Frozen]Mock<IRobot> mockRobot, RobotService sut)
{
mockRobot.SetupProperty(x => x.Placed, false);
mockRobot.SetupProperty(x => x.F, start);
sut.Left();
mockRobot.VerifySet(r => r.F = expected, Times.Never());
}
示例15: RobotService_Left_Placed_Allowed
void RobotService_Left_Placed_Allowed(Facing start, Facing expected, [Frozen]Mock<IRobot> mockRobot, RobotService sut)
{
mockRobot.SetupProperty(x => x.Placed, true);
mockRobot.SetupProperty(x => x.F, start);
sut.Left();
mockRobot.VerifySet(r => r.F = expected, Times.Once());
}