using System; using System.Collections.Generic; using System.Linq; using System.Text; using VBXSE; namespace LD31 { public class Object : TileOrObject { public static Dictionary baseObjects; public Object() { name = "Unknown"; spriteName = "questionmark"; } public Object(string name, bool createSprite = true) { if(baseObjects.ContainsKey(name)) { Object baseObject = baseObjects[name]; this.name = baseObject.name; this.possibleSprites = baseObject.possibleSprites; this.spriteName = possibleSprites[Main.random.Next(possibleSprites.Length)]; //Copy properties for (int i = 0; i < baseObject.properties.Count; i++) { this.properties.Add(baseObject.properties[i]); } //Copy scripts this.useScript = baseObject.useScript; foreach (KeyValuePair kp in baseObject.combinationScripts) { this.combinationScripts.Add(kp.Key, kp.Value); } this.updateScript = baseObject.updateScript; foreach (KeyValuePair kp in baseObject.namedScripts) { this.namedScripts.Add(kp.Key, kp.Value); } } if (createSprite) { this.sprite = Main.CreateSprite(spriteName); } } } }