public static MapAttribute CreateAttribute(MapAttributes type)
        {
            switch (type)
            {
            case MapAttributes.Walkable:
                return(null);

            case MapAttributes.Blocked:
                return(new MapBlockedAttribute());

            case MapAttributes.Item:
                return(new MapItemAttribute());

            case MapAttributes.ZDimension:
                return(new MapZDimensionAttribute());

            case MapAttributes.NpcAvoid:
                return(new MapNpcAvoidAttribute());

            case MapAttributes.Warp:
                return(new MapWarpAttribute());

            case MapAttributes.Sound:
                return(new MapSoundAttribute());

            case MapAttributes.Resource:
                return(new MapResourceAttribute());

            case MapAttributes.Animation:
                return(new MapAnimationAttribute());

            case MapAttributes.GrappleStone:
                return(new MapGrappleStoneAttribute());

            case MapAttributes.Slide:
                return(new MapSlideAttribute());
            }

            return(null);
        }
Exemplo n.º 2
0
        private Texture2D CreateMapPreview(MapAttributes ActiveMap)
        {
            int       PreviewWidth = 200;
            int       PreviewHeigh = 200;
            Texture2D MapPreview   = new Texture2D(GraphicsDevice, PreviewWidth, PreviewHeigh);

            Color[] data = new Color[PreviewWidth * PreviewHeigh];
            for (int pixel = 0; pixel < data.Length; pixel++)
            {
                data[pixel] = Color.FromNonPremultiplied(255, 255, 255, 255);
            }

            foreach (EventPoint ActiveEvent in ActiveMap.ListSpawns)
            {
                int X = (int)ActiveEvent.Position.X;
                int Y = (int)ActiveEvent.Position.Y * ActiveMap.MapSize.X;
                data[X + Y] = Color.FromNonPremultiplied(255, 255, 255, 255);
            }

            //set the color
            MapPreview.SetData(data);
            return(MapPreview);
        }
Exemplo n.º 3
0
        public Point GetSpawn(Maps map, int minX, int maxX, int minY, int maxY)
        {
            var x    = 0;
            var y    = 0;
            var z    = 0;
            var mMap = ResourceCache.Instance.GetMaps()[map];

            MapAttributes[] att = new MapAttributes[] { MapAttributes.Safe, MapAttributes.NoWalk, MapAttributes.Hide };
            do
            {
                x = _rand.Next(minX, maxX);
                y = _rand.Next(minY, maxY);
            } while (
                mMap.ContainsAny(x, y, att) &&
                ++z < 10
                );

            if (z == 10)
            {
                throw new InvalidOperationException();
            }

            return(new Point(x, y));
        }
Exemplo n.º 4
0
 public void SetAttributes(int seed, int octaves, float period, float lacunarity, float persistence, int width, float height, Vector3 CellSize, float tree_spread)
 {
     attributes = new MapAttributes(seed, octaves, period, lacunarity, persistence, width, height, CellSize, tree_spread);
 }
Exemplo n.º 5
0
 // Called when the node enters the scene tree for the first time.
 public override void _Ready()
 {
     attributes = new MapAttributes();
     Connect(nameof(ReadyToSendAttributes), this, nameof(JoiningEnabled));
 }
Exemplo n.º 6
0
 public async Task RemoveAttribute(MapAttributes att, Rectangle area)
 {
     await RemoveAttribute(att, new Rectangle[] { area });
 }
Exemplo n.º 7
0
 public async Task AddAttribute(MapAttributes att, Rectangle area)
 {
     await AddAttribute(att, new Rectangle[] { area });
 }
Exemplo n.º 8
0
 public void ClearAttribute(int X, int Y, MapAttributes att)
 {
     SetByte(X, Y, (GetByte(X, Y) & (~att)));
 }
Exemplo n.º 9
0
 public void SetAttribute(int X, int Y, MapAttributes att)
 {
     SetByte(X, Y, (GetByte(X, Y) | att));
 }
Exemplo n.º 10
0
 private void SetByte(int X, int Y, MapAttributes val)
 {
     Layer[Y * 256 + X] = val;
 }
Exemplo n.º 11
0
        private void SetMapAttributes(MapComponent mapComponent)
        {
            MapAttributes mapAttribute = _mapAttributesList.GetMapAttributeForTier(mapComponent.Tier);

            mapComponent.SetSpawnType(mapAttribute.SpawnType, mapAttribute.Time);
        }
Exemplo n.º 12
0
 public void ClearAttribute(int X, int Y, MapAttributes att)
 {
     Layer[Y * 256 + X] &= (byte)(~((byte)att));
 }
Exemplo n.º 13
0
 public void SetAttribute(int X, int Y, MapAttributes att)
 {
     Layer[Y * 256 + X] |= (byte)att;
 }
Exemplo n.º 14
0
 public MapModel(int width, int height, MapAttributes attrs)
     : this(new MapTile(width, height), attrs)
 {
 }
Exemplo n.º 15
0
 public extern static ReactElement Map(MapAttributes properties, params ReactElementOrText[] children);