コード例 #1
0
        public void CreatePreset_CreateDefaultTile_HasPresetTileProperties()
        {
            Tile presetTile = TileUtility.DefaultTile(m_Sprite) as Tile;

            Assert.IsNotNull(presetTile);

            presetTile.color = Color.red;

            var preset        = new Preset(presetTile);
            var defaultPreset = new DefaultPreset(String.Empty, preset);
            var presetType    = preset.GetPresetType();

            AssetDatabase.CreateAsset(preset, kPresetAssetPath);

            Preset.SetDefaultPresetsForType(presetType, new[] { defaultPreset });

            m_Tile = TileUtility.CreateDefaultTile();
            var tile = m_Tile as Tile;

            Assert.AreEqual(typeof(Tile), m_Tile.GetType());
            Assert.IsNotNull(tile);

            Assert.AreEqual(m_Sprite, tile.sprite);
            Assert.NotNull(tile.sprite);
            Assert.AreEqual(Color.red, tile.color);
            Assert.AreNotEqual(Color.white, tile.color);

            Object.DestroyImmediate(presetTile);
            Preset.SetDefaultPresetsForType(presetType, null);
        }
コード例 #2
0
        public void CreateDefaultTileWithSprite_HasDefaultTileProperties()
        {
            m_Tile = TileUtility.DefaultTile(m_Sprite);
            var tile = m_Tile as Tile;

            Assert.AreEqual(typeof(Tile), m_Tile.GetType());
            Assert.IsNotNull(tile);

            Assert.AreEqual(m_Sprite, tile.sprite);
            Assert.AreEqual(Color.white, tile.color);
        }