Esempio n. 1
0
        public Tile(SerializationInputStream Stream, Map Map, TileRuleSet RuleSet, IdGenerator IdGenerator)
        {
            this.Map      = Map;
            Coordinate    = new Coordinate(Stream);
            HexCoordinate = new HexCoordinate(Coordinate);
            Id            = IdGenerator.GenerateId();
            Configuration = new TileConfiguration(Stream);
            Bounds        = CalculateBounds();

            this.RuleSet = RuleSet;
            Rules        = new TileRulesCalculator(this);
            Configuration.OnReconfigure += (sender, e) => Rules.Recalculate();
        }
Esempio n. 2
0
        public Tile(Map Map, Coordinate Coordinate, TileRuleSet RuleSet, IdGenerator IdGenerator)
        {
            this.Map        = Map;
            this.Coordinate = Coordinate;
            this.RuleSet    = RuleSet;
            Id            = IdGenerator.GenerateId();
            HexCoordinate = new HexCoordinate(Coordinate);
            Bounds        = CalculateBounds();

            Configuration = new TileConfiguration();
            Rules         = new TileRulesCalculator(this);
            Configuration.OnReconfigure += (sender, e) => Rules.Recalculate();
        }
        public TileConfiguration(TileConfiguration Copy, bool Invert = false)
        {
            Elevation = Copy.Elevation;
            TileBase  = Copy.TileBase;

            if (Invert)
            {
                for (int i = 0; i < 6; ++i)
                {
                    _Edges[i]        = Copy._Edges[(i + 3) % 6];
                    _PathOverlays[i] = Copy._PathOverlays[(i + 3) % 6];
                }
            }
            else
            {
                _Edges        = Copy._Edges.ToArray();
                _PathOverlays = Copy._PathOverlays.ToArray();
            }
        }
 public void Merge(TileConfiguration Configuration)
 {
     if (TileBase == TileBase.CLEAR)
     {
         TileBase = Configuration.TileBase;
     }
     Elevation = Math.Max(Elevation, Configuration.Elevation);
     for (int i = 0; i < 6; ++i)
     {
         if (_PathOverlays[i] == TilePathOverlay.NONE)
         {
             _PathOverlays[i] = Configuration._PathOverlays[i];
         }
         if (_Edges[i] == TileEdge.NONE)
         {
             _Edges[i] = Configuration._Edges[i];
         }
     }
     TriggerReconfigure();
 }