Esempio n. 1
0
 internal Size GetFoundation(NamedObject v)
 {
     if (_buildingTypes.HasObject(v))
     {
         return(_buildingTypes.GetDrawable(v).Foundation);
     }
     else
     {
         return(_overlayTypes.GetDrawable(v).Foundation);
     }
 }
Esempio n. 2
0
        public void InitAnimations(ObjectCollection animations)
        {
            // the remaining sections contain animations to be attached to certain tiles
            for (int j = _animsSectionsStartIdx; j < _theaterIni.Sections.Count; j++)
            {
                var extraSection = _theaterIni.Sections[j];
                var tileSet      = _tileSets.Find(ts => ts.SetName == extraSection.Name);
                if (tileSet == null)
                {
                    continue;
                }

                for (int a = 1; a <= tileSet.TilesInSet; a++)
                {
                    string n        = string.Format("Tile{0:d2}", a);
                    string anim     = extraSection.ReadString(n + "Anim");
                    var    drawable = animations.GetDrawable(anim);

                    if (string.IsNullOrEmpty(anim) || drawable == null)
                    {
                        Logger.Trace("Missing anim {0} ({1}) for tileset {2}", anim, n, tileSet.SetName);
                        continue;
                    }

                    // clone, so that the tile-specific offset doesn't require setting on the original
                    // drawable, meaning it can be reused
                    var drawableClone = drawable.Clone();

                    // in pixels
                    int attachTo = extraSection.ReadInt(n + "AttachesTo");
                    var offset   = new Point(extraSection.ReadInt(n + "XOffset"), extraSection.ReadInt(n + "YOffset"));
                    drawableClone.Props.Offset.Offset(offset.X, offset.Y);
                    drawableClone.Props.ZAdjust = extraSection.ReadInt(n + "ZAdjust");
                    tileSet.Entries[a - 1].AddAnimation(attachTo, drawableClone);
                }
            }
        }
Esempio n. 3
0
		public void InitAnimations(ObjectCollection animations) {
			// the remaining sections contain animations to be attached to certain tiles
			for (int j = _animsSectionsStartIdx; j < _theaterIni.Sections.Count; j++) {
				var extraSection = _theaterIni.Sections[j];
				var tileSet = _tileSets.Find(ts => ts.SetName == extraSection.Name);
				if (tileSet == null) continue;

				for (int a = 1; a <= tileSet.TilesInSet; a++) {
					string n = string.Format("Tile{0:d2}", a);
					string anim = extraSection.ReadString(n + "Anim");
					var drawable = animations.GetDrawable(anim);

					if (string.IsNullOrEmpty(anim) || drawable == null) {
						Logger.Trace("Missing anim {0} ({1}) for tileset {2}", anim, n, tileSet.SetName);
						continue;
					}

					// clone, so that the tile-specific offset doesn't require setting on the original 
					// drawable, meaning it can be reused
					drawable = drawable.Clone();

					// in pixels
					int attachTo = extraSection.ReadInt(n + "AttachesTo");
					var offset = new Point(extraSection.ReadInt(n + "XOffset"), extraSection.ReadInt(n + "YOffset"));
					drawable.Props.Offset.Offset(offset.X, offset.Y);
					tileSet.Entries[a - 1].AddAnimation(attachTo, drawable);
				}
			}
		}