Beispiel #1
0
 public Zone(int Level, int Priority)
 {
     v1 = new Vector();
     v2 = new Vector();
     level = Level;
     priority = Priority;
 }
Beispiel #2
0
        public Zone(Vector V1, Vector V2, int Level, int Priority)
        {
            v1 = new Vector();
            v2 = new Vector();

            if (V1.x > V2.x)
            {
                v2.x = V1.x;
                v1.x = V2.x;
            }
            else
            {
                v1.x = V1.x;
                v2.x = V2.x;
            }

            if (V1.y > V2.y)
            {
                v2.y = V1.y;
                v1.y = V2.y;
            }
            else
            {
                v1.y = V1.y;
                v2.y = V2.y;
            }

            if (V1.z > V2.z)
            {
                v2.z = V1.z;
                v1.z = V2.z;
            }
            else
            {
                v1.z = V1.z;
                v2.z = V2.z;
            }
            level = Level;
            priority = Priority;
        }
Beispiel #3
0
 public Vector(Vector v)
 {
     x = v.x;
     y = v.y;
     z = v.z;
 }
Beispiel #4
0
 public bool CanBuild(Vector v)
 {
     Zone z = Program.FindApplicableZone(v);
     if (z == null) return HasLevel(Program.zoneDefaultLevel);
     else return HasLevel(z.level);
 }
Beispiel #5
0
 public virtual bool IsInZone(Vector v)
 {
     return (v.x >= v1.x && v.x <= v2.x && v.y >= v1.y && v.y <= v2.y && v.z >= v1.z && v.z <= v2.z);
 }
Beispiel #6
0
 public static Zone FindApplicableZone(Vector v)
 {
     Zone czone = null; int cpriority = int.MinValue;
     foreach (Zone zone in Program.zones)
     {
         if (zone.priority <= cpriority || !zone.IsInZone(v)) continue;
         czone = zone;
         cpriority = zone.priority;
     }
     return czone;
 }