C# Класс SunsetHigh.Character

Character extends from FreeMovingSprite, adding behavior for movement and inventory. Each character also has an Inventory (all his/her items).
Наследование: FreeMovingSprite
Показать файл Открыть проект Примеры использования класса

Открытые свойства

Свойство Тип Описание
script Interaction

Открытые методы

Метод Описание
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

Описание методов

Character() публичный Метод

Initializes a default Character at the origin which matches the dimensions of its sprite (when loaded)
public Character ( ) : System
Результат System

Character() публичный Метод

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
Результат System

Character() публичный Метод

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
Результат System

bothFacing() публичный Метод

Checks if two Characters are facing each other
public bothFacing ( Character other ) : bool
other Character The other Character
Результат bool

facing() публичный Метод

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
Результат bool

getClique() публичный Метод

public getClique ( ) : Clique
Результат Clique

getDirection() публичный Метод

public getDirection ( ) : Direction
Результат Direction

getName() публичный Метод

public getName ( ) : string
Результат string

getOppositeDirection() публичный Метод

Returns the reverse direction of this Character's current direction; used for making Characters face each other when talking
public getOppositeDirection ( ) : Direction
Результат Direction

getPersonID() публичный Метод

public getPersonID ( ) : PersonID
Результат PersonID

inRange() публичный Метод

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
Результат bool

inRangeAction() публичный Метод

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
Результат bool

inRangeCollide() публичный Метод

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
Результат bool

isFemale() публичный Метод

public isFemale ( ) : bool
Результат bool

isMale() публичный Метод

public isMale ( ) : bool
Результат bool

move() публичный Метод

public move ( Direction dir, float elapsed, bool collide = true ) : bool
dir Direction
elapsed float
collide bool
Результат bool

move() публичный Метод

public move ( float angle, float elapsed, bool collide = true ) : bool
angle float
elapsed float
collide bool
Результат bool

onInteract() публичный Метод

public onInteract ( ) : void
Результат void

pickup() публичный Метод

Adds the given Pickup to this Character's inventory (and the Pickup disappears)
public pickup ( Pickup p ) : void
p Pickup The Pickup to add
Результат void

setClique() публичный Метод

public setClique ( Clique clique ) : void
clique Clique
Результат void

setDirection() публичный Метод

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
Результат void

setMale() публичный Метод

public setMale ( bool male ) : void
male bool
Результат void

setName() публичный Метод

public setName ( string name ) : void
name string
Результат void

setPersonID() публичный Метод

public setPersonID ( PersonID id ) : void
id PersonID
Результат void

setScript() публичный Метод

public setScript ( string file ) : void
file string
Результат void

Описание свойств

script публичное свойство

public Interaction,SunsetHigh script
Результат Interaction