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
Datei anzeigen Open project: ErraticUnicorn/MOSH Class Usage Examples

Public Properties

Property Type Description
script Interaction

Public Methods

Method 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 method

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

Character() public method

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
return System

Character() public method

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
return System

bothFacing() public method

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

facing() public method

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
return bool

getClique() public method

public getClique ( ) : Clique
return Clique

getDirection() public method

public getDirection ( ) : Direction
return Direction

getName() public method

public getName ( ) : string
return string

getOppositeDirection() public method

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

getPersonID() public method

public getPersonID ( ) : PersonID
return PersonID

inRange() public method

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
return bool

inRangeAction() public method

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
return bool

inRangeCollide() public method

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
return bool

isFemale() public method

public isFemale ( ) : bool
return bool

isMale() public method

public isMale ( ) : bool
return bool

move() public method

public move ( Direction dir, float elapsed, bool collide = true ) : bool
dir Direction
elapsed float
collide bool
return bool

move() public method

public move ( float angle, float elapsed, bool collide = true ) : bool
angle float
elapsed float
collide bool
return bool

onInteract() public method

public onInteract ( ) : void
return void

pickup() public method

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

setClique() public method

public setClique ( Clique clique ) : void
clique Clique
return void

setDirection() public method

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
return void

setMale() public method

public setMale ( bool male ) : void
male bool
return void

setName() public method

public setName ( string name ) : void
name string
return void

setPersonID() public method

public setPersonID ( PersonID id ) : void
id PersonID
return void

setScript() public method

public setScript ( string file ) : void
file string
return void

Property Details

script public_oe property

public Interaction,SunsetHigh script
return Interaction