public void btnDownRight_Click() { ResizeDir = Dir8.DownRight; }
public bool DirBlocked(Dir8 dir, Loc loc, uint mobility) { return(DirBlocked(dir, loc, mobility, 1, true, true)); }
public void btnDownLeft_Click() { ResizeDir = Dir8.DownLeft; }
public void btnDown_Click() { ResizeDir = Dir8.Down; }
/// <summary> /// Create a new marker with the specified parameters, and add it to the map. /// </summary> /// <param name="name"></param> /// <param name="pos"></param> /// <param name="dir"></param> public void AddMarker(string name, Loc pos, Dir8 dir) { Markers.Add(new GroundMarker(name, pos, dir)); }
public void btnRight_Click() { ResizeDir = Dir8.Right; }
public void btnUpRight_Click() { ResizeDir = Dir8.UpRight; }
public CharAnimIdle(Loc loc, Dir8 dir) { AnimLoc = loc; CharDir = dir; }
public void btnUpLeft_Click() { ResizeDir = Dir8.UpLeft; }
public void btnUp_Click() { ResizeDir = Dir8.Up; }
private GameAction DumbAvoid(Character controlledChar, bool preThink, List <Character> seenCharacters, CharIndex ownIndex, IRandom rand) { StablePriorityQueue <double, Dir8> candidateDirs = new StablePriorityQueue <double, Dir8>(); //choose the single direction that avoids other characters the most bool respectPeers = !preThink; for (int ii = -1; ii < DirExt.DIR8_COUNT; ii++) { Loc checkLoc = controlledChar.CharLoc + ((Dir8)ii).GetLoc(); double dirDistance = 0; //iterated in increasing character indices foreach (Character seenChar in seenCharacters) { if (RunFromAllies && !RunFromFoes) { //only avoid if their character index is lower than this one, aka higher ranking member CharIndex seenIndex = ZoneManager.Instance.CurrentMap.GetCharIndex(seenChar); if (seenIndex.Team > ownIndex.Team) { break; } else if (seenIndex.Team == ownIndex.Team) { if (seenIndex.Char > ownIndex.Char && seenChar.MemberTeam.LeaderIndex != seenIndex.Char) { continue; } } } dirDistance += Math.Sqrt((checkLoc - seenChar.CharLoc).DistSquared()); } candidateDirs.Enqueue(-dirDistance, (Dir8)ii); } Grid.LocTest checkDiagBlock = (Loc testLoc) => { return(ZoneManager.Instance.CurrentMap.TileBlocked(testLoc, controlledChar.Mobility, true)); //enemy/ally blockings don't matter for diagonals }; Grid.LocTest checkBlock = (Loc testLoc) => { if (ZoneManager.Instance.CurrentMap.TileBlocked(testLoc, controlledChar.Mobility)) { return(true); } if ((IQ & AIFlags.TrapAvoider) != AIFlags.None) { Tile tile = ZoneManager.Instance.CurrentMap.Tiles[testLoc.X][testLoc.Y]; if (tile.Effect.ID > -1) { TileData entry = DataManager.Instance.GetTile(tile.Effect.ID); if (entry.StepType == TileData.TriggerType.Trap || entry.StepType == TileData.TriggerType.Site || entry.StepType == TileData.TriggerType.Switch) { return(true); } } } if (respectPeers && BlockedByChar(testLoc, Alignment.Self | Alignment.Foe)) { return(true); } return(false); }; //try each direction from most appealing to least appealing, stopping if we get to "none" while (candidateDirs.Count > 0) { Dir8 highestDir = candidateDirs.Dequeue(); if (highestDir == Dir8.None) { if (AbortIfCornered)//this plan will be aborted, try the next plan in the list { return(null); } else//cry in a corner { return(new GameAction(GameAction.ActionType.Wait, Dir8.None)); } } else { //check to see if we can walk this way if (!Grid.IsDirBlocked(controlledChar.CharLoc, highestDir, checkBlock, checkDiagBlock)) { return(TrySelectWalk(controlledChar, highestDir)); } } } if (AbortIfCornered)//this plan will be aborted, try the next plan in the list { return(null); } else//cry in a corner { return(new GameAction(GameAction.ActionType.Wait, Dir8.None)); } }
public MultiAnimSprite(string animIndex, int frame, Loc position, int height, Dir8 dir, byte alpha) { AnimIndex = animIndex; Frame = frame; Position = position; Height = height; AnimDir = dir; Alpha = alpha; }
public CharAfterImage(Loc mapLoc, Dungeon.MonsterID appearance, int currentAnim, int frame, Dir8 dir, int locHeight, int animTime, byte alpha, byte alphaSpeed) { this.mapLoc = mapLoc; Appearance = appearance; CurrentAnim = currentAnim; Frame = frame; Direction = dir; this.locHeight = locHeight; AnimTime = animTime; Alpha = alpha; AlphaSpeed = alphaSpeed; }
public void DrawDir(SpriteBatch spriteBatch, Vector2 pos, int frame, Dir8 dir) { DrawDir(spriteBatch, pos, frame, dir, Color.White); }
public void btnLeft_Click() { ResizeDir = Dir8.Left; }
protected bool IsBlocked(QueryMethod queryMethod, int x, int y, Dir8 dir) { Loc loc = new Loc(x, y) + dir.GetLoc(); return(queryMethod(loc.X, loc.Y)); }
public void btnNone_Click() { ResizeDir = Dir8.None; }
public CharAnimPose(Loc loc, Dir8 dir, int frameType, int poseTime) { AnimLoc = loc; CharDir = dir; BaseFrameType = frameType; PoseTime = poseTime; }
private bool IsLooseBlocked(QueryMethod queryMethod, int[][] mainTextureArray, Loc rectStart, int x, int y, Dir8 dir) { Loc loc = new Loc(x, y) + dir.GetLoc(); return(queryMethod(loc.X, loc.Y) && mainTextureArray[loc.X - rectStart.X + 1][loc.Y - rectStart.Y + 1] == -1); }