C# Класс Gruppe22.Backend.Actor

A living entity (backend) for example the player
Показать файл Открыть проект Примеры использования класса

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

Свойство Тип Описание
_quicklist List

Защищенные свойства (Protected)

Свойство Тип Описание
_GUID string
_abilities List
_abilityPoints int
_actorType ActorType
_aggro bool
_animationFile string
_armor int
_block int
_charmed int
_checkPointCoords Coords
_crazy bool
_damage int
_destroyArmor int
_destroyWeapon int
_direction Direction
_evade int
_exp int
_expNeeded int
_fireDamage int
_fireDefense int
_friendly bool
_gold int
_health int
_healthReg int
_iceDamage int
_iceDefense int
_id int
_inventory List
_lastCheckpoint int
_level int
_lives int
_locked bool
_mana int
_manaReg int
_maxMana int
_maxhealth int
_name string
_newItems int
_online bool
_penetrate int
_random System.Random
_ranged bool
_regCounter int
_resist int
_scared int
_skills int
_stealHealth int
_stealMana int
_stunned int
_tile ActorTile
_viewRange int

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

Метод Описание
Actor ( ActorType actorType, int health, int armor, int damage, int maxHealth = -1, string name = "", Random rnd = null, string animationFile = "", int level = -1 ) : System

The constructor used for actors. Sets default values for the most important properties.

AddHealth ( int amount ) : void

Method to let the player get some health back

AddItem ( Item item ) : void

Add new item to inventory

AddProtection ( int amount ) : void

Method to increase the amount of armor an actor has. Does not change anything if armor>amount

AddStrength ( int amount ) : void

Method to directly increase the damage an actor deals. Does nothing if damage>amount.

FromXML ( string input ) : Actor

Get character data from an XML-string

GenerateName ( string filename ) : string

Method to choose an random actor name from a file.

GenerateName ( ) : void

Method to generate a random actor name. Uses GenerateName() for files if a file exists. Otherwise chooses one of six random names.

HasKey ( int level ) : bool

Methode to determine if the player has the key to the next level.

Items ( int i ) : Item

Method to get the items an actor has.

LevelUp ( ) : void

Method called when the exp reach the needed exp. Lets the player level up. The actor gains abilitypoints, skills and his health is set to maxhealth. Also the needed exp increase for the next level.

Load ( XmlReader reader ) : void

Method to read actor properties from a XML-file.

Regen ( ) : void

Method to let the player regenerate mana and health.

Save ( XmlWriter writer ) : void

Method to save an actor in an XML-file. Just writes every property to the file.

ToString ( ) : string

Changed ToString Method for the actor's name.

ToXML ( ) : string

Write all data as an XML-string

copyFrom ( Actor a ) : void

Duplicates the properties of actor a to the current actor.

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

Actor() публичный метод

The constructor used for actors. Sets default values for the most important properties.
public Actor ( ActorType actorType, int health, int armor, int damage, int maxHealth = -1, string name = "", Random rnd = null, string animationFile = "", int level = -1 ) : System
actorType ActorType Player, NPC oder Enemy
health int Standardwert 15+random(30) or 5+random(maxhealth-5) if maxhealth is passed
armor int default random(10)
damage int default 12+random(10)
maxHealth int default = health
name string uses GenerateName() by default
rnd System.Random a random used to generate the actors starting values
animationFile string the file used to display the actor
level int the default starting level is 1
Результат System

AddHealth() публичный метод

Method to let the player get some health back
public AddHealth ( int amount ) : void
amount int The amount of healthpoints that should be added
Результат void

AddItem() публичный метод

Add new item to inventory
public AddItem ( Item item ) : void
item Item The item to add to inventory
Результат void

AddProtection() публичный метод

Method to increase the amount of armor an actor has. Does not change anything if armor>amount
public AddProtection ( int amount ) : void
amount int the new amount the armor the actor should have
Результат void

AddStrength() публичный метод

Method to directly increase the damage an actor deals. Does nothing if damage>amount.
public AddStrength ( int amount ) : void
amount int The new amount of damage the actor should deal
Результат void

FromXML() публичный метод

Get character data from an XML-string
public FromXML ( string input ) : Actor
input string
Результат Actor

GenerateName() публичный метод

Method to choose an random actor name from a file.
public GenerateName ( string filename ) : string
filename string The file with one name per line
Результат string

GenerateName() публичный метод

Method to generate a random actor name. Uses GenerateName() for files if a file exists. Otherwise chooses one of six random names.
public GenerateName ( ) : void
Результат void

HasKey() публичный метод

Methode to determine if the player has the key to the next level.
public HasKey ( int level ) : bool
level int The level for which the key is checked.
Результат bool

Items() публичный метод

