public Tile(Tile.TKind kind) { this.Kind = kind; this.Activity = false; this.Variant = 0; this.Direction = TDirection.North; }
private TDirection FindDirection(Vector2 pos) { TDirection dir = TDirection.Top; float smallestDist = Mathf.Abs(pos.y - boxCollider.bounds.max.y); float temp = Mathf.Abs(boxCollider.bounds.min.y - pos.y); if (temp < smallestDist) { dir = TDirection.Bottom; smallestDist = temp; } temp = Mathf.Abs(boxCollider.bounds.min.x - pos.x); if (temp < smallestDist) { dir = TDirection.Left; smallestDist = temp; } temp = Mathf.Abs(boxCollider.bounds.max.x - pos.x); if (temp < smallestDist) { dir = TDirection.Right; } return(dir); }
/// Rotates tile right "turns" times. "turns" can be negative. public static TDirection TDirectionRotate(TDirection direction, int turns) { if (direction == TDirection.NA) { throw new System.ArgumentException("Direction was NA", "direction"); } return((TDirection)(((int)direction + turns) % 4)); }
public void Execute(TBaseShipController shipController, TShip ship, TDirection direction) { TParameters damage = _damageController.CalculateDamage(shipController.CurrentShip, ship, direction); TShipParts oldHitPoints = ship.Current.Parameters.HitPoints; ship.Current.Parameters -= damage; ship.Storage.OnDamage(oldHitPoints, ship.Current.Parameters.HitPoints); }
public ReadOnlySpan <BasicBlock> GetSuccessors <TDirection>() where TDirection : IControlFlowDirection { AssertNoControlFlowUpdate(); TDirection direction = default; return(direction.IsForwards ? successors : predecessors); }
public bool CanPlace(SpaceshipSegment other, TDirection direction) { Tuple <TSocket, TSocket> sockets = CalculateSockets(other, direction); TSocket socket1 = sockets.Item1; TSocket socket2 = sockets.Item2; return(socket1 == socket2 || (socket2 == SpaceshipSegment.TSocket.Universal && socket1 != SpaceshipSegment.TSocket.No) || (socket1 == SpaceshipSegment.TSocket.Universal && socket2 != SpaceshipSegment.TSocket.No)); }
public bool CanConnect(SpaceshipSegment other, TDirection direction) { Tuple <TSocket, TSocket> sockets = CalculateSockets(other, direction); TSocket socket1 = sockets.Item1; TSocket socket2 = sockets.Item2; return(CanPlace(other, direction) && socket1 != SpaceshipSegment.TSocket.No && socket2 != SpaceshipSegment.TSocket.No); }
/// Adds two TDirection values. public static TDirection TDirectionAdd(TDirection d1, TDirection d2) { if (d1 == TDirection.NA) { throw new System.ArgumentException("Direction 1 was NA", "d1"); } if (d2 == TDirection.NA) { throw new System.ArgumentException("Direction 2 was NA", "d2"); } return((TDirection)(((int)d1 + (int)d2) % 4)); }
public SpaceshipSegment(TType _type, TDirection _mainDirection, TSocket _socketUp, TSocket _socketRight, TSocket _socketDown, TSocket _socketLeft, int _capacity = 0, int _current = 0, bool _isMain = false) { Type = _type; MainDirection = _mainDirection; SocketUp = _socketUp; SocketRight = _socketRight; SocketDown = _socketDown; SocketLeft = _socketLeft; Capacity = _capacity; Current = _current; IsActive = false; IsMain = _isMain; String id = Type + MainDirection.ToString("D") + SocketUp.ToString("D") + SocketRight.ToString("D") + SocketDown.ToString("D") + SocketLeft.ToString("D") + Capacity + Convert.ToInt32(IsMain); Image = (System.Drawing.Bitmap)Properties.Resources.ResourceManager.GetObject(id); }
public static Vector2u PickTileInDirection(Vector2u tile_coords, TDirection direction) { switch (direction) { case TDirection.North: return(new Vector2u(tile_coords.X, tile_coords.Y - 1)); case TDirection.East: return(new Vector2u(tile_coords.X + 1, tile_coords.Y)); case TDirection.South: return(new Vector2u(tile_coords.X, tile_coords.Y + 1)); case TDirection.West: return(new Vector2u(tile_coords.X - 1, tile_coords.Y)); default: throw new System.ArgumentException("Direction was NA", "direction"); } }
public void ChangeDirection(TDirection newDirection) { if (Direction == TDirection.Up && newDirection == TDirection.Down) { return; } if (Direction == TDirection.Down && newDirection == TDirection.Up) { return; } if (Direction == TDirection.Right && newDirection == TDirection.Left) { return; } if (Direction == TDirection.Left && newDirection == TDirection.Right) { return; } Direction = newDirection; }
public Tuple <TSocket, TSocket> CalculateSockets(SpaceshipSegment other, TDirection direction) { TSocket socket1 = this.SocketUp; TSocket socket2 = other.SocketDown; if (direction == TDirection.Right) { socket1 = this.SocketRight; socket2 = other.SocketLeft; } if (direction == TDirection.Down) { socket1 = this.SocketDown; socket2 = other.SocketUp; } if (direction == TDirection.Left) { socket1 = this.SocketLeft; socket2 = other.SocketRight; } return(new Tuple <TSocket, TSocket>(socket1, socket2)); }
public override TParameters CalculateDamage(TShip damager, TShip defenser, TDirection direction) { // TODO throw new NotImplementedException(); }
public abstract TParameters CalculateDamage(TShip damager, TShip defenser, TDirection direction);
public MovingEntity(List <Point> newPositions, TDirection newDirection) : base(newPositions) { Direction = newDirection; Wait = 2; skip = Wait; }
public MovingEntity(List <Point> newPositions, TDirection newDirection, int speed) : base(newPositions) { Direction = newDirection; Wait = speed; skip = 0; }
public MovingEntity(Point newPosition, TDirection newDirection, int wait) : base(newPosition) { Direction = newDirection; Wait = wait; skip = 0; }
public Mouse(Point newPosition, TDirection newDirection, int newSpeed) : base(newPosition, newDirection, newSpeed) { }
public Snake(List <Point> newPositions, TDirection newDirection) : base(newPositions, newDirection) { Effect = new Effect(); Lives = 3; Score = 0; }