コード例 #1
0
 public void btnDownRight_Click()
 {
     ResizeDir = Dir8.DownRight;
 }
コード例 #2
0
ファイル: Map.cs プロジェクト: RogueCollab/RogueEssence
 public bool DirBlocked(Dir8 dir, Loc loc, uint mobility)
 {
     return(DirBlocked(dir, loc, mobility, 1, true, true));
 }
コード例 #3
0
 public void btnDownLeft_Click()
 {
     ResizeDir = Dir8.DownLeft;
 }
コード例 #4
0
 public void btnDown_Click()
 {
     ResizeDir = Dir8.Down;
 }
コード例 #5
0
 /// <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));
 }
コード例 #6
0
 public void btnRight_Click()
 {
     ResizeDir = Dir8.Right;
 }
コード例 #7
0
 public void btnUpRight_Click()
 {
     ResizeDir = Dir8.UpRight;
 }
コード例 #8
0
 public CharAnimIdle(Loc loc, Dir8 dir)
 {
     AnimLoc = loc; CharDir = dir;
 }
コード例 #9
0
 public void btnUpLeft_Click()
 {
     ResizeDir = Dir8.UpLeft;
 }
コード例 #10
0
 public void btnUp_Click()
 {
     ResizeDir = Dir8.Up;
 }
コード例 #11
0
ファイル: AvoidPlan.cs プロジェクト: PMDCollab/PMDC
        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));
            }
        }
コード例 #12
0
 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;
 }
コード例 #13
0
 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;
 }
コード例 #14
0
 public void DrawDir(SpriteBatch spriteBatch, Vector2 pos, int frame, Dir8 dir)
 {
     DrawDir(spriteBatch, pos, frame, dir, Color.White);
 }
コード例 #15
0
 public void btnLeft_Click()
 {
     ResizeDir = Dir8.Left;
 }
コード例 #16
0
        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));
        }
コード例 #17
0
 public void btnNone_Click()
 {
     ResizeDir = Dir8.None;
 }
コード例 #18
0
 public CharAnimPose(Loc loc, Dir8 dir, int frameType, int poseTime)
 {
     AnimLoc = loc; CharDir = dir; BaseFrameType = frameType; PoseTime = poseTime;
 }
コード例 #19
0
        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);
        }