Пример #1
0
        private static void ReadFootholds(Map map)
        {
            ushort Count = Reader.ReadUInt16();

            for (ushort i = 0; i < Count; ++i)
            {
                Foothold fh = new Foothold();
                fh.ID = Reader.ReadUInt16();
                //fh.NextIdentifier = Reader.ReadUInt16();
                //fh.PreviousIdentifier = Reader.ReadUInt16();
                Reader.ReadBytes(4);
                fh.X1 = Reader.ReadInt16();
                fh.X2 = Reader.ReadInt16();
                fh.Y1 = Reader.ReadInt16();
                fh.Y2 = Reader.ReadInt16();
                map.AddFoothold(fh);
            }
        }
Пример #2
0
        public Pos FindFloor(Pos mainPos)
        {
            short x    = mainPos.X;
            short y    = (short)(mainPos.Y - 100);
            short maxy = mainPos.Y;

            bool firstCheck = true;

            for (int i = 0; i < Footholds.Count; i++)
            {
                Foothold fh = Footholds[i];
                if ((x > fh.X1 && x <= fh.X2) || (x > fh.X2 && x <= fh.X1))
                {
                    short cmax = (short)((float)(fh.Y1 - fh.Y2) / (fh.X1 - fh.X2) * (x - fh.X1) + fh.Y1);
                    if ((cmax <= maxy || (maxy == mainPos.Y && firstCheck)) && cmax >= y)
                    {
                        maxy       = cmax;
                        firstCheck = false;
                    }
                }
            }
            return(new Pos(x, maxy));
        }
Пример #3
0
 public void AddFoothold(Foothold FH)
 {
     Footholds.Add(FH);
 }