C# Class SunsetHigh.Character

Character extends from FreeMovingSprite, adding behavior for movement and inventory. Each character also has an Inventory (all his/her items).
Inheritance: FreeMovingSprite
Afficher le fichier Open project: ErraticUnicorn/MOSH Class Usage Examples

Méthodes publiques

Свойство Type Description
script Interaction

Méthodes publiques

Méthode Description
Character ( ) : System

Initializes a default Character at the origin which matches the dimensions of its sprite (when loaded)

Character ( int x, int y ) : System

Initializes a Character at the given position which matches the dimensions of its sprite (when loaded)

Character ( int x, int y, int width, int height, string file ) : System

Initializes a Character at the given position with the given dimensions

bothFacing ( Character other ) : bool

Checks if two Characters are facing each other

facing ( IInteractable other ) : bool

Checks if this Character is facing another Interactable (e.g. other Character); used as a check for talking action

getClique ( ) : Clique
getDirection ( ) : Direction
getName ( ) : string
getOppositeDirection ( ) : Direction

Returns the reverse direction of this Character's current direction; used for making Characters face each other when talking

getPersonID ( ) : PersonID
inRange ( IInteractable other, int offset ) : bool

Checks in this Character is within a given range with another Interactable to perform any action. The range is another rectangle a given number of pixels thicker than the sprite's drawing rectangle. E.g. talk to another character, pickup an item, collision detection

inRangeAction ( IInteractable other ) : bool

Checks if this Character is in a given range to perform an action such as talking or pickpocketing

inRangeCollide ( IInteractable other ) : bool

Checks if this Character is in a given range for collisions

isFemale ( ) : bool
isMale ( ) : bool
move ( Direction dir, float elapsed, bool collide = true ) : bool
move ( float angle, float elapsed, bool collide = true ) : bool
onInteract ( ) : void
pickup ( Pickup p ) : void

Adds the given Pickup to this Character's inventory (and the Pickup disappears)

setClique ( Clique clique ) : void
setDirection ( Direction dir ) : void

Sets the direction of this Character and updates which row on the spritesheet to animate

setMale ( bool male ) : void
setName ( string name ) : void
setPersonID ( PersonID id ) : void
setScript ( string file ) : void

Method Details

Character() public méthode

Initializes a default Character at the origin which matches the dimensions of its sprite (when loaded)
public Character ( ) : System
Résultat System

Character() public méthode

Initializes a Character at the given position which matches the dimensions of its sprite (when loaded)
public Character ( int x, int y ) : System
x int X coordinate of the top-left corner
y int Y coordinate of the top-left corner
Résultat System

Character() public méthode

Initializes a Character at the given position with the given dimensions
public Character ( int x, int y, int width, int height, string file ) : System
x int X coordinate of the top-left corner
y int Y coordinate of the top-left corner
width int Width in pixels
height int Height in pixels
file string
Résultat System

bothFacing() public méthode

Checks if two Characters are facing each other
public bothFacing ( Character other ) : bool
other Character The other Character
Résultat bool

facing() public méthode

Checks if this Character is facing another Interactable (e.g. other Character); used as a check for talking action
public facing ( IInteractable other ) : bool
other IInteractable The other Interactable
Résultat bool

getClique() public méthode

public getClique ( ) : Clique
Résultat Clique

getDirection() public méthode

public getDirection ( ) : Direction
Résultat Direction

getName() public méthode

public getName ( ) : string
Résultat string

getOppositeDirection() public méthode

Returns the reverse direction of this Character's current direction; used for making Characters face each other when talking
public getOppositeDirection ( ) : Direction
Résultat Direction

getPersonID() public méthode

public getPersonID ( ) : PersonID
Résultat PersonID

inRange() public méthode

Checks in this Character is within a given range with another Interactable to perform any action. The range is another rectangle a given number of pixels thicker than the sprite's drawing rectangle. E.g. talk to another character, pickup an item, collision detection
public inRange ( IInteractable other, int offset ) : bool
other IInteractable The other Interactable to range check against
offset int The pixels offset for the range check
Résultat bool

inRangeAction() public méthode

Checks if this Character is in a given range to perform an action such as talking or pickpocketing
public inRangeAction ( IInteractable other ) : bool
other IInteractable The other Sprite to range check against
Résultat bool

inRangeCollide() public méthode

Checks if this Character is in a given range for collisions
public inRangeCollide ( IInteractable other ) : bool
other IInteractable The other Sprite to range check against
Résultat bool

isFemale() public méthode

public isFemale ( ) : bool
Résultat bool

isMale() public méthode

public isMale ( ) : bool
Résultat bool

move() public méthode

public move ( Direction dir, float elapsed, bool collide = true ) : bool
dir Direction
elapsed float
collide bool
Résultat bool

move() public méthode

public move ( float angle, float elapsed, bool collide = true ) : bool
angle float
elapsed float
collide bool
Résultat bool

onInteract() public méthode

public onInteract ( ) : void
Résultat void

pickup() public méthode

Adds the given Pickup to this Character's inventory (and the Pickup disappears)
public pickup ( Pickup p ) : void
p Pickup The Pickup to add
Résultat void

setClique() public méthode

public setClique ( Clique clique ) : void
clique Clique
Résultat void

setDirection() public méthode

Sets the direction of this Character and updates which row on the spritesheet to animate
public setDirection ( Direction dir ) : void
dir Direction Direction of this Character
Résultat void

setMale() public méthode

public setMale ( bool male ) : void
male bool
Résultat void

setName() public méthode

public setName ( string name ) : void
name string
Résultat void

setPersonID() public méthode

public setPersonID ( PersonID id ) : void
id PersonID
Résultat void

setScript() public méthode

public setScript ( string file ) : void
file string
Résultat void

Property Details

script public_oe property

public Interaction,SunsetHigh script
Résultat Interaction