Esempio n. 1
0
 public void CopyValuesTo(TileLayer target)
 {
     target.Name     = this.Name;
     target.Opacity  = this.Opacity;
     target.TileData = this.TileData;
     target.Visible  = this.Visible;
     // we assume that the layer's array is already
     // correctly sized and initialized
     for (int i = 0; i < this._parent.TileCols; i++)
     {
         for (int j = 0; j < this._parent.TileRows; j++)
         {
             target.Tiles[i][j] = this.Tiles[i][j];
         }
     }
 }
Esempio n. 2
0
 private void CreateCollisionEntitiesForLayer(TileLayer layer)
 {
     for (int i = 0; i < _tileCols; i++)
     {
         for (int j = 0; j < _tileRows; j++)
         {
             layer.CreateCollisionDataForTile(i, j);
         }
     }
 }
Esempio n. 3
0
 public override void CopyValuesTo(SceneItem target)
 {
     base.CopyValuesTo(target);
     TileGrid tileGrid = target as TileGrid;
     tileGrid.TileSize = this.TileSize;
     tileGrid.TileCols = this.TileCols;           
     tileGrid.TileRows = this.TileRows;
     tileGrid.TileLayers = new List<TileLayer>();
     for (int i = 0; i < this.TileLayers.Count; i++)
     {
         TileLayer newLayer = new TileLayer(this.TileCols, this.TileRows);
         newLayer.Parent = tileGrid;
         this.TileLayers[i].CopyValuesTo(newLayer);
         tileGrid.TileLayers.Add(newLayer);
     }
     tileGrid.TileSheet = this.TileSheet;
 }
Esempio n. 4
0
 public void CopyValuesTo(TileLayer target)
 {
     target.Name = this.Name;
     target.Opacity = this.Opacity;
     target.TileData = this.TileData;
     target.Visible = this.Visible;
     // we assume that the layer's array is already
     // correctly sized and initialized
     for (int i = 0; i < this._parent.TileCols; i++)
     {
         for (int j = 0; j < this._parent.TileRows; j++)
         {
             target.Tiles[i][j] = this.Tiles[i][j];
         }
     }
 }  
Esempio n. 5
0
        internal SceneItem InstanciateNewItemOfType(SceneItemType type)
        {
            SceneItem item = null;
            switch (type)
            {
                case SceneItemType.AnimatedSprite:
                    item = new AnimatedSprite();
                    AnimatedSprite animatedSprite = item as AnimatedSprite;
                    animatedSprite.Material = SceneManager.GetEmbeddedTileGridMaterial();
                    AnimationInfo newAnim = new AnimationInfo("Counting");
                    newAnim.AnimationFrames.Add(new AnimationFrame(20, "1"));
                    newAnim.AnimationFrames.Add(new AnimationFrame(20, "2"));
                    newAnim.AnimationFrames.Add(new AnimationFrame(20, "3"));
                    newAnim.AnimationFrames.Add(new AnimationFrame(20, "4"));
                    animatedSprite.AddAnimation(newAnim);
                    animatedSprite.PlayAnimation("Counting");
                    break;
                case SceneItemType.ParticleEffect:
                    item = new ParticleEffect();
                    ParticleEffect effect = item as ParticleEffect;
                    IceCream.SceneItems.ParticlesClasses.ParticleType pType = new IceCream.SceneItems.ParticlesClasses.ParticleType();
                    pType.Material = SceneManager.GetEmbeddedParticleMaterial();                    
                    effect.Emitter.ParticleTypes.Add(pType);
                    effect.Name = "New Particle Effect";
                    effect.Play();
                    break;
                case SceneItemType.PostProcessingAnimation:
                    item = new PostProcessAnimation();
                    item.Layer = 1;
                    break;
                case SceneItemType.Sprite:
                    item = new Sprite();
                    Sprite sprite = item as Sprite;
                    sprite.Name = GetNewSpriteName(); ;
                    sprite.Material = SceneManager.GetEmbeddedParticleMaterial();
                    break;
                case SceneItemType.TextItem:
                    item = new TextItem();
                    TextItem text = item as TextItem;
                    text.Name = GetNewTextItemName();
                    text.Font = SceneManager.GetEmbeddedFont("DefaultFont");
                    break;
                case SceneItemType.TileGrid:
                    item = new TileGrid();
                    TileGrid tileGrid = item as TileGrid;
                    tileGrid.Name = "New Tile Grid";
                    tileGrid.Material = SceneManager.GetEmbeddedTileGridMaterial();

                    tileGrid.TileRows = 4;
                    tileGrid.TileCols = 10;
                    tileGrid.TileSize = new Microsoft.Xna.Framework.Point(32, 32);
                    TileLayer newLayer = new TileLayer(tileGrid.TileCols, tileGrid.TileRows);
                    newLayer.Parent = tileGrid;
                    newLayer.Visible = true;
                    newLayer.Name = "Layer 1";
                    for (int tx = 0; tx < tileGrid.TileCols; tx++)
                    {
                        for (int ty = 0; ty < tileGrid.TileRows; ty++)
                        {
                            newLayer.Tiles[tx][ty].Index = 0;
                        }
                    }
                    tileGrid.TileLayers.Add(newLayer);
                    break;       
                case SceneItemType.CompositeEntity:
                    item = new CompositeEntity();
                    CompositeEntity composite = item as CompositeEntity;
                    break;
                default:
                    item = new SceneItem();
                    break;
            }
            return item;
        }
Esempio n. 6
0
 private void toolStripButtonLayerAdd_Click(object sender, EventArgs e)
 {
     TileLayer newLayer = new TileLayer(TileGrid.TileCols, TileGrid.TileRows);
     newLayer.Name = "New Layer";
     newLayer.Visible = true;
     newLayer.Opacity = 255;
     newLayer.Parent = this.TileGrid;
     TileGrid.TileLayers.Insert(0, newLayer);
     RefreshLayerTable();
 }
Esempio n. 7
0
 private static void LoadTileGridSettings(XmlNode gridsettings, TileGrid tilegrid)
 {
     tilegrid.UseTilingSafeBorders = bool.Parse(gridsettings.SelectSingleNode("UseTilingSafeBorders").InnerText);
     tilegrid.TileRows = int.Parse(gridsettings.SelectSingleNode("TileRows").InnerText, CultureInfo.InvariantCulture);
     tilegrid.TileCols = int.Parse(gridsettings.SelectSingleNode("TileCols").InnerText, CultureInfo.InvariantCulture);
     SetProperty("TileSize", tilegrid, gridsettings);
     XmlNode _layers = gridsettings.SelectSingleNode("TileLayers");
     if (_layers != null)
     {
         tilegrid.TileLayers = new List<TileLayer>();
         foreach (XmlNode _layerNode in _layers.ChildNodes)
         {
             TileLayer layer = new TileLayer(tilegrid.TileCols, tilegrid.TileRows);
             layer.Name = _layerNode.Attributes["Name"].InnerText;
             layer.Visible = bool.Parse(_layerNode.Attributes["Visible"].InnerText);
             layer.TileData = _layerNode.InnerText;
             layer.Parent = tilegrid;
             tilegrid.TileLayers.Add(layer);
         }
     }
 }