コード例 #1
0
 public void SetFlags(TileFlags type, params int[] ids)
 {
     foreach (var id in ids)
     {
         this[id] = type;
     }
 }
コード例 #2
0
        private void FindPosition(TileFlags tileToFind)
        {
            var player  = _context.GetPlayer(_currentPlayerId);
            var map     = _context.GetMap(player.CurrentMap);
            var mapArea = CreateMapArea(map);

            _console2.DrawArea(CreatePlayerArea(player), mapArea.Width, 0);

            var found = map.AllPositions
                        .Select(p => new { Position = p, Flags = (TileFlags)map.GetPositionValue(p) })
                        .FirstOrDefault(x => (x.Flags & tileToFind) > 0);

            if (found == null)
            {
                return;
            }
            _context.SetGoalForPlayer(player.Id, found.Position);
            var path = PathFinder.CalculatePath(player.Position, found.Position, map.IsWalkable);

            foreach (var pathPos in path)
            {
                var tile = GetTile(map.GetPositionValue(pathPos));
                mapArea.Write(tile.Character, pathPos.X, pathPos.Y, ConsoleColor.Green, ConsoleColor.DarkGreen);
            }

            mapArea.CenterOffset(found.Position.X, found.Position.Y);
            _console2.DrawArea(mapArea, 0, 0);

            Console.ReadKey(true);
        }
コード例 #3
0
ファイル: TintBrush.cs プロジェクト: antero10/NinjaGame
        public override void Paint(GridLayout gridLayout, GameObject brushTarget, Vector3Int position)
        {
            if (brushTarget.layer == 31)
            {
                return;
            }

            Tilemap tilemap = brushTarget.GetComponent <Tilemap>();

            if (tilemap != null)
            {
                TileBase tile = tilemap.GetTile(position);
                if (tile != null)
                {
                    //Undo.RegisterCompleteObjectUndo(tilemap, "TintChange Color");
                    TileFlags tileFlag = tilemap.GetTileFlags(position);
                    if ((tileFlag & TileFlags.LockColor) != 0)
                    {
                        tilemap.SetTileFlags(position, (tileFlag & ~TileFlags.LockColor));
                    }
                    tilemap.SetColor(position, tint);
                    //EditorUtility.SetDirty(tile);
                }
            }
        }
コード例 #4
0
 private void SetAllTileFlags(TileFlags flag = TileFlags.None)
 {
     foreach (Vector2Int tile in GetAllTiles())
     {
         grid.SetTileFlags((Vector3Int)tile, flag);
     }
 }
コード例 #5
0
        public void setTile(String tileType)
        {
            switch (tileType.ToLower())
            {
            case "plain":
            {
                flag = TileFlags.plain;
                break;
            }

            case "unwalkable":
            {
                flag = TileFlags.unwalkable;
                break;
            }

            case "dialog":
            {
                flag = TileFlags.dialog;
                break;
            }

            default:
            {
                flag = TileFlags.plain;
                break;
            }
            }
        }
コード例 #6
0
 public void ChangeTileType(ITileType tiletype, bool rewriteflags)
 {
     _TTileType = tiletype;
     if (rewriteflags)
     {
         _TTileFlags = tiletype.Flags;                 // They're value types... right??? :ohdear:
     }
 }
コード例 #7
0
 public Tile(ITileType tileType)
 {
     _TTileType        = tileType;
     _TTileFlags       = tileType.Flags;
     _TTileEntityList  = new List <IEntity>();
     _TTileFeatureList = new List <ITileFeature>();
     _TileHeight       = 1;
     _Render           = new TilerIsADummy.PrototypeMapGen.PrototypeComponents.P_TileRenderComponent(this);
 }
