SpriteLibrary

SpritePayload Class

The SpritePayload is a stub of a class, for storing user-defined data and functions along with a sprite.
Inheritance Hierarchy
System
Object
SpriteLibrary
SpritePayload

Namespace: SpriteLibrary
Assembly: SpriteLibrary (in SpriteLibrary.dll) Version: 1.0.0.5 (1.0.0.5)
Syntax
C#
Copy

    public class SpritePayload

The SpritePayload type exposes the following members.

Constructors

| Name | Description
--- | --- | ---
| SpritePayload | Initializes a new instance of the SpritePayload class

Top
Methods

| Name | Description
--- | --- | ---
| Equals | Determines whether the specified object is equal to the current object. (Inherited from Object.)
| Finalize | Allows an object to try to free resources and perform other cleanup operations before it is reclaimed by garbage collection. (Inherited from Object.)
| GetHashCode | Serves as the default hash function. (Inherited from Object.)
| GetType | Gets the Type of the current instance. (Inherited from Object.)
| MemberwiseClone | Creates a shallow copy of the current Object. (Inherited from Object.)
| ToString | Returns a string that represents the current object. (Inherited from Object.)

Top
Examples
Basically, you want to "override" this class. You do this by making your own class that looks something like:
C#
Copy

    public class TankPayload : SpritePayload
    {
        public int Armor = 20;
        public int FireTime = 100;
    }

And then you add that to your sprite:
C#
Copy

    TankSprite.Payload = new TankPayload();

If there is no payload, then the payload property is null. If you have multiple types of SpritePayloads, you may need to do something like:
C#
Copy

    if(TankSprite.payload != null and TankSprite.payload is TankPayload)
    {
        TankPayload tPayload = (TankPayload)TankSprite.payload; tPayload.Armor--;
    }

See Also

#### Reference

SpriteLibrary Namespace