示例#1
0
        public static int Build(AxialCoord a, AxialCoord b)
        {
            Debug.Assert(a.X < 100);
            Debug.Assert(a.Y < 100);
            Debug.Assert(b.X < 100);
            Debug.Assert(b.Y < 100);

            return(a.X * 1000000 + a.Y * 10000 + b.X * 100 + b.Y);
        }
示例#2
0
        public bool MoveMob(Mob mob, AxialCoord to)
        {
            if (mob.Coord == to)
            {
                Utils.Log(LogSeverity.Debug, nameof(MobManager), "MoveMob failed trying to move zero distance.");
                return(false);
            }
            Debug.Assert(mob.Coord != to, "Trying to move zero distance.");
            Debug.Assert(mob.Coord.Distance(to) == 1, "Trying to walk more than 1 hex");

            if (mob.Ap > 0)
            {
                mob.Coord = to;
                mob.Ap--;

                return(true);
            }
            else
            {
                return(false);
            }
        }
示例#3
0
 public MapItem(AxialCoord coord, HexType hexType)
 {
     Coord   = coord;
     HexType = hexType;
 }
示例#4
0
 public Mob AtCoord(AxialCoord c)
 {
     return(Mobs.FirstOrDefault(mob => Equals(mob.Coord, c)));
 }
示例#5
0
 public JsonAreaBuff(AreaBuff areaBuff)
 {
     Coord  = areaBuff.Coord;
     Radius = areaBuff.Radius;
     Effect = new JsonBuff(areaBuff.Effect);
 }
示例#6
0
 public T this[AxialCoord c] {
     get { return(_data[c.X + Size, c.Y + Size]); }
     set { _data[c.X + Size, c.Y + Size] = value; }
 }