コード例 #8
0
ファイル: TilemapExtension.cs プロジェクト: uiopsczc/Test
        private static void SetTile(Tilemap tilemap, Vector3Int cellPos, TileBase tileBase, Hashtable tileDetailDict)
        {
            tilemap.SetTile(cellPos, tileBase);
            TileFlags tileFlags = tileDetailDict.Get <int>(StringConst.String_tileFlags).ToEnum <TileFlags>();

            tilemap.SetTileFlags(cellPos, tileFlags);

            tilemap.SetTransformMatrix(cellPos,
                                       tileDetailDict.Get <string>(StringConst.String_transformMatrix).ToMatrix4x4OrDefault(null, Matrix4x4.identity));
        }
コード例 #9
0
 public static void UnlockFlag(Tilemap map, Vector3Int pos, TileFlags flag)
 {
     //var f = (int)map.GetTileFlags(pos);
     //if ((f & (int)flag) != 0)
     //{
     //    f = f & (~(int)flag);
     //    map.SetTileFlags(pos, (TileFlags)f);
     //}
     map.RemoveTileFlags(pos, flag);
 }
コード例 #10
0
 public void SetSeethru(bool seethru)
 {
     if (seethru)
     {
         _TTileFlags |= TileFlags.SeeThru;
     }
     else
     {
         _TTileFlags &= ~TileFlags.SeeThru;
     }
 }
コード例 #11
0
 internal void SetFlag(TileFlags f, bool value)
 {
     if (value)
     {
         flags |= f;
     }
     else
     {
         flags &= ~f;
     }
 }
コード例 #12
0
ファイル: Tile.cs プロジェクト: radtek/ZeldaOracle
 public void SetFlags(TileFlags flagsToSet, bool enabled)
 {
     if (enabled)
     {
         flags |= flagsToSet;
     }
     else
     {
         flags &= ~flagsToSet;
     }
 }
コード例 #13
0
 public void SetPassable(bool passable)
 {
     if (passable)
     {
         _TTileFlags |= TileFlags.Passable;
     }
     else
     {
         _TTileFlags &= ~TileFlags.Passable;
     }
 }
コード例 #14
0
        /// <summary>
        /// Checks navgrid tile flags.
        /// Returns false is outside navgrid area.
        /// </summary>
        /// <param name="x">X position inside navgrid.</param>
        /// <param name="y">Y position inside navgrid.</param>
        /// <param name="flag">Flags to check.</param>
        /// <returns>True if flags set, otherwise false.</returns>
        public bool HasFlags(int x, int y, TileFlags flags)
        {
            // False if accessing outside of array
            if (x < 0 || x >= NavGridWidth || y < 0 || y >= NavGridHeight)
            {
                return(false);
            }

            byte bits = (byte)flags;

            return((navGrid[x, y] & bits) == bits);
        }
コード例 #15
0
        public static Hashtable GetSerializeHashtable(this Tilemap self, Hashtable ref_id_hashtable = null)
        {
            Hashtable hashtable = new Hashtable
            {
                [StringConst.String_animationFrameRate] = self.animationFrameRate,
                [StringConst.String_color]       = self.color.ToHtmlStringRGBAOrDefault(),
                [StringConst.String_tileAnchor]  = self.tileAnchor.ToStringOrDefault(null, new Vector3(0.5f, 0.5f, 0)),
                [StringConst.String_orientation] = (int)self.orientation
            };

            Hashtable  tileHashtable = new Hashtable();
            Vector3Int size          = self.size;
            Vector3Int origin        = self.origin;

            hashtable[StringConst.String_size]   = size.ToStringOrDefault();
            hashtable[StringConst.String_origin] = origin.ToStringOrDefault();
            int checkCount = size.x * size.y * size.z;

            for (int i = 0; i < checkCount; i++)
            {
                int offsetZ = i / (size.x * size.y);
                int offsetY = (i - offsetZ * (size.x * size.y)) / size.x;
                int offsetX = i - offsetZ * (size.x * size.y) - offsetY * size.x;

                Vector3Int current = origin + new Vector3Int(offsetX, offsetY, offsetZ);
                if (self.HasTile(current))
                {
                    Hashtable tile_detail_hashtable = new Hashtable();

                    TileBase tileBase  = self.GetTile(current);
                    string   assetPath = tileBase.GetAssetPath();
                    string   guid      = AssetDatabase.AssetPathToGUID(assetPath);
                    long     refId     = AssetPathRefManager.instance.GetRefIdByGuid(guid);
                    tile_detail_hashtable[StringConst.String_tileBase_ref_id] = refId;
                    if (ref_id_hashtable != null)
                    {
                        ref_id_hashtable[refId] = true;
                    }

                    TileFlags tileFlags = self.GetTileFlags(current);
                    tile_detail_hashtable[StringConst.String_tileFlags] = (int)tileFlags;

                    tile_detail_hashtable[StringConst.String_transformMatrix] =
                        self.GetTransformMatrix(current).ToStringOrDefault(null, Matrix4x4.identity);

                    tileHashtable[current.ToString()] = tile_detail_hashtable;
                }
            }

            hashtable[StringConst.String_tile_hashtable] = tileHashtable;
            hashtable.Trim();
            return(hashtable);
        }
