public Vector3 Move(DirectionEnum direction) { Position2d newPos = new Position2d (playerPosition.x, playerPosition.y); Position2d positionChange = new Position2d (0, 0); switch (direction) { case DirectionEnum.NORTH: positionChange.x = -1; break; case DirectionEnum.EAST: positionChange.y = 1; break; case DirectionEnum.SOUTH: positionChange.x = 1; break; case DirectionEnum.WEST: positionChange.y = -1; break; default: throw new System.ArgumentOutOfRangeException (); } do { newPos.AddLocal (positionChange); } while (posInBounds (newPos) && Landscape [newPos.x, newPos.y].Equals (GT.__I)); if (!posInBounds (newPos) || Landscape [newPos.x, newPos.y].Equals (GT.WAL)) { newPos.AddLocal (positionChange.negateLocal ()); } playerPosition = newPos; return IntToFloat (newPos); }
public void LoadContent(World world, Vector2 size, Vector2 position, ContentManager Content, string texturePath, DirectionEnum direction, float speed) { //Initialisation du body body = BodyFactory.CreateRectangle(world, size.X, size.Y, 1f); body.FixtureList[0].UserData = (int)(1000+id); body.BodyType = BodyType.Dynamic; body.Position = position; this.bodySize = size; body.FixtureList[0].IsSensor = true; //Initialisation de l'image du block Vector2 imagePosition = new Vector2(ConvertUnits.ToDisplayUnits(position.X), ConvertUnits.ToDisplayUnits(position.Y)); image = new Image(); image.LoadContent(Content, texturePath, Color.White, imagePosition); image.ScaleToMeters(size); if (direction == DirectionEnum.LEFT) { this.speedDirection = new Vector2(-1,0); } else { this.speedDirection = new Vector2(1, 0); } this.direction = direction; this.speed = speed; }
/// <summary> /// Export the GPIO setting the direction. This creates the /sys/class/gpio/gpioXX directory. /// </summary> /// <param name="pin">The GPIO pin</param> /// <param name="direction"></param> private static void ExportPin(GPIOPins pin, DirectionEnum direction) { // If the pin is already exported, check it's in the proper direction if (_exportedPins.Keys.Contains((int)pin)) // If the direction matches, return out of the function. If not, change the direction if (_exportedPins[(int)pin] == direction) return; else { // Set the direction on the pin and update the exported list File.WriteAllText(GPIO_PATH + "gpio" + GetGPIONumber(pin) + "/direction", direction.ToString().ToLower()); _exportedPins[(int)pin] = direction; return; } if (!Directory.Exists(GPIO_PATH + "gpio" + GetGPIONumber(pin))) { Debug.WriteLine("Exporting " + GetGPIONumber(pin)); //export File.WriteAllText(GPIO_PATH + "export", GetGPIONumber(pin)); } // set i/o direction Debug.WriteLine("Setting direction on pin " + pin + "/gpio " + (int)pin + " as " + direction); File.WriteAllText(GPIO_PATH + "gpio" + GetGPIONumber(pin) + "/direction", direction.ToString().ToLower()); // Update the list of exported pins _exportedPins[(int)pin] = direction; }
public List<Tweet> GetTweetsByQuery(string searchQuery, ulong? maxId, DirectionEnum? direction) { var query = (from search in twitterContext.Search where search.Type == SearchType.Search && search.Query == searchQuery && search.Count == tweetCount select search); if (maxId.HasValue) { query = direction == DirectionEnum.Next ? (from q in query where q.MaxID == maxId - 1 select q) : (from q in query where q.MaxID == maxId select q); } var tweets = query.SingleOrDefault(); var resultTweets = new List<Tweet>(); if (tweets != null && tweets.Statuses != null) { resultTweets = tweets.Statuses.Select(tweet => new Tweet() { UserName = tweet.User.ScreenNameResponse, TweetText = tweet.Text, TweetDate = tweet.CreatedAt.Date, StatusId = tweet.StatusID }).ToList(); } GetTrimmedLengthTweet(ref resultTweets); return resultTweets; }
/* direction is the direction the party wants to go */ public void getDirection( DirectionEnum direction ) { /* start getDirection */ //Method here. Update Location */ if( direction == DirectionEnum.LEFT ) /*...*/ if( direction == DirectionEnum.RIGHT ) /*...*/ if( direction == DirectionEnum.DOWN ) /*...*/ if( direction == DirectionEnum.UP ) /*...*/ mGame.notifyDungeonUpdate(); if( checkIfDragon() ) mGame.StartBattle(EnemyType.DRAGON); else if( RollBattleDice() ) mGame.StartBattle( EnemyType.NULL ); }
public bool MkdirFlag; //boolean value to indicate if the specified folder is to be created locally/remotely //public ftpinfo ftpstats=null; //applicable only for remote files //public FileInfo filestats=null; //applicable only for local files //to upload public Fileinfo(string fileName, string destination, DirectionEnum direction, bool mkdirFlag) { CompleteFileName = fileName; Destination = destination; Direction = direction; MkdirFlag = mkdirFlag; }
public Snake(Scene scene, Point position) { _direction = (DirectionEnum)(new Random()).Next(4); _dead = false; _bodyBlock = new List<Point>(); _bodyBlock.Add(position); _scene = scene; }
public void Reset() { _isHeroCaughtAnimation = 10; HasCaught = false; int x = 15; if (Number == DevilNumberEnum.Second) x = 30; base.Reset(x, 0); _verticalDirection = DirectionEnum.None; _horizontalDirection = DirectionEnum.None; }
public Bill(string billno, DirectionEnum direction, List<SkuInfo> listsku) { skus = new List<SkuInfo>(); BillNumber = billno; Direction = direction; if (listsku.Count > 0) { skus.AddRange(listsku); } }
public Core() { _roverX = 0; _roverY = 0; _roverDirection = DirectionEnum.N; _obstacles = new bool[_maxX, _maxY]; _obstacles[2, 1] = true; _obstaclePosition = string.Empty; }
private static void Move(DirectionEnum directionEnum) { if (GameManager.GameStatue == GameStatusEnum.Normal) { _gameManager.TryMove(directionEnum); } else if (GameManager.GameStatue == GameStatusEnum.Failed) { GameOver(); _gameManager.ReStart(); } }
//void Rerotate() //{ // field_screenOrientaion = Screen.orientation; //} public void SetDirection(DirectionEnum param_direction) { field_direction = param_direction; if (field_direction == DirectionEnum.HORIZONTAL) { SetHorizontal(); } else { SetVertical(); } }
public OrbPosition(RingEnum ring, DirectionEnum direction) { if (ring == RingEnum.ORIGIN) { Ring = RingEnum.ORIGIN; Direction = DirectionEnum.MIDDLE; } else { Ring = ring; Direction = direction; } }
public BodyPart(int _Id, Vector3 _Position, Color _Color, String _TexturePath) { this.position = _Position; this.color = _Color; this.texturePath = _TexturePath; this.direction = DirectionEnum.Down; this.animation = new Animation.Animations.StandAnimation(this); this.scale = 1.0f; this.size = new Vector3(32, 32, 0); this.equipment = null; this.id = _Id; this.acceptedItemTypes = new List<ItemEnum>(); }
public AnimatedObject(SerializationInfo info, StreamingContext ctxt) : base(info, ctxt) { this.scale = (float)info.GetValue("scale", typeof(float)); this.movementSpeed = (float)info.GetValue("movementSpeed", typeof(float)); this.directionEnum = (DirectionEnum)info.GetValue("directionEnum", typeof(DirectionEnum)); this.body = (Body.Body)info.GetValue("body", typeof(Body.Body)); this.moveUp = (bool)info.GetValue("moveUp", typeof(bool)); this.moveLeft = (bool)info.GetValue("moveLeft", typeof(bool)); this.moveRight = (bool)info.GetValue("moveRight", typeof(bool)); this.moveDown = (bool)info.GetValue("moveDown", typeof(bool)); }
public Vector2 NewDirection(Vector2 currentDirection, Vector2 position, GameTime gameTime) { Array values = Enum.GetValues(typeof(DirectionEnum)); Random randomDirect = new Random(); Vector2 newDirection = new Vector2(); if (timeInterval == 0) { timeInterval = ChaneTime(gameTime); } for (int i = 0; i < 50; i++) { //position += currentDirection; this.NextPosition = position + currentDirection; if (this.NextPosition.X < 1 || this.NextPosition.Y < 1 || this.NextPosition.X > JustCoyote.GridWidth - 1 || this.NextPosition.Y > JustCoyote.GridHeight - 1 || timeInterval <= gameTime.TotalGameTime.TotalMilliseconds || Wall.Segments[(int)this.NextPosition.X, (int)this.NextPosition.Y].Filled) { this.changeDirection = (DirectionEnum)values.GetValue(randomDirect.Next(values.Length)); switch (changeDirection) { case DirectionEnum.Up: newDirection = Direction.Up; break; case DirectionEnum.Left: newDirection = Direction.Left; break; case DirectionEnum.Down: newDirection = Direction.Down; break; case DirectionEnum.Right: newDirection = Direction.Right; break; } // position -= currentDirection; currentDirection = newDirection; if (timeInterval <= gameTime.TotalGameTime.TotalMilliseconds) { timeInterval = ChaneTime(gameTime); } } else { break; } } return currentDirection; }
public static Point PointByDirection(DirectionEnum dirEnum, Point start) { switch (dirEnum) { case DirectionEnum.Left: return new Point(start.X - 1, start.Y); case DirectionEnum.Right: return new Point(start.X + 1, start.Y); case DirectionEnum.Up: return new Point(start.X, start.Y - 1); case DirectionEnum.Down: return new Point(start.X, start.Y + 1); default: throw new ArgumentOutOfRangeException(nameof(dirEnum), dirEnum, null); } }
/* ------------------------------ Direction - Functions ------------------------------------- */ public static int GetAngleFromDirection(DirectionEnum dir) { switch (dir) { case DirectionEnum.NORTH: return 0; case DirectionEnum.WEST: return 90; case DirectionEnum.SOUTH: return 180; case DirectionEnum.EAST: return 270; default: return -1; } }
public ModulatorType(BinaryReader reader) { ushort raw = reader.ReadUInt16(); if ((raw & 0x0200) == 0x0200) polarity = PolarityEnum.Bipolar; else polarity = PolarityEnum.Unipolar; if ((raw & 0x0100) == 0x0100) direction = DirectionEnum.MaxToMin; else direction = DirectionEnum.MinToMax; midiContinuousController = ((raw & 0x0080) == 0x0080); sourceType = (SourceTypeEnum)((raw & (0xFC00)) >> 10); controllerSource = (ushort)(raw & 0x007F); }
/// <summary> /// Export the GPIO setting the direction. This creates the /sys/class/gpio/gpioXX directory. /// </summary> /// <param name="pin">The GPIO pin</param> /// <param name="direction"></param> private static void ExportPin(GPIOPins pin, DirectionEnum direction) { Initialize(); // If the pin is already exported, check it's in the proper direction if (_exportedPins.Keys.Contains((int)pin)) // If the direction matches, return out of the function. If not, change the direction if (_exportedPins[(int)pin] == direction) return; else { // Set the direction on the pin and update the exported list bcm2835_gpio_fsel((uint)pin, direction == DirectionEnum.IN ? (uint)0 : (uint)1); _exportedPins[(int)pin] = direction; return; } }
public Enemy() : base() { id = NextID; NextID++; Health = 50; direction = DirectionEnum.LEFT; shouldMove = true; sensors = new Fixture[4]; sensorsContacts = new int[4]; sensorsContacts[0] = 0; sensorsContacts[1] = 0; sensorsContacts[2] = 0; sensorsContacts[3] = 0; contactsWithFloor = 1; }
/// <summary> /// this gets called automatically when we try and output to, or input from, a pin /// </summary> /// <param name="pin"></param> /// <param name="direction"></param> private void SetupPin(PinEnum pin, DirectionEnum direction) { //unexport if it we're using it already if (_outExported.Contains(pin) || _inExported.Contains(pin)) UnexportPin(pin); //export File.WriteAllText(GPIO_PATH + "export", GetPinNumber(pin)); Debug.WriteLine("exporting pin " + pin + " as " + direction); // set i/o direction File.WriteAllText(GPIO_PATH + pin + "/direction", direction.ToString().ToLower()); //record the fact that we've setup that pin if (direction == DirectionEnum.OUT) _outExported.Add(pin); else _inExported.Add(pin); }
/// <summary> /// Export the GPIO setting the direction. This creates the /sys/class/gpio/gpioXX directory. /// </summary> /// <param name="pin">The GPIO pin</param> /// <param name="direction"></param> private static void ExportPin(GPIOPins pin, DirectionEnum direction) { Initialize(); // If the pin is already exported, check it's in the proper direction if (_exportedPins.Keys.Contains((int)pin)) // If the direction matches, return out of the function. If not, change the direction if (_exportedPins[(int)pin] == direction) return; // Set the direction on the pin and update the exported list // BCM2835_GPIO_FSEL_INPT = 0 // BCM2835_GPIO_FSEL_OUTP = 1 bcm2835_gpio_fsel((uint)pin, direction == DirectionEnum.IN ? (uint)0 : (uint)1); if (direction == DirectionEnum.IN) // BCM2835_GPIO_PUD_OFF = 0b00 = 0 // BCM2835_GPIO_PUD_DOWN = 0b01 = 1 // BCM2835_GPIO_PUD_UP = 0b10 = 2 bcm2835_gpio_set_pud((uint)pin, 0); _exportedPins[(int)pin] = direction; }
public void TryMove(DirectionEnum directionEnum) { if (_matrixHelper.Move(directionEnum)) { if (IsWin()) { GameStatue = GameStatusEnum.Win; } else { _matrixHelper.AddNewTile(); } } else { if (IsFailed()) { GameStatue = GameStatusEnum.Failed; } } }
public void Move() { if (_direction != DirectionEnum.None) { int delta = 1; if (_direction == DirectionEnum.Left) delta = -1; if (!Maps.IsWall(_room[_x + delta, _y])) { _x = _x + delta; } else { if (Maps.IsBrickWall(_room[_x + delta, _y])) { _room[_x + delta, _y] = SpriteTypeEnum.WallLive1; } _direction = DirectionEnum.None; } } }
public override void Update(GameTime gameTime) { _horizontalDirection = DirectionEnum.None; _verticalDirection = DirectionEnum.None; if (!HasCaught) { if (X > _hero.X) _horizontalDirection = DirectionEnum.Left; else if (X < _hero.X) _horizontalDirection = DirectionEnum.Right; if (Y > _hero.Y) _verticalDirection = DirectionEnum.Up; else if (Y < _hero.Y) _verticalDirection = DirectionEnum.Down; if (Maps.IsBiomass(Room[X, Y]) && Maps.IsBiomass(Room[X + 1, Y])) Reset(); } base.Update(gameTime); }
public static void AddStats(DirectionEnum direction) { switch (direction) { case DirectionEnum.Up: Up++; break; case DirectionEnum.Right: Right++; break; case DirectionEnum.Down: Down++; break; case DirectionEnum.Left: Left++; break; case DirectionEnum.Stay: break; default: throw new Exception(); } }
private void SetObjective(string controllerAffix, DirectionEnum dir) { var objective = ObjectiveUiMap[dir]; bool newPlayer, newObjective; TeamPlayer player = Globals.Instance.ManageTeam.ObjectiveUpdated(controllerAffix, objective, out newPlayer, out newObjective); // enable player icon if (newPlayer) { counterOn = Globals.Instance.ManageTeam.AllPlayers.Count > 1; enablePlayer(player.PlayerNumber); } // update objective if (newPlayer || newObjective) { GetComponent<AudioSource>().Stop(); GetComponent<AudioSource>().pitch = (float)player.PlayerNumber / 2f; GetComponent<AudioSource>().Play(); } //Debug.Log("added new " + controllerAffix + " player to team " + Globals.Instance.ManageTeam.GetTeamNumber(player.PlayerNumber)); }
public LavaSpellEffect(Vector3Int origTile, DirectionEnum _direction, int lifespan, int originCount) : this(origTile, (Vector2Int)DirectionVectors.Defaults[_direction], lifespan, originCount) { }
/// <summary> /// Access to the specified GPIO setup with the specified direction with an initial value of false (0) /// </summary> /// <param name="pin">The GPIO pin</param> /// <param name="direction">Direction</param> public GPIODebug(GPIOPins pin, DirectionEnum direction) : base(pin, direction, false) { }
/// <summary> /// Access to the specified GPIO setup with the specified direction with the specified initial value /// </summary> /// <param name="pin">The GPIO pin</param> /// <param name="direction">Direction</param> /// <param name="initialValue">Initial Value</param> public GPIODebug(GPIOPins pin, DirectionEnum direction, bool initialValue) : base(pin, direction, initialValue) { Write(pin, initialValue); }
public SwipeActionToScreen(string screenId, string toScreenIdShort, DirectionEnum direction) : base(screenId, direction) { ToScreenIdShort = toScreenIdShort; }
public MovingObject(DirectionEnum dir, Transform trans) { direction = dir; transform = trans; hitPoints = 25; }
// Update is called once per frame void FixedUpdate() { if (preyHit) { if (lastdirection == DirectionEnum.east) { currentDirection = leftV; chosenDirection = new Vector2(-1, 0); nextdirection = DirectionEnum.west; lastdirection = DirectionEnum.west; right = false; } if (lastdirection == DirectionEnum.west) { currentDirection = rightV; chosenDirection = new Vector2(1, 0); nextdirection = DirectionEnum.east; lastdirection = DirectionEnum.east; left = false; } if (lastdirection == DirectionEnum.north) { currentDirection = downV; chosenDirection = new Vector2(0, -1); nextdirection = DirectionEnum.south; lastdirection = DirectionEnum.south; up = false; } if (lastdirection == DirectionEnum.south) { currentDirection = upV; chosenDirection = new Vector2(0, 1); nextdirection = DirectionEnum.north; lastdirection = DirectionEnum.north; down = false; } } //currentDirection = chosenDirection; rb2d.velocity = currentDirection * speed; if (Input.GetKey(KeyCode.L) && lastdirection != DirectionEnum.west) { chosenDirection = new Vector2(1, 0); nextdirection = DirectionEnum.east; } if (Input.GetKey(KeyCode.Quote) && lastdirection != DirectionEnum.east) { chosenDirection = new Vector2(-1, 0); nextdirection = DirectionEnum.west; } if (Input.GetKey(KeyCode.P) && lastdirection != DirectionEnum.south) { chosenDirection = new Vector2(0, 1); nextdirection = DirectionEnum.north; } if (Input.GetKey(KeyCode.BackQuote) && lastdirection != DirectionEnum.north) { chosenDirection = new Vector2(0, -1); nextdirection = DirectionEnum.south; } if (Input.GetKey(KeyCode.Semicolon)) { deospray = false; } if (crossroad) { if (nextdirection.Equals(DirectionEnum.east) && right) { currentDirection = rightV; lastdirection = DirectionEnum.east; left = false; } else if (nextdirection.Equals(DirectionEnum.west) && left) { currentDirection = leftV; lastdirection = DirectionEnum.west; right = false; } else if (nextdirection.Equals(DirectionEnum.north) && up) { currentDirection = upV; lastdirection = DirectionEnum.north; down = false; } else if (nextdirection.Equals(DirectionEnum.south) && down) { currentDirection = downV; lastdirection = DirectionEnum.south; up = false; } else if ((!right && up && down && nextdirection == DirectionEnum.east) || (!left && up && down && nextdirection == DirectionEnum.west)) { int dir = Random.Range(1, 3); if (dir == 1) { currentDirection = upV; chosenDirection = new Vector2(0, 1); nextdirection = DirectionEnum.north; lastdirection = DirectionEnum.north; down = false; } if (dir == 2) { currentDirection = downV; chosenDirection = new Vector2(0, -1); nextdirection = DirectionEnum.south; lastdirection = DirectionEnum.south; up = false; } } else if ((!up && left && right && nextdirection == DirectionEnum.north) || (!down && left && right && nextdirection == DirectionEnum.south)) { int dir = Random.Range(1, 3); if (dir == 1) { currentDirection = leftV; chosenDirection = new Vector2(-1, 0); nextdirection = DirectionEnum.west; lastdirection = DirectionEnum.west; right = false; } if (dir == 2) { currentDirection = rightV; chosenDirection = new Vector2(1, 0); nextdirection = DirectionEnum.east; lastdirection = DirectionEnum.east; left = false; } } // force north else if ((!down && !left && !right && lastdirection == DirectionEnum.west) || (!down && !left && !right && lastdirection == DirectionEnum.east)) { currentDirection = upV; chosenDirection = new Vector2(0, 1); nextdirection = DirectionEnum.north; lastdirection = DirectionEnum.north; down = false; } // force east else if ((!down && !up && right && !left && lastdirection == DirectionEnum.south) || (!up && !down && !left && right && lastdirection == DirectionEnum.north)) { currentDirection = rightV; chosenDirection = new Vector2(1, 0); nextdirection = DirectionEnum.east; lastdirection = DirectionEnum.east; left = false; } // force west else if ((!right && !down && !up && lastdirection == DirectionEnum.south) || (!right && !down && !up && lastdirection == DirectionEnum.north)) { currentDirection = leftV; chosenDirection = new Vector2(-1, 0); nextdirection = DirectionEnum.west; lastdirection = DirectionEnum.west; right = false; } // force south else if ((!up && !left && !right && lastdirection == DirectionEnum.west) || (!up && !left && !right && lastdirection == DirectionEnum.east)) { currentDirection = downV; chosenDirection = new Vector2(0, -1); nextdirection = DirectionEnum.south; lastdirection = DirectionEnum.south; up = false; } if (lastdirection != DirectionEnum.idle) { crossroad = false; } } }
public void SetDirection(DirectionEnum direction, object obj) { _directions[direction] = obj; }
public static bool Move(DirectionEnum directionEnum) { return(MoveUp(_directionDic[directionEnum])); }
/// <summary> /// Export the GPIO setting the direction. This creates the /sys/class/gpio/gpioXX directory. /// </summary> /// <param name="pin">The GPIO pin</param> /// <param name="direction"></param> private static void ExportPin(GPIOPins pin, DirectionEnum direction) { }
public int NumeralVariant; //(Integer) The variant of the digit format to use. /// <summary> /// Constructor using all defaults for the style. /// </summary> public StyleInfo() { BColorLeft = BColorRight = BColorTop = BColorBottom = System.Drawing.Color.Black; // (Color) Color of the bottom border BStyleLeft = BStyleRight = BStyleTop = BStyleBottom = BorderStyleEnum.None; // _BorderWdith BWidthLeft = BWidthRight = BWidthTop = BWidthBottom = 1; BackgroundColor = System.Drawing.Color.Empty; BackgroundColorText = string.Empty; BackgroundGradientType = BackgroundGradientTypeEnum.None; BackgroundGradientEndColor = System.Drawing.Color.Empty; BackgroundImage = null; FontStyle = FontStyleEnum.Normal; _FontFamily = "Arial"; //WRP 291008 numFmtId should be 0 (Zero) for General format - will be interpreted as a string //It has default values in Excel07 as per ECMA-376 standard (SEction 3.8.30) for Office Open XML Excel07 _Format = "General"; FontSize = 10; FontWeight = FontWeightEnum.Normal; PatternType = patternTypeEnum.None; TextDecoration = TextDecorationEnum.None; TextAlign = TextAlignEnum.General; VerticalAlign = VerticalAlignEnum.Top; Color = System.Drawing.Color.Black; ColorText = "Black"; PaddingLeft = PaddingRight = PaddingTop = PaddingBottom = 0; LineHeight = 0; Direction = DirectionEnum.LTR; WritingMode = WritingModeEnum.lr_tb; Language = "en-US"; UnicodeBiDirectional = UnicodeBiDirectionalEnum.Normal; Calendar = CalendarEnum.Gregorian; NumeralLanguage = Language; NumeralVariant=1; }
public void Move(Vector2 tiltValue) { if (tiltValue.x > 0) { facingDirection = DirectionEnum.Right; } else if (tiltValue.x < 0) { facingDirection = DirectionEnum.Left; } if (isGrounded) { Vector2 parentVelocity = Vector2.zero; if (isAttachedToMovingPlatform) { parentVelocity = attachedRgbd.velocity; } float localMaxMov = maxMovementSpeed + parentVelocity.x; float localMinMov = -maxMovementSpeed + parentVelocity.x; if (tiltValue.x == 0) { // Do nothing, let x decay to 0 speed. } // If moving in same direction else if (tiltValue.x * rgbd.velocity.x > 0) { if (localMinMov <= rgbd.velocity.x && rgbd.velocity.x <= localMaxMov) { rgbd.AddForce(new Vector2(accelerationForce * tiltValue.x, 0)); } } else { rgbd.AddForce(new Vector2(accelerationForce * tiltValue.x, 0)); } } else { float multResult = tiltValue.x * rgbd.velocity.x; // No x input, decay to 0 speed. if (tiltValue.x == 0) { float prevX = rgbd.velocity.x; if (rgbd.velocity.x > 0) { rgbd.velocity = new Vector2(Mathf.Clamp(rgbd.velocity.x - airDeceleration, 0, prevX), rgbd.velocity.y); } else if (rgbd.velocity.x < 0) { rgbd.velocity = new Vector2(Mathf.Clamp(rgbd.velocity.x + airDeceleration, prevX, 0), rgbd.velocity.y); } } // Same direction else if (multResult >= 0) { if (Math.Abs(rgbd.velocity.x) < maxAirControlSpeed) { rgbd.AddForce(new Vector2(Direction.ConsiderDirection(facingDirection, airAcceleration) * Math.Abs(tiltValue.x), 0)); if (rgbd.velocity.x > maxAirControlSpeed) { rgbd.velocity = new Vector2(maxAirControlSpeed, rgbd.velocity.y); } } } // Reverse direction else if (multResult < 0) { rgbd.AddForce(new Vector2(Direction.ConsiderDirection(facingDirection, airAcceleration) * Math.Abs(tiltValue.x), 0)); } } }
private bool IsTargetReached(int row, int column, int currentNumber, DirectionEnum direction) { var nextBoardElement = GetNextBoardElement(row, column, direction); return(nextBoardElement.ContainsTarget && TargetHelper.CanGetTargetElement(currentNumber)); }
private bool IsNextPositionBusy(int row, int column, DirectionEnum direction) { var nextBoardElement = GetNextBoardElement(row, column, direction); return(nextBoardElement.ContainsTarget || nextBoardElement.ContainsSnakeStep); }
public object GetDirection(DirectionEnum direction) { return(_directions[direction]); }
internal MovieNode(RELATIONSHIP relationship, DirectionEnum direction, string neo4jLabel = null, Entity entity = null) : base(relationship, direction, neo4jLabel, entity) { }
private void GhostMove() { if (!this.IsMoving) { return; } switch (this.ident) { case GhostIdent.Red: this.aimPoint = Items.Pacman.mode == GhostMode.Scatter ? new Vector2(400f, 0.0f) : Items.Pacman.Position; break; case GhostIdent.Pink: if (Items.Pacman.mode == GhostMode.Chase) { switch (Items.Pacman.Direction) { case 0: this.aimPoint = new Vector2(Items.Pacman.Position.X + 64f, Items.Pacman.Position.Y); break; case 90: this.aimPoint = new Vector2(Items.Pacman.Position.X, Items.Pacman.Position.Y + 64f); break; case 180: this.aimPoint = new Vector2(Items.Pacman.Position.X - 64f, Items.Pacman.Position.Y); break; case 270: this.aimPoint = new Vector2(Items.Pacman.Position.X, Items.Pacman.Position.Y - 64f); break; } } else { this.aimPoint = new Vector2(0.0f, 48f); break; } break; case GhostIdent.Blue: this.aimPoint = Items.Pacman.mode != GhostMode.Chase ? new Vector2(448f, 576f) : new Vector2(2f * Items.Pacman.Position.X - Items.Red.Position.X, 2f * Items.Pacman.Position.Y - Items.Red.Position.Y); break; case GhostIdent.Orange: this.aimPoint = Items.Pacman.mode != GhostMode.Chase ? new Vector2(0.0f, 576f) : ((double)Vector2.Distance(this.Position, Items.Pacman.Position) <= 128.0 ? new Vector2(0.0f, 576f) : Items.Pacman.Position); break; } Vector2 vector2_1 = new Vector2(this.Position.X - 16f, this.Position.Y); Vector2 vector2_2 = new Vector2(this.Position.X + 16f, this.Position.Y); Vector2 vector2_3 = new Vector2(this.Position.X, this.Position.Y - 16f); Vector2 vector2_4 = new Vector2(this.Position.X, this.Position.Y + 16f); this.maploc = Serve.WorldToMap(new Vector2(this.Position.X, this.Position.Y)); if (this.direction == DirectionEnum.Right) { if (!PacmanGame.Map.IsOpenLocation(this.maploc.X, this.maploc.Y - 1) & !PacmanGame.Map.IsOpenLocation(this.maploc.X, this.maploc.Y + 1)) { this.direction = DirectionEnum.Right; this.Position.X += this.Speed; this.Position.Y = this.SnapToY(this.Position); return; } if (!PacmanGame.Map.IsOpenLocation(this.maploc.X + 1, this.maploc.Y) && !PacmanGame.Map.IsOpenLocation(this.maploc.X, this.maploc.Y + 1)) { this.direction = DirectionEnum.Up; this.Position.Y -= 9f; this.Position.X = this.SnapToX(this.Position); return; } if (!PacmanGame.Map.IsOpenLocation(this.maploc.X + 1, this.maploc.Y) && !PacmanGame.Map.IsOpenLocation(this.maploc.X, this.maploc.Y - 1)) { this.direction = DirectionEnum.Down; this.Position.Y += 9f; this.Position.X = this.SnapToX(this.Position); return; } if (PacmanGame.Map.IsOpenLocation(this.maploc.X, this.maploc.Y + 1) & PacmanGame.Map.IsOpenLocation(this.maploc.X, this.maploc.Y - 1)) { if (PacmanGame.Map.IsOpenLocation(this.maploc.X + 1, this.maploc.Y)) { if (Items.Pacman.mode == GhostMode.Frightened) { switch (new Random().Next(1, 3)) { case 1: this.Position.Y -= 9f; this.Position.X = this.SnapToX(this.Position); this.direction = DirectionEnum.Up; return; case 2: this.Position.Y += 9f; this.Position.X = this.SnapToX(this.Position); this.direction = DirectionEnum.Down; return; case 3: this.Position.X += 9f; this.Position.Y = this.SnapToY(this.Position); this.direction = DirectionEnum.Right; return; default: return; } } else { if ((double)Vector2.Distance(vector2_3, this.aimPoint) <= (double)Vector2.Distance(vector2_4, this.aimPoint) && (double)Vector2.Distance(vector2_3, this.aimPoint) <= (double)Vector2.Distance(vector2_2, this.aimPoint)) { this.Position.Y -= 9f; this.Position.X = this.SnapToX(this.Position); this.direction = DirectionEnum.Up; return; } if ((double)Vector2.Distance(vector2_4, this.aimPoint) <= (double)Vector2.Distance(vector2_3, this.aimPoint) && (double)Vector2.Distance(vector2_4, this.aimPoint) <= (double)Vector2.Distance(vector2_2, this.aimPoint)) { this.Position.Y += 9f; this.Position.X = this.SnapToX(this.Position); this.direction = DirectionEnum.Down; return; } this.Position.X += 9f; this.Position.Y = this.SnapToY(this.Position); this.direction = DirectionEnum.Right; return; } } else if (Items.Pacman.mode == GhostMode.Frightened) { switch (new Random().Next(1, 2)) { case 1: this.Position.Y -= 9f; this.Position.X = this.SnapToX(this.Position); this.direction = DirectionEnum.Up; return; case 2: this.Position.Y += 9f; this.Position.X = this.SnapToX(this.Position); this.direction = DirectionEnum.Down; return; default: return; } } else { if ((double)Vector2.Distance(vector2_3, this.aimPoint) <= (double)Vector2.Distance(vector2_4, this.aimPoint)) { this.Position.Y -= 9f; this.direction = DirectionEnum.Up; this.Position.X = this.SnapToX(this.Position); return; } this.Position.Y += 9f; this.direction = DirectionEnum.Down; this.Position.X = this.SnapToX(this.Position); return; } } else if (PacmanGame.Map.IsOpenLocation(this.maploc.X + 1, this.maploc.Y) & PacmanGame.Map.IsOpenLocation(this.maploc.X, this.maploc.Y - 1)) { if (Items.Pacman.mode == GhostMode.Frightened) { switch (new Random().Next(1, 2)) { case 1: this.Position.Y -= 9f; this.Position.X = this.SnapToX(this.Position); this.direction = DirectionEnum.Up; return; case 2: this.Position.X += 9f; this.Position.Y = this.SnapToY(this.Position); this.direction = DirectionEnum.Right; return; default: return; } } else { if ((double)Vector2.Distance(vector2_3, this.aimPoint) <= (double)Vector2.Distance(vector2_2, this.aimPoint)) { this.Position.Y -= 9f; this.direction = DirectionEnum.Up; this.Position.X = this.SnapToX(this.Position); return; } this.Position.X += 9f; this.direction = DirectionEnum.Right; this.Position.Y = this.SnapToY(this.Position); return; } } else if (PacmanGame.Map.IsOpenLocation(this.maploc.X + 1, this.maploc.Y) & PacmanGame.Map.IsOpenLocation(this.maploc.X, this.maploc.Y + 1)) { if (Items.Pacman.mode == GhostMode.Frightened) { switch (new Random().Next(1, 2)) { case 1: this.Position.Y += 9f; this.Position.X = this.SnapToX(this.Position); this.direction = DirectionEnum.Up; return; case 2: this.Position.X += 9f; this.Position.Y = this.SnapToY(this.Position); this.direction = DirectionEnum.Right; return; default: return; } } else { if ((double)Vector2.Distance(vector2_4, this.aimPoint) <= (double)Vector2.Distance(vector2_2, this.aimPoint)) { this.Position.Y += 9f; this.direction = DirectionEnum.Down; this.Position.X = this.SnapToX(this.Position); return; } this.Position.X += 9f; this.direction = DirectionEnum.Right; this.Position.Y = this.SnapToY(this.Position); return; } } } if (this.direction == DirectionEnum.Left) { if (!PacmanGame.Map.IsOpenLocation(this.maploc.X, this.maploc.Y - 1) & !PacmanGame.Map.IsOpenLocation(this.maploc.X, this.maploc.Y + 1)) { this.Position.X -= this.Speed; this.Position.Y = this.SnapToY(this.Position); this.direction = DirectionEnum.Left; return; } if (!PacmanGame.Map.IsOpenLocation(this.maploc.X - 1, this.maploc.Y) & !PacmanGame.Map.IsOpenLocation(this.maploc.X, this.maploc.Y + 1)) { this.Position.Y -= 9f; this.Position.X = this.SnapToX(this.Position); this.direction = DirectionEnum.Up; return; } if (!PacmanGame.Map.IsOpenLocation(this.maploc.X - 1, this.maploc.Y) && !PacmanGame.Map.IsOpenLocation(this.maploc.X, this.maploc.Y - 1)) { this.Position.Y += 9f; this.Position.X = this.SnapToX(this.Position); this.direction = DirectionEnum.Down; return; } if (PacmanGame.Map.IsOpenLocation(this.maploc.X, this.maploc.Y + 1) & PacmanGame.Map.IsOpenLocation(this.maploc.X, this.maploc.Y - 1)) { if (PacmanGame.Map.IsOpenLocation(this.maploc.X - 1, this.maploc.Y)) { if (Items.Pacman.mode == GhostMode.Frightened) { switch (new Random().Next(1, 3)) { case 1: this.Position.Y -= 9f; this.Position.X = this.SnapToX(this.Position); this.direction = DirectionEnum.Up; return; case 2: this.Position.X -= 9f; this.Position.Y = this.SnapToY(this.Position); this.direction = DirectionEnum.Left; return; case 3: this.Position.Y += 9f; this.Position.X = this.SnapToX(this.Position); this.direction = DirectionEnum.Down; return; default: return; } } else { if ((double)Vector2.Distance(vector2_3, this.aimPoint) <= (double)Vector2.Distance(vector2_4, this.aimPoint) && (double)Vector2.Distance(vector2_3, this.aimPoint) <= (double)Vector2.Distance(vector2_1, this.aimPoint)) { this.Position.Y -= 9f; this.Position.X = this.SnapToX(this.Position); this.direction = DirectionEnum.Up; return; } if ((double)Vector2.Distance(vector2_1, this.aimPoint) <= (double)Vector2.Distance(vector2_3, this.aimPoint) && (double)Vector2.Distance(vector2_1, this.aimPoint) <= (double)Vector2.Distance(vector2_4, this.aimPoint)) { this.Position.X -= 9f; this.Position.Y = this.SnapToY(this.Position); this.direction = DirectionEnum.Left; return; } this.Position.Y += 9f; this.Position.X = this.SnapToX(this.Position); this.direction = DirectionEnum.Down; return; } } else if (Items.Pacman.mode == GhostMode.Frightened) { switch (new Random().Next(1, 2)) { case 1: this.Position.Y -= 9f; this.Position.X = this.SnapToX(this.Position); this.direction = DirectionEnum.Up; return; case 2: this.Position.Y += 9f; this.Position.X = this.SnapToX(this.Position); this.direction = DirectionEnum.Down; return; default: return; } } else { if ((double)Vector2.Distance(vector2_3, this.aimPoint) <= (double)Vector2.Distance(vector2_4, this.aimPoint)) { this.Position.Y -= 9f; this.Position.X = this.SnapToX(this.Position); this.direction = DirectionEnum.Up; return; } this.Position.Y += 9f; this.Position.X = this.SnapToX(this.Position); this.direction = DirectionEnum.Down; return; } } else if (PacmanGame.Map.IsOpenLocation(this.maploc.X - 1, this.maploc.Y) & PacmanGame.Map.IsOpenLocation(this.maploc.X, this.maploc.Y - 1)) { if (Items.Pacman.mode == GhostMode.Frightened) { switch (new Random().Next(1, 2)) { case 1: this.Position.Y -= 9f; this.Position.X = this.SnapToX(this.Position); this.direction = DirectionEnum.Up; return; case 2: this.Position.X -= 9f; this.Position.Y = this.SnapToY(this.Position); this.direction = DirectionEnum.Left; return; default: return; } } else { if ((double)Vector2.Distance(vector2_3, this.aimPoint) <= (double)Vector2.Distance(vector2_1, this.aimPoint)) { this.Position.Y -= 9f; this.direction = DirectionEnum.Up; this.Position.X = this.SnapToX(this.Position); return; } this.Position.X -= 9f; this.direction = DirectionEnum.Left; this.Position.Y = this.SnapToY(this.Position); return; } } else if (PacmanGame.Map.IsOpenLocation(this.maploc.X - 1, this.maploc.Y) & PacmanGame.Map.IsOpenLocation(this.maploc.X, this.maploc.Y + 1)) { if (Items.Pacman.mode == GhostMode.Frightened) { switch (new Random().Next(1, 2)) { case 1: this.Position.Y += 9f; this.Position.X = this.SnapToX(this.Position); this.direction = DirectionEnum.Up; return; case 2: this.Position.X -= 9f; this.Position.Y = this.SnapToY(this.Position); this.direction = DirectionEnum.Left; return; default: return; } } else { if ((double)Vector2.Distance(vector2_4, this.aimPoint) <= (double)Vector2.Distance(vector2_1, this.aimPoint)) { this.Position.Y += 9f; this.direction = DirectionEnum.Down; this.Position.X = this.SnapToX(this.Position); return; } this.Position.X -= 9f; this.direction = DirectionEnum.Left; this.Position.Y = this.SnapToY(this.Position); return; } } } if (this.direction == DirectionEnum.Up) { if (!PacmanGame.Map.IsOpenLocation(this.maploc.X + 1, this.maploc.Y) & !PacmanGame.Map.IsOpenLocation(this.maploc.X - 1, this.maploc.Y)) { this.Position.Y -= this.Speed; this.Position.X = this.SnapToX(this.Position); this.direction = DirectionEnum.Up; return; } if (!PacmanGame.Map.IsOpenLocation(this.maploc.X - 1, this.maploc.Y) && !PacmanGame.Map.IsOpenLocation(this.maploc.X, this.maploc.Y - 1)) { this.Position.X += 9f; this.Position.Y = this.SnapToY(this.Position); this.direction = DirectionEnum.Right; return; } if (!PacmanGame.Map.IsOpenLocation(this.maploc.X + 1, this.maploc.Y) && !PacmanGame.Map.IsOpenLocation(this.maploc.X, this.maploc.Y - 1)) { this.Position.X -= 9f; this.Position.Y = this.SnapToY(this.Position); this.direction = DirectionEnum.Left; return; } if (PacmanGame.Map.IsOpenLocation(this.maploc.X + 1, this.maploc.Y) & PacmanGame.Map.IsOpenLocation(this.maploc.X - 1, this.maploc.Y)) { if (PacmanGame.Map.IsOpenLocation(this.maploc.X, this.maploc.Y - 1)) { if (Items.Pacman.mode == GhostMode.Frightened) { switch (new Random().Next(1, 3)) { case 1: this.Position.Y -= 9f; this.Position.X = this.SnapToX(this.Position); this.direction = DirectionEnum.Up; return; case 2: this.Position.X -= 9f; this.Position.Y = this.SnapToY(this.Position); this.direction = DirectionEnum.Left; return; case 3: this.Position.X += 9f; this.Position.Y = this.SnapToY(this.Position); this.direction = DirectionEnum.Right; return; default: return; } } else { if ((double)Vector2.Distance(vector2_3, this.aimPoint) <= (double)Vector2.Distance(vector2_2, this.aimPoint) & (double)Vector2.Distance(vector2_3, this.aimPoint) <= (double)Vector2.Distance(vector2_1, this.aimPoint)) { this.Position.Y -= 9f; this.Position.X = this.SnapToX(this.Position); this.direction = DirectionEnum.Up; return; } if ((double)Vector2.Distance(vector2_1, this.aimPoint) <= (double)Vector2.Distance(vector2_3, this.aimPoint) && (double)Vector2.Distance(vector2_1, this.aimPoint) <= (double)Vector2.Distance(vector2_2, this.aimPoint)) { this.Position.X -= 9f; this.Position.Y = this.SnapToY(this.Position); this.direction = DirectionEnum.Left; return; } this.Position.X += 9f; this.Position.Y = this.SnapToY(this.Position); this.direction = DirectionEnum.Right; return; } } else if (Items.Pacman.mode == GhostMode.Frightened) { switch (new Random().Next(1, 2)) { case 1: this.Position.X -= 9f; this.Position.Y = this.SnapToY(this.Position); this.direction = DirectionEnum.Left; return; case 2: this.Position.X += 9f; this.Position.Y = this.SnapToX(this.Position); this.direction = DirectionEnum.Right; return; default: return; } } else { if ((double)Vector2.Distance(vector2_1, this.aimPoint) <= (double)Vector2.Distance(vector2_2, this.aimPoint)) { this.Position.X -= 9f; this.direction = DirectionEnum.Left; this.Position.Y = this.SnapToY(this.Position); return; } this.Position.X += 9f; this.direction = DirectionEnum.Right; this.Position.Y = this.SnapToY(this.Position); return; } } else if (PacmanGame.Map.IsOpenLocation(this.maploc.X + 1, this.maploc.Y) & PacmanGame.Map.IsOpenLocation(this.maploc.X, this.maploc.Y - 1)) { if (Items.Pacman.mode == GhostMode.Frightened) { switch (new Random().Next(1, 2)) { case 1: this.Position.Y -= 9f; this.Position.X = this.SnapToX(this.Position); this.direction = DirectionEnum.Up; return; case 2: this.Position.X += 9f; this.Position.Y = this.SnapToY(this.Position); this.direction = DirectionEnum.Right; return; default: return; } } else { if ((double)Vector2.Distance(vector2_3, this.aimPoint) <= (double)Vector2.Distance(vector2_2, this.aimPoint)) { this.Position.Y -= 9f; this.direction = DirectionEnum.Up; this.Position.X = this.SnapToX(this.Position); return; } this.Position.X += 9f; this.direction = DirectionEnum.Right; this.Position.Y = this.SnapToY(this.Position); return; } } else if (PacmanGame.Map.IsOpenLocation(this.maploc.X - 1, this.maploc.Y) & PacmanGame.Map.IsOpenLocation(this.maploc.X, this.maploc.Y - 1)) { if (Items.Pacman.mode == GhostMode.Frightened) { switch (new Random().Next(1, 2)) { case 1: this.Position.Y -= 9f; this.Position.X = this.SnapToX(this.Position); this.direction = DirectionEnum.Up; return; case 2: this.Position.X -= 9f; this.Position.Y = this.SnapToY(this.Position); this.direction = DirectionEnum.Left; return; default: return; } } else { if ((double)Vector2.Distance(vector2_3, this.aimPoint) <= (double)Vector2.Distance(vector2_2, this.aimPoint)) { this.Position.Y -= 9f; this.direction = DirectionEnum.Up; this.Position.X = this.SnapToX(this.Position); return; } this.Position.X -= 9f; this.direction = DirectionEnum.Left; this.Position.Y = this.SnapToY(this.Position); return; } } } if (this.direction != DirectionEnum.Down) { return; } if (!PacmanGame.Map.IsOpenLocation(this.maploc.X + 1, this.maploc.Y) && !PacmanGame.Map.IsOpenLocation(this.maploc.X - 1, this.maploc.Y)) { this.direction = DirectionEnum.Down; this.Position.Y += this.Speed; this.Position.X = this.SnapToX(this.Position); } else if (!PacmanGame.Map.IsOpenLocation(this.maploc.X - 1, this.maploc.Y) && !PacmanGame.Map.IsOpenLocation(this.maploc.X, this.maploc.Y + 1)) { this.Position.X += 9f; this.Position.Y = this.SnapToY(this.Position); this.direction = DirectionEnum.Right; } else if (!PacmanGame.Map.IsOpenLocation(this.maploc.X + 1, this.maploc.Y) && !PacmanGame.Map.IsOpenLocation(this.maploc.X, this.maploc.Y + 1)) { this.Position.X -= 9f; this.Position.Y = this.SnapToY(this.Position); this.direction = DirectionEnum.Left; } else if (PacmanGame.Map.IsOpenLocation(this.maploc.X + 1, this.maploc.Y) && PacmanGame.Map.IsOpenLocation(this.maploc.X - 1, this.maploc.Y)) { if (PacmanGame.Map.IsOpenLocation(this.maploc.X, this.maploc.Y + 1)) { if (Items.Pacman.mode == GhostMode.Frightened) { switch (new Random().Next(1, 3)) { case 1: this.Position.X -= 9f; this.Position.Y = this.SnapToY(this.Position); this.direction = DirectionEnum.Left; break; case 2: this.Position.Y += 9f; this.Position.X = this.SnapToX(this.Position); this.direction = DirectionEnum.Down; break; case 3: this.Position.X += 9f; this.Position.Y = this.SnapToY(this.Position); this.direction = DirectionEnum.Right; break; } } else if ((double)Vector2.Distance(vector2_1, this.aimPoint) <= (double)Vector2.Distance(vector2_3, this.aimPoint) && (double)Vector2.Distance(vector2_1, this.aimPoint) <= (double)Vector2.Distance(vector2_2, this.aimPoint)) { this.Position.X -= 9f; this.Position.Y = this.SnapToY(this.Position); this.direction = DirectionEnum.Left; } else if ((double)Vector2.Distance(vector2_4, this.aimPoint) <= (double)Vector2.Distance(vector2_2, this.aimPoint) && (double)Vector2.Distance(vector2_4, this.aimPoint) <= (double)Vector2.Distance(vector2_1, this.aimPoint)) { this.Position.Y += 9f; this.Position.X = this.SnapToX(this.Position); this.direction = DirectionEnum.Down; } else { this.Position.X += 9f; this.Position.Y = this.SnapToY(this.Position); this.direction = DirectionEnum.Right; } } else if (Items.Pacman.mode == GhostMode.Frightened) { switch (new Random().Next(1, 2)) { case 1: this.Position.X -= 9f; this.Position.Y = this.SnapToY(this.Position); this.direction = DirectionEnum.Left; break; case 2: this.Position.X += 9f; this.Position.Y = this.SnapToX(this.Position); this.direction = DirectionEnum.Right; break; } } else if ((double)Vector2.Distance(vector2_1, this.aimPoint) <= (double)Vector2.Distance(vector2_2, this.aimPoint)) { this.Position.X -= 9f; this.direction = DirectionEnum.Left; this.Position.Y = this.SnapToY(this.Position); } else { this.Position.X += 9f; this.direction = DirectionEnum.Right; this.Position.Y = this.SnapToY(this.Position); } } else if (PacmanGame.Map.IsOpenLocation(this.maploc.X + 1, this.maploc.Y) & PacmanGame.Map.IsOpenLocation(this.maploc.X, this.maploc.Y + 1)) { if (Items.Pacman.mode == GhostMode.Frightened) { switch (new Random().Next(1, 2)) { case 1: this.Position.Y += 9f; this.Position.X = this.SnapToX(this.Position); this.direction = DirectionEnum.Down; break; case 2: this.Position.X += 9f; this.Position.Y = this.SnapToY(this.Position); this.direction = DirectionEnum.Right; break; } } else if ((double)Vector2.Distance(vector2_4, this.aimPoint) <= (double)Vector2.Distance(vector2_2, this.aimPoint)) { this.Position.Y += 9f; this.direction = DirectionEnum.Down; this.Position.X = this.SnapToX(this.Position); } else { this.Position.X += 9f; this.direction = DirectionEnum.Right; this.Position.Y = this.SnapToY(this.Position); } } else { if (!(PacmanGame.Map.IsOpenLocation(this.maploc.X - 1, this.maploc.Y) & PacmanGame.Map.IsOpenLocation(this.maploc.X, this.maploc.Y + 1))) { return; } if (Items.Pacman.mode == GhostMode.Frightened) { switch (new Random().Next(1, 2)) { case 1: this.Position.Y += 9f; this.Position.X = this.SnapToX(this.Position); this.direction = DirectionEnum.Down; break; case 2: this.Position.X -= 9f; this.Position.Y = this.SnapToY(this.Position); this.direction = DirectionEnum.Left; break; } } else if ((double)Vector2.Distance(vector2_4, this.aimPoint) <= (double)Vector2.Distance(vector2_2, this.aimPoint)) { this.Position.Y += 9f; this.direction = DirectionEnum.Down; this.Position.X = this.SnapToX(this.Position); } else { this.Position.X -= 9f; this.direction = DirectionEnum.Left; this.Position.Y = this.SnapToY(this.Position); } } }
internal ProductReviewNode(RELATIONSHIP relationship, DirectionEnum direction, string neo4jLabel = null) : base(relationship, direction, neo4jLabel) { }
/// <summary> /// 服务机构对账单--ck--带事务 /// </summary> /// <param name="number">店铺或会员编号</param> /// <param name="money">交易金额</param> /// <param name="sftype">交易类型</param> /// <param name="kmtype">科目</param> /// <param name="direction">是进还是出</param> public static int AddStoreAccount(string number, double money, D_AccountSftype sftype, S_Sftype Ssftype, D_AccountKmtype kmtype, DirectionEnum direction, string str, SqlTransaction tran) { return(D_AccountDAL.AddStoreAccount(number, money, sftype, Ssftype, kmtype, direction, str, tran)); }
/// <summary> /// 检测是否需要构建面 /// </summary> /// <param name="chunk"></param> /// <param name="localPosition"></param> /// <param name="direction"></param> /// <param name="closeDirection"></param> /// <returns></returns> public override bool CheckNeedBuildFace(Chunk chunk, Vector3Int localPosition, BlockDirectionEnum direction, DirectionEnum closeDirection) { if (localPosition.y == 0) { return(false); } GetCloseRotateBlockByDirection(chunk, localPosition, direction, closeDirection, out Block closeBlock, out Chunk closeBlockChunk, out Vector3Int closeLocalPosition); if (closeBlock == null || closeBlock.blockType == BlockTypeEnum.None) { if (closeBlockChunk != null && closeBlockChunk.isInit) { //只是空气方块 return(true); } else { //还没有生成chunk return(false); } } BlockShapeEnum blockShape = closeBlock.blockInfo.GetBlockShape(); switch (blockShape) { case BlockShapeEnum.Cube: case BlockShapeEnum.CubeLeaves: return(false); default: return(true); } }
/// <summary> /// 对账单带事务——ds2012——tianfeng /// </summary> /// <param name="number">店铺或会员编号</param> /// <param name="money">交易金额</param> /// <param name="sftype">交易类型</param> /// <param name="kmtype">科目</param> /// <param name="direction">是进还是出</param> public static void AddAccount(string number, double money, D_AccountSftype sftype, D_AccountKmtype kmtype, DirectionEnum direction, string remark, SqlTransaction tran, bool state) { D_AccountDAL.AddAccount(number, money, sftype, kmtype, direction, remark, tran, state); }
/// <summary> /// 带事务报单款对账单——ds2012——CK /// </summary> /// <param name="number"></param> /// <param name="money"></param> /// <param name="sftype"></param> /// <param name="kmtype"></param> /// <param name="direction"></param> /// <param name="str"></param> public static int AddAccountTran(string number, double money, D_AccountSftype sftype, D_Sftype Dsftype, D_AccountKmtype kmtype, DirectionEnum direction, string remark, SqlTransaction tran) { return(D_AccountDAL.AddAccountTran(number, money, sftype, Dsftype, kmtype, direction, remark, tran)); }
/// <summary> /// 对账单不带事务——ds2012——tianfeng /// </summary> /// <param name="number">店铺或会员编号</param> /// <param name="money">交易金额</param> /// <param name="sftype">交易类型</param> /// <param name="kmtype">科目</param> /// <param name="direction">是进还是出</param> public static void AddAccount(string number, double money, D_AccountSftype sftype, D_AccountKmtype kmtype, DirectionEnum direction, string remark) { D_AccountDAL.AddAccount(number, money, sftype, kmtype, direction, remark); }
static void Main(string[] args) { string[,] mars = new string[10, 10]; for (int i = 0; i < 10; i++) { for (int j = 0; j < 10; j++) { var r = new Random().Next(0, 10); mars[j, i] = (r > 8) ? "*" : "+"; } } for (int i = 0; i < 10; i++) { for (int j = 0; j < 10; j++) { Console.Write(mars[j, i]); } Console.WriteLine(""); } string command = ""; IWorld world = new World(mars); MarsService service = new MarsService(world); bool run = true; while (run) { try { Position position = null; Console.WriteLine("Please insert commands: "); Console.WriteLine("Type 'exit' to leave this application"); Console.WriteLine("Type 'land' to land your Mars Rover"); Console.WriteLine("Type 'command' to insert a series of commands for your Mars Rover"); command = Console.ReadLine(); if (command.ToLower() == "land") { Console.WriteLine("Insert your landing X cooridnates, max X = " + world.GetRightEdgeXCoordinates()); int x = Convert.ToInt32(Console.ReadLine()); Console.WriteLine("Insert your landing Y cooridnates, max Y = " + world.GetTopEdgeYCoordinates()); int y = Convert.ToInt32(Console.ReadLine()); Console.WriteLine("Insert your landing direction (N,S,E,W))"); var direction = Console.ReadLine().ToString(); DirectionEnum directionEnum = DirectionEnum.North; if (direction.ToLower() == "n") { directionEnum = DirectionEnum.North; } if (direction.ToLower() == "s") { directionEnum = DirectionEnum.South; } if (direction.ToLower() == "e") { directionEnum = DirectionEnum.East; } if (direction.ToLower() == "w") { directionEnum = DirectionEnum.West; } position = service.LandRover(x, y, directionEnum); } else if (command.ToLower() == "command") { Console.WriteLine("Insert commands separated by comma ',' and press Enter for example:l,r,f,b"); string commands = Console.ReadLine(); string[] commandsArray = commands.Split(',', 9000); position = service.MoveRover(commandsArray); Console.WriteLine("New rover position: " + position.ToString()); } else if (command.ToLower() == "exit") { run = false; } else { Console.WriteLine("Invalid command"); } PrintMatrix(position, mars); } catch (RoverException ex) { Console.WriteLine(ex.Message); Console.WriteLine("Last position " + ex.LastPosition.ToString()); PrintMatrix(ex.LastPosition, mars); } catch (Exception ex) { Console.WriteLine("An errore has occurred: " + ex.Message); } } Console.WriteLine("Bye!!!"); }
/// <summary> /// 服务机构对账单--ck /// </summary> /// <param name="number">店铺或会员编号</param> /// <param name="money">交易金额</param> /// <param name="sftype">交易类型</param> /// <param name="kmtype">科目</param> /// <param name="direction">是进还是出</param> public static void AddStoreAccount(string number, double money, D_AccountSftype sftype, S_Sftype Ssftype, D_AccountKmtype kmtype, DirectionEnum direction, string str) { D_AccountDAL.AddStoreAccount(number, money, sftype, Ssftype, kmtype, direction, str); }
/// <summary> /// Default method to be used for a new sorting instance /// </summary> /// <param name="path">Path of the image that will be processed</param> /// <param name="selectedSort">Enum of the selected sorting method to be used</param> /// <param name="lower">lower bounds for the brightness sort</param> /// <param name="upper">upper bounds for the brightness sort</param> /// <returns></returns> public Bitmap Sort(string path, SortingMethodsEnum selectedSort, double lower, double upper, int hP, int vP, RGBEnum colorChecked, AdditionalOptionsEnum addOps, DirectionEnum directionChecked) { // if path is null or "", return null if (path == null || path.Equals("")) { return(null); } // creates two Bitmaps of the same image, handy for keeping the original width/height // and other data Bitmap image = new Bitmap(@path); Bitmap origImage = new Bitmap(@path); image = RotateImage(image, directionChecked); origImage = RotateImage(origImage, directionChecked); // if Extend is clicked, ExtendSort the image if (addOps == AdditionalOptionsEnum.Extend) { image = ExtendSort(image); } // If the number of horizontal or vertical partitions is greater than or equal to the // width or height of the image, don't partition the image and sort with the whole image instead if (hP >= image.Width || vP >= image.Height) { // Switch statement for using the correct sort based on the selected method switch (selectedSort) { case SortingMethodsEnum.Brightness: image = SortByBrightness(image, lower, upper, addOps, selectedSort); break; case SortingMethodsEnum.Hue: image = SortByHue(image, addOps, selectedSort, lower, upper); break; case SortingMethodsEnum.Saturation: image = SortBySaturation(image, addOps, selectedSort, lower, upper); break; case SortingMethodsEnum.RGB: image = SortByRGB(image, colorChecked, addOps, selectedSort, lower, upper); break; default: break; } } // If the number of partitions wanted is within the image's width/height, split the // image into (horizontal partitions + 1) * (vertical partitions + 1), sort the // paritions, and then stitch them back together else { int modx = image.Width % (1 + hP); int mody = image.Height % (1 + vP); image = RotateImageBack(image, directionChecked); List <Bitmap> partitions = PartitionImage(image, hP, vP, modx, mody); for (int i = 0; i < partitions.Count; ++i) { partitions[i] = RotateImage(partitions[i], directionChecked); switch (selectedSort) { case SortingMethodsEnum.Brightness: partitions[i] = SortByBrightness(partitions[i], lower, upper, addOps, selectedSort); partitions[i] = RotateImageBack(partitions[i], directionChecked); continue; case SortingMethodsEnum.Hue: partitions[i] = SortByHue(partitions[i], addOps, selectedSort, lower, upper); partitions[i] = RotateImageBack(partitions[i], directionChecked); continue; case SortingMethodsEnum.Saturation: partitions[i] = SortBySaturation(partitions[i], addOps, selectedSort, lower, upper); partitions[i] = RotateImageBack(partitions[i], directionChecked); continue; case SortingMethodsEnum.RGB: partitions[i] = SortByRGB(partitions[i], colorChecked, addOps, selectedSort, lower, upper); partitions[i] = RotateImageBack(partitions[i], directionChecked); continue; default: partitions[i] = RotateImageBack(partitions[i], directionChecked); continue; } } image = Recombine(partitions, hP + 1); image = RotateImage(image, directionChecked); } // if Extending was selected, then put the image back together so it's no longer a single line of pixels if (addOps == AdditionalOptionsEnum.Extend) { image = UnExtendSort(image, origImage); } image = RotateImageBack(image, directionChecked); // return the image to the user return(image); }
public void moveInDirection(DirectionEnum direction) { Tile possibleNewTile = null; switch (direction) { case DirectionEnum.Left: possibleNewTile = tile.Left; break; case DirectionEnum.Right: possibleNewTile = tile.Right; break; case DirectionEnum.Up: possibleNewTile = tile.Up; break; case DirectionEnum.Down: possibleNewTile = tile.Down; break; default: break; } bool canMove = false; if (possibleNewTile != null) { if (possibleNewTile.Entity == null) { canMove = true; } else if (possibleNewTile.getEntityType() == EntityTypesEnum.Exit) { status = EntityStatesEnum.Celebrating; } else if (possibleNewTile.getEntityType() == EntityTypesEnum.Firefly) { status = EntityStatesEnum.Killed; } else if (possibleNewTile.getEntityType() == EntityTypesEnum.Mud) { canMove = true; } else if (possibleNewTile.getEntityType() == EntityTypesEnum.Diamond) { canMove = true; Score += 100; } else if (possibleNewTile.getEntityType() == EntityTypesEnum.Boulder) { Tile targetTile = null; switch (direction) { case DirectionEnum.Left: targetTile = possibleNewTile.Left; break; case DirectionEnum.Right: targetTile = possibleNewTile.Right; break; case DirectionEnum.Up: targetTile = possibleNewTile.Up; break; case DirectionEnum.Down: targetTile = possibleNewTile.Down; break; } if (targetTile != null) { if (targetTile.getEntityType() == EntityTypesEnum.Tile) { targetTile.putOnTile(possibleNewTile.Entity); possibleNewTile.Entity = null; canMove = true; } } } else { canMove = false; } } else { return; } if (canMove) { moveTo(possibleNewTile); } }
private Direction(DirectionEnum direction) { this._Direction = direction; }
/// <summary> /// Initializes a new instance of the <see cref="SubAccountTransfer" /> class. /// </summary> /// <param name="currency">Transfer currency name (required).</param> /// <param name="subAccount">Sub account user ID (required).</param> /// <param name="direction">Transfer direction. to - transfer into sub account; from - transfer out from sub account (required).</param> /// <param name="amount">Transfer amount (required).</param> /// <param name="subAccountType">Target sub user's account. `spot` - spot account, `futures` - perpetual contract account (default to SubAccountTypeEnum.Spot).</param> public SubAccountTransfer(string currency = default(string), string subAccount = default(string), DirectionEnum direction = default(DirectionEnum), string amount = default(string), SubAccountTypeEnum?subAccountType = SubAccountTypeEnum.Spot) { // to ensure "currency" is required (not null) this.Currency = currency ?? throw new ArgumentNullException("currency", "currency is a required property for SubAccountTransfer and cannot be null"); // to ensure "subAccount" is required (not null) this.SubAccount = subAccount ?? throw new ArgumentNullException("subAccount", "subAccount is a required property for SubAccountTransfer and cannot be null"); this.Direction = direction; // to ensure "amount" is required (not null) this.Amount = amount ?? throw new ArgumentNullException("amount", "amount is a required property for SubAccountTransfer and cannot be null"); this.SubAccountType = subAccountType; }
internal CUSTOMER_HAS_STORE_REL(Blueprint41.Query.Node parent, DirectionEnum direction) : base(parent, direction) { }
private bool IsWallOnWay(int row, int column, DirectionEnum direction) { return(GetWall(row, column, direction) != null); }
/// <summary> /// Gets the direction of the text. /// </summary> /// <param name="v"></param> /// <param name="def"></param> /// <returns></returns> public static DirectionEnum GetDirection(string v, DirectionEnum def) { DirectionEnum d; try { d = (DirectionEnum)Enum.Parse(typeof(DirectionEnum), v); } catch { d = def; } return d; }
internal PRODUCT_HAS_TRANSACTIONHISTORY_REL(Blueprint41.Query.Node parent, DirectionEnum direction) : base(parent, direction) { }