/// <summary> /// Allows you to initalise the object, you should always run this right after creating that object, or else it wont exist. /// </summary> public void Initalise() { IsPassable = false; // Can you walk over it? IsDragable = false; // Can you drag it or push it around? IsTransparent = false; // Can you see through it. ObjectType = "ObjectTemplate"; // The type of the object. Basically what it would normally be called. ContentLoader.AddTexture("Wall", "Objects/Wall"); // Accosates the wall spritestate with the wall texture. SpriteState.Sprite = "Wall"; // Sets the sprite to the wall sprite we set earlier. InitaliseBace(); // InitaliseBase does a few things relating to rendering and updating position for you. Make sure this is last, as it does vairous things related to stuff you did earlier. }
/// <summary> /// Initalsies the tile, always run this, or this tile wont exist. /// </summary> public void Initalise() { LeakPercent = 100; // It is space, so it leaks 100% of the air there. Seed = ObjectName.GetHashCode(); // This will get a random seed that isn't dependant on the system time as much since it is dependant on 1 centeral RNG (Right now. This will change.) Random Random = new Random(Seed); SpriteNumber = Random.Next(NumberOfSprites); // Choses what icon is used for this tile. SpriteState.Sprite = "Space" + SpriteNumber.ToString(); // Sets the sprite to that icon. ContentLoader.AddTexture("Space" + SpriteNumber, "Objects/Turf/Space/" + SpriteNumber); ZeroToThree = Random.Next(4); SpriteState.Rotation = ZeroToThree * (float)1.57079633; // Creates 4 varations of each sprite by rotating them, reducing common patterns. OtherProperties.Remove("footheight"); OtherProperties.Add("lackofobject"); // lackofobject means that the object in question is more of the lack of an object than an object itself. InitaliseTurf(); // Does things relating to turfs. Like makes you able to walk on them and see through them. }