コード例 #16
0
ファイル: Tile.cs プロジェクト: jsapparts/CoreOpenTibiaServer
        public Tile(Coordinate position, TileFlags flags, bool belongsToHouse, List <Item> items)
        {
            if (items == null)
            {
                throw new ArgumentNullException(nameof(items));
            }

            Position       = position;
            Flags          = flags;
            BelongsToHouse = belongsToHouse;
            Items          = items;
        }
コード例 #17
0
        /// <summary>
        /// Clears navgrid tile flags.
        /// Does nothing if outside navgrid area.
        /// </summary>
        /// <param name="x">X position inside navgrid.</param>
        /// <param name="y">Y position inside navgrid.</param>
        /// <param name="flags">Flags to unset.</param>
        public void ClearFlags(int x, int y, TileFlags flags)
        {
            // Exit if accessing outside of array
            if (x < 0 || x >= NavGridWidth || y < 0 || y >= NavGridHeight)
            {
                return;
            }

            byte bits = (byte)flags;

            navGrid[x, y] &= (byte)~bits;
        }
コード例 #18
0
ファイル: Tile.cs プロジェクト: dreamsxin/ZeldaOracle
        private TileDataInstance tileData; // The tile data used to create this tile.

        #endregion Fields

        #region Constructors

        //-----------------------------------------------------------------------------
        // Constructors
        //-----------------------------------------------------------------------------
        // Use CreateTile() instead of this constructor.
        protected Tile()
        {
            location		= Point2I.Zero;
            layer			= 0;
            offset			= Point2I.Zero;
            size			= Point2I.One;
            flags			= TileFlags.Default;
            customSprite	= new SpriteAnimation();
            spriteAsObject	= new SpriteAnimation();
            isMoving		= false;
            pushDelay		= 20;
            properties		= new Properties();
            properties.PropertyObject = this;
            tileData		= null;
        }
コード例 #19
0
ファイル: TileData.cs プロジェクト: dreamsxin/ZeldaOracle
        //-----------------------------------------------------------------------------
        // Constructors
        //-----------------------------------------------------------------------------
        public TileData()
        {
            type				= null;
            size				= Point2I.One;
            flags				= TileFlags.Default;
            spriteList			= new SpriteAnimation[0];
            spriteAsObject		= new SpriteAnimation();
            breakAnimation		= null;
            collisionModel		= null;
            sheetLocation		= Point2I.Zero;
            tileset				= null;
            properties			= new Properties();

            properties.Set("id", "")
                .SetDocumentation("ID", "", "", "The id used to refer to this tile.", true, false);
            properties.Set("sprite_index", 0)
                .SetDocumentation("Sprite Index", "sprite_index", "", "The current sprite in the sprite list to draw.", true, true);
        }
コード例 #20
0
ファイル: TileData.cs プロジェクト: dreamsxin/ZeldaOracle
        public TileData(TileData copy)
            : this()
        {
            type				= copy.type;
            size				= copy.size;
            flags				= copy.flags;
            spriteList			= new SpriteAnimation[copy.spriteList.Length];
            spriteAsObject		= new SpriteAnimation(copy.spriteAsObject);
            breakAnimation		= copy.breakAnimation;
            collisionModel		= copy.collisionModel;
            sheetLocation		= copy.sheetLocation;
            tileset				= copy.tileset;
            properties			= new Properties();

            properties.Merge(copy.properties, true);

            for (int i = 0; i < spriteList.Length; i++)
                spriteList[i] = new SpriteAnimation(copy.spriteList[i]);
        }