Method to get the items an actor has.
public Items ( int i ) : Item
i int The id of the item
Результат Item

LevelUp() публичный метод

Method called when the exp reach the needed exp. Lets the player level up. The actor gains abilitypoints, skills and his health is set to maxhealth. Also the needed exp increase for the next level.
public LevelUp ( ) : void
Результат void

Load() публичный метод

Method to read actor properties from a XML-file.
public Load ( XmlReader reader ) : void
reader XmlReader The used XMLReader for reading the actor.
Результат void

Regen() публичный метод

Method to let the player regenerate mana and health.
public Regen ( ) : void
Результат void

Save() публичный метод

Method to save an actor in an XML-file. Just writes every property to the file.
public Save ( XmlWriter writer ) : void
writer System.Xml.XmlWriter The writer which should be used to save the data
Результат void

ToString() публичный метод

Changed ToString Method for the actor's name.
public ToString ( ) : string
Результат string

ToXML() публичный метод

Write all data as an XML-string
public ToXML ( ) : string
Результат string

copyFrom() публичный метод

Duplicates the properties of actor a to the current actor.
public copyFrom ( Actor a ) : void
a Actor The actor from which the properties should be cloned
Результат void

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

_GUID защищенное свойство

A unique identity used in online games
protected string _GUID
Результат string

_abilities защищенное свойство

protected List _abilities
Результат List

_abilityPoints защищенное свойство

protected int _abilityPoints
Результат int

_actorType защищенное свойство

protected ActorType _actorType
Результат ActorType

_aggro защищенное свойство

protected bool _aggro
Результат bool

_animationFile защищенное свойство

protected string _animationFile
Результат string

_armor защищенное свойство

protected int _armor
Результат int

_block защищенное свойство

protected int _block
Результат int

_charmed защищенное свойство

protected int _charmed
Результат int

_checkPointCoords защищенное свойство

Coordinates of last checkpoint
protected Coords _checkPointCoords
Результат Coords

_crazy защищенное свойство

protected bool _crazy
Результат bool

_damage защищенное свойство

protected int _damage
Результат int

_destroyArmor защищенное свойство

protected int _destroyArmor
Результат int

_destroyWeapon защищенное свойство

protected int _destroyWeapon
Результат int

_direction защищенное свойство

protected Direction _direction
Результат Direction

_evade защищенное свойство

protected int _evade
Результат int

_exp защищенное свойство

protected int _exp
Результат int

_expNeeded защищенное свойство

protected int _expNeeded
Результат int

_fireDamage защищенное свойство

protected int _fireDamage
Результат int

_fireDefense защищенное свойство

protected int _fireDefense
Результат int

_friendly защищенное свойство

protected bool _friendly
Результат bool

_gold защищенное свойство

protected int _gold
Результат int

_health защищенное свойство

protected int _health
Результат int

_healthReg защищенное свойство

protected int _healthReg
Результат int

_iceDamage защищенное свойство

protected int _iceDamage
Результат int

_iceDefense защищенное свойство

protected int _iceDefense
Результат int

_id защищенное свойство

protected int _id
Результат int

_inventory защищенное свойство

protected List _inventory
Результат List

_lastCheckpoint защищенное свойство

protected int _lastCheckpoint
Результат int

_level защищенное свойство

protected int _level
Результат int

_lives защищенное свойство

Number of lives (ressurection)
protected int _lives
Результат int

_locked защищенное свойство

protected bool _locked
Результат bool

_mana защищенное свойство

protected int _mana
Результат int

_manaReg защищенное свойство

protected int _manaReg
Результат int

_maxMana защищенное свойство

protected int _maxMana
Результат int

_maxhealth защищенное свойство

protected int _maxhealth
Результат int

_name защищенное свойство

protected string _name
Результат string

_newItems защищенное свойство

protected int _newItems
Результат int

_online защищенное свойство

Determines whether player is available
protected bool _online
Результат bool

_penetrate защищенное свойство

protected int _penetrate
Результат int

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

public List _quicklist
Результат List

_random защищенное свойство

A random number generator
protected Random,System _random
Результат System.Random

_ranged защищенное свойство

protected bool _ranged
Результат bool

_regCounter защищенное свойство

Internal counter for regeneration of health or mana
protected int _regCounter
Результат int

_resist защищенное свойство

protected int _resist
Результат int

_scared защищенное свойство

protected int _scared
Результат int

_skills защищенное свойство

protected int _skills
Результат int

_stealHealth защищенное свойство

protected int _stealHealth
Результат int

_stealMana защищенное свойство

protected int _stealMana
Результат int

_stunned защищенное свойство

protected int _stunned
Результат int

_tile защищенное свойство

protected ActorTile _tile
Результат ActorTile

_viewRange защищенное свойство

protected int _viewRange
Результат int