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.6 (1.0.0.6)
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 (Inherited from Object.)
Protected methodFinalize (Inherited from Object.)
Public methodGetHashCode (Inherited from Object.)
Public methodGetType (Inherited from Object.)
Protected methodMemberwiseClone (Inherited from Object.)
Public methodToString (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