コード例 #21
0
        void SetTileFlags(IntVector3 l, TileFlags flags, bool value)
        {
            Debug.Assert(this.IsInitialized);
            Debug.Assert(this.World.IsWritable);

            this.Version += 1;

            if (value)
            {
                m_tileGrid[l.Z, l.Y, l.X].Flags |= flags;
            }
            else
            {
                m_tileGrid[l.Z, l.Y, l.X].Flags &= ~flags;
            }

            var d = GetTileData(l);

            MapChanged(l, d);
        }
コード例 #22
0
        private float zVelocity; // Z-Velocity in pixels per frame.

        #endregion Fields

        #region Constructors

        //-----------------------------------------------------------------------------
        // Constructors
        //-----------------------------------------------------------------------------
        // By default, physics are disabled.
        public PhysicsComponent(Entity entity)
        {
            this.isEnabled			= false;
            this.flags				= PhysicsFlags.None;
            this.entity				= entity;
            this.velocity			= Vector2F.Zero;
            this.zVelocity			= 0.0f;
            this.gravity			= GameSettings.DEFAULT_GRAVITY;
            this.maxFallSpeed		= GameSettings.DEFAULT_MAX_FALL_SPEED;
            this.collisionBox		= new Rectangle2F(-4, -10, 8, 9);		// TEMPORARY: this is the player collision box.
            this.softCollisionBox	= new Rectangle2F(-6, -14, 12, 13);	// TEMPORARY: this is the player collision box.
            this.topTileFlags		= TileFlags.None;
            this.allTileFlags		= TileFlags.None;
            this.isColliding		= false;
            this.autoDodgeDistance	= 6;

            this.hasLanded			= false;

            this.collisionInfo = new CollisionInfo[Directions.Count];
            for (int i = 0; i < Directions.Count; i++)
                collisionInfo[i].Clear();
        }
コード例 #23
0
    /// <summary>
    /// Constructor
    /// </summary>
    /// <param name="name">Base name of the spriteset (png/txt pair)</param>
    /// <param name="index">Sprite index</param>
    /// <param name="x">Initial x coordinate in world space</param>
    /// <param name="y">Initial y coordinate in world space</param>
    public Player(string name, int index, int x, int y)
    {
        this.x = x;
        this.y = y;

        flags     = TileFlags.None;
        spriteset = Spriteset.FromFile(name);
        sprite    = Graphics.Engine.Sprites[index];
        sprite.Setup(spriteset, flags);
        orientation = Orientation.Right;
        jumping     = false;
        floor       = true;
        x_fix       = Fixed.Set(x);
        y_fix       = Fixed.Set(y);
        state       = State.Stand;

        SpriteInfo info;

        spriteset.GetInfo(0, out info);
        width  = info.W;
        height = info.H;
    }
コード例 #24
0
        void InitFlags()
        {
            Parallel.ForEach(this.Size.Plane.Range(), p =>
            {
                int d = GetSurfaceLevel(p);

                bool support = true;
                bool wall    = true;

                for (int z = 0; z < this.Size.Depth; ++z)
                {
                    // TerrainGen should not set any flags
                    Debug.Assert(m_tileGrid[z, p.Y, p.X].Flags == 0 || m_tileGrid[z, p.Y, p.X].Flags == TileFlags.Error);

                    TileFlags flags = 0;

                    if (z < d)
                    {
                        flags |= TileFlags.Subterranean;
                    }

                    if (support)
                    {
                        flags |= TileFlags.HasSupport;
                    }

                    if (wall)
                    {
                        flags |= TileFlags.HasWallBelow;
                    }

                    m_tileGrid[z, p.Y, p.X].Flags = flags;

                    support = m_tileGrid[z, p.Y, p.X].IsSupporting;
                    wall    = m_tileGrid[z, p.Y, p.X].IsWall;
                }
            });
        }
