Click or drag to resize
SpritePayload Class
The SpritePayload is a stub of a class, for storing user-defined data and functions along with a sprite.
Inheritance Hierarchy
SystemObject
  SpriteLibrarySpritePayload

Namespace:  SpriteLibrary
Assembly:  SpriteLibrary (in SpriteLibrary.dll) Version: 1.0.0.5 (1.0.0.5)
Syntax
C#
public class SpritePayload

The SpritePayload type exposes the following members.

Constructors
  NameDescription
Public methodSpritePayload
Initializes a new instance of the SpritePayload class
Top
Methods
  NameDescription
Public methodEquals
Determines whether the specified object is equal to the current object.
(Inherited from Object.)
Protected methodFinalize
Allows an object to try to free resources and perform other cleanup operations before it is reclaimed by garbage collection.
(Inherited from Object.)
Public methodGetHashCode
Serves as the default hash function.
(Inherited from Object.)
Public methodGetType
Gets the Type of the current instance.
(Inherited from Object.)
Protected methodMemberwiseClone
Creates a shallow copy of the current Object.
(Inherited from Object.)
Public methodToString
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#
public class TankPayload : SpritePayload 
{ 
    public int Armor = 20; 
    public int FireTime = 100; 
}
And then you add that to your sprite:
C#
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#
if(TankSprite.payload != null and TankSprite.payload is TankPayload) 
{ 
    TankPayload tPayload = (TankPayload)TankSprite.payload; tPayload.Armor--; 
}
See Also