コード例 #25
0
        private static TileFlags ParseTileAttributes(ref ParsingTree parsingTree, ref ParsingStream stream, ref Tile tile, ParsingNode tileNode)
        {
            var           tileFlags = new TileFlags();
            NodeAttribute nodeAttribute;

            while (!stream.IsOver)
            {
                nodeAttribute = (NodeAttribute)stream.ReadByte();
                switch (nodeAttribute)
                {
                case NodeAttribute.TileFlags:
                    tileFlags = ParseTileFlags(ref stream);
                    break;

                case NodeAttribute.Item:
                    ParseTileItem(ref stream, ref tile, tileNode.Type == NodeType.HouseTile);
                    break;

                default:
                    throw new MalformedTileNodeException("Unknow node attribute " + nameof(nodeAttribute) + " of type " + nodeAttribute);
                }
            }

            foreach (var itemNode in tileNode.Children)
            {
                if (itemNode.Type != NodeType.Item)
                {
                    throw new MalformedItemNodeException();
                }

                var itemStream = new ParsingStream(parsingTree, itemNode);
                ParseTileItem(ref itemStream, ref tile, tileNode.Type == NodeType.HouseTile);
            }

            return(tileFlags);
        }
コード例 #26
0
ファイル: Tilengine.cs プロジェクト: megamarc/Tilengine
 /// <summary>
 /// 
 /// </summary>
 /// <param name="spriteset"></param>
 /// <param name="flags"></param>
 /// <returns></returns>
 public bool Setup(Spriteset spriteset, TileFlags flags)
 {
     return TLN_ConfigSprite(index, spriteset.ptr, flags);
 }
コード例 #27
0
ファイル: TileData.cs プロジェクト: dreamsxin/ZeldaOracle
        public void Clone(TileData copy)
        {
            type				= copy.type;
            size				= copy.size;
            flags				= copy.flags;
            breakAnimation		= copy.breakAnimation;
            collisionModel		= copy.collisionModel;
            properties			= new Properties();

            properties.Merge(copy.properties, true);
        }
コード例 #28
0
 public static TileFlags AddFlags(this TileFlags currentFlags, TileFlags flagsToSet)
 {
     return(currentFlags |= flagsToSet);
 }
コード例 #29
0
 public bool GetTileFlags(IntVector3 p, TileFlags flags)
 {
     return (GetTileData(p).Flags & flags) != 0;
 }
コード例 #30
0
        void SetTileFlags(IntVector3 l, TileFlags flags, bool value)
        {
            Debug.Assert(this.IsInitialized);
            Debug.Assert(this.World.IsWritable);

            this.Version += 1;

            if (value)
                m_tileGrid[l.Z, l.Y, l.X].Flags |= flags;
            else
                m_tileGrid[l.Z, l.Y, l.X].Flags &= ~flags;

            var d = GetTileData(l);

            MapChanged(l, d);
        }
コード例 #31
0
		private void FindPosition(TileFlags tileToFind)
		{
			var player = _context.GetPlayer(_currentPlayerId);
			var map = _context.GetMap(player.CurrentMap);
			var mapArea = CreateMapArea(map);

			_console2.DrawArea(CreatePlayerArea(player), mapArea.Width, 0);

			var found = map.AllPositions
			                  .Select(p => new {Position = p, Flags = (TileFlags) map.GetPositionValue(p)})
							  .FirstOrDefault(x => (x.Flags & tileToFind) > 0);

			if (found == null)
				return;
			_context.SetGoalForPlayer(player.Id, found.Position);
			var path = PathFinder.CalculatePath(player.Position, found.Position, map.IsWalkable);

			foreach (var pathPos in path)
			{
				var tile = GetTile(map.GetPositionValue(pathPos));
				mapArea.Write(tile.Character, pathPos.X, pathPos.Y, ConsoleColor.Green, ConsoleColor.DarkGreen);
			}

			mapArea.CenterOffset(found.Position.X, found.Position.Y);
			_console2.DrawArea(mapArea, 0, 0);

			Console.ReadKey(true);
		}
コード例 #32
0
ファイル: Tilengine.cs プロジェクト: rlugojr/Tilengine
 public static extern bool ConfigSprite(int nsprite, IntPtr spriteset, TileFlags flags);
コード例 #33
0
ファイル: Tilengine.cs プロジェクト: megamarc/Tilengine
 private static extern bool TLN_ConfigSprite(int nsprite, IntPtr spriteset, TileFlags flags);
コード例 #34
0
ファイル: Tilengine.cs プロジェクト: megamarc/Tilengine
 private static extern bool TLN_SetSpriteFlags(int nsprite, TileFlags flags);
コード例 #35
0
 public TilesetBuilder AddFlags(TileFlags flags)
 {
     tileData.Flags |= flags;
     return this;
 }
コード例 #36
0
 private extern void RemoveTileFlags_Injected(ref Vector3Int position, TileFlags flags);
コード例 #37
0
 public void AddTileFlags(Vector3Int position, TileFlags flags)
 {
     this.AddTileFlags_Injected(ref position, flags);
 }
コード例 #38
0
ファイル: Tilengine.cs プロジェクト: rlugojr/Tilengine
 public static extern bool SetSpriteFlags(int nsprite, TileFlags flags);
コード例 #39
0
 /// <summary>
 /// Clear navgrid tile flags.
 /// Does nothing if outside navgrid area.
 /// </summary>
 /// <param name="localPosition">Local navgrid position.</param>
 /// <param name="flags">Flags to unset.</param>
 public void ClearFlags(DFPosition localPosition, TileFlags flags)
 {
     ClearFlags(localPosition.X, localPosition.Y, flags);
 }
コード例 #40
0
ファイル: TileData.cs プロジェクト: trigger-death/ZeldaOracle
 public TileData(Type type, TileFlags flags)
     : this()
 {
     this.type = type;
     this.Flags = flags;
 }
コード例 #41
0
 /// <summary>
 /// Checks navgrid tile flags.
 /// Returns false is outside navgrid area.
 /// </summary>
 /// <param name="localPosition">Local navgrid position.</param>
 /// <param name="flags">Flags to check.</param>
 /// <returns>True if flags set, otherwise false.</returns>
 public bool HasFlags(DFPosition localPosition, TileFlags flags)
 {
     return(HasFlags(localPosition.X, localPosition.Y, flags));
 }
コード例 #42
0
ファイル: TileData.cs プロジェクト: trigger-death/ZeldaOracle
 public TileData(TileFlags flags)
     : this()
 {
     this.Flags = flags;
 }
コード例 #43
0
ファイル: Tile.cs プロジェクト: trigger-death/ZeldaOracle
 //-----------------------------------------------------------------------------
 // Flags
 //-----------------------------------------------------------------------------
 // Returns true if the tile has the normal flags.
 public bool HasFlag(TileFlags flags)
 {
     return Flags.HasFlag(flags);
 }
コード例 #44
0
 /// <summary>
 /// Check if this TileType has the specified flag
 /// </summary>
 /// <param name="tileFlag">TileFlag to check</param>
 /// <returns>True if TileType has flag</returns>
 public bool HasFlag(TileFlags tileFlag)
 {
     return _tileFlags.HasFlag(tileFlag);
 }
コード例 #45
0
        protected override void RecreateChunk(int cx, int cy)
        {
            var level = Level;

            var body = BodyFactory.CreateBody(Physics.World, Vector2.Zero);

            body.FixedRotation = true;
            body.UserData      = this;

            var i = cx + cy * cw;
            var c = chunks[i];

            if (c != null)
            {
                Physics.RemoveBody(c);
            }

            chunks[i] = body;

            var list = new List <Vector2>();

            for (int y = cy * ChunkSize; y < (cy + 1) * ChunkSize; y++)
            {
                for (int x = cx * ChunkSize; x < (cx + 1) * ChunkSize; x++)
                {
                    if (!level.IsInside(x, y))
                    {
                        continue;
                    }

                    var index = level.ToIndex(x, y);

                    var tile = level.Liquid[index];
                    var side = x == 0 || y == 0 || x == level.Width - 1 || y == level.Height - 1;

                    if (side || TileFlags.Matches(tile, TileFlags.Solid))
                    {
                        var sum = 0;

                        if (!side)
                        {
                            foreach (var dir in PathFinder.Neighbours8)
                            {
                                var n = dir + index;

                                if (level.IsInside(n) && (TileFlags.Matches(level.Tiles[n], TileFlags.Solid)))
                                {
                                    sum++;
                                }
                            }
                        }

                        if (sum == 8)
                        {
                            continue;
                        }

                        var xx = (x) * 16;
                        var yy = (y) * 16 - 8;

                        list.Clear();

                        const int v = 3;

                        list.Add(new Vector2(xx, yy + (Check(level, x, y - 1) ? 0 : 7 + v)));
                        list.Add(new Vector2(xx + 16, yy + (Check(level, x, y - 1) ? 0 : 7 + v)));
                        list.Add(new Vector2(xx + 16, yy + (Check(level, x, y + 1) ? 16 : 8 + v)));
                        list.Add(new Vector2(xx, yy + (Check(level, x, y + 1) ? 16 : 8 + v)));

                        try {
                            FixtureFactory.AttachPolygon(new Vertices(list), 1f, body);
                        } catch (Exception e) {
                            foreach (var p in list)
                            {
                                Log.Info($"{p.X - xx}:{p.Y - yy}");
                            }

                            Log.Error(e);
                        }
                    }
                }
            }
        }
コード例 #46
0
 /// <summary>
 /// Common constructor code
 /// </summary>
 private void Construct(byte tileFlags)
 {
     _tileFlags = (TileFlags)tileFlags;
 }
コード例 #47
0
 public static bool FlagsAreSet(this TileFlags currentFlags, TileFlags flagsToCheck)
 {
     return((currentFlags & flagsToCheck) != 0);
 }
コード例 #48
0
 //-----------------------------------------------------------------------------
 // Flags
 //-----------------------------------------------------------------------------
 public void SetFlags(TileFlags flagsToSet, bool enabled)
 {
     TileFlags flags = Flags;
     if (enabled)
         flags |= flagsToSet;
     else
         flags &= ~flagsToSet;
     Flags = flags;
 }
コード例 #49
0
 public static TileFlags RemoveFlags(this TileFlags currentFlags, TileFlags flagsToRemove)
 {
     return(currentFlags &= ~flagsToRemove);
 }
コード例 #50
0
        // Check the flags of the tiles the entity is located on top of (if it is on the ground).
        private void CheckGroundTiles()
        {
            topTileFlags = TileFlags.None;
            allTileFlags = TileFlags.None;

            Point2I location = entity.RoomControl.GetTileLocation(entity.Origin);
            if (entity.RoomControl.IsTileInBounds(location)) {
                for (int i = entity.RoomControl.Room.LayerCount - 1; i >= 0; i--) {
                    Tile tile = entity.RoomControl.GetTile(location, i);

                    if (tile != null) {
                        topTileFlags |= tile.Flags;
                        allTileFlags |= tile.Flags;
                        break;
                    }
                }
            }
        }
コード例 #51
0
 public void RemoveTileFlags(Vector3Int position, TileFlags flags)
 {
     this.RemoveTileFlags_Injected(ref position, flags);
 }
コード例 #52
0
 public bool GetTileFlags(IntPoint3 l, TileFlags flags)
 {
     return (m_tileGrid.GetFlags(l) & flags) != 0;
 }
コード例 #53
0
 internal void SetFlag(TileFlags f, bool value)
 {
     if (value)
         flags |= f;
     else
         flags &= ~f;
 }
コード例 #54
0
 public TilesetBuilder SetFlags(TileFlags flags)
 {
     tileData.Flags = flags;
     return this;
 }