C# Класс LifeSimulation.Core.Lifelet

The Lifelet class represents a single lifeform in the simulation.
Показать файл Открыть проект Примеры использования класса

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

Метод Описание
Distance ( Lifelet other ) : double

Measures the distance from this lifelet to another.

Distance ( ShelledLifelet other ) : double

Measures the distance from this lifelet to another.

Distance ( Vector point ) : double

Measures the distance from this lifelet to a specific point.

Draw ( Graphics g ) : void

Draws the current state of the lifelet to the graphics context.

Lifelet ( World world, Vector pos ) : System

Initializes a new instance of the LifeSimulation.Core.Lifelet class.

PrepareSimulate ( ) : void

Prepares a lifelet for simulation by an extending class.

Shell ( ) : ShelledLifelet
Simulate ( ) : void

Simulate this instance for one timestep. Extending classes must call base.Simulate() otherwise they are disqualified.

VerifyIntegrity ( ) : void

Защищенные методы

Метод Описание
attack ( ShelledLifelet other, double amount ) : void

Attacks another lifelet with the given amount of energy.

audibleMessages ( ) : List

Returns all audible messages.

closestLifelet ( ) : ShelledLifelet

Returns the closest visible lifelet.

debugDraw ( Graphics g ) : void
getLifeletByUID ( long uid ) : ShelledLifelet

Returns the visible lifelet by UID.

giveEnergy ( ShelledLifelet other, double amount ) : void

Gives a specific amount of energy to another lifelet.

move ( Vector v ) : void

Sets a request to move the lifelet with the given velocity.

moveRandomly ( double speed ) : void

Sets a request to move the lifelet randomly with the given speed.

moveToDestination ( Vector destination, double speed ) : void

Sets a request to move the lifelet in the direction of destination with the given speed.

talk ( char message ) : void

Creates a new message originating from this lifelet.

visibleFood ( ) : List

Returns all visible food.

visibleLifelets ( ) : List

Returns all visible lifelets.

Приватные методы

Метод Описание
die ( ) : void
recieveAttack ( Lifelet sender, double amount ) : void
recieveEnergy ( Lifelet sender, double amount ) : void

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

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

Measures the distance from this lifelet to another.
public Distance ( Lifelet other ) : double
other Lifelet
Результат double

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

Measures the distance from this lifelet to another.
public Distance ( ShelledLifelet other ) : double
other ShelledLifelet
Результат double

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

Measures the distance from this lifelet to a specific point.
public Distance ( Vector point ) : double
point Vector
Результат double

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

Draws the current state of the lifelet to the graphics context.
public Draw ( Graphics g ) : void
g System.Drawing.Graphics
Результат void

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

Initializes a new instance of the LifeSimulation.Core.Lifelet class.
public Lifelet ( World world, Vector pos ) : System
world World
pos Vector
Результат System

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

Prepares a lifelet for simulation by an extending class.
public PrepareSimulate ( ) : void
Результат void

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

public Shell ( ) : ShelledLifelet
Результат ShelledLifelet

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

Simulate this instance for one timestep. Extending classes must call base.Simulate() otherwise they are disqualified.
public Simulate ( ) : void
Результат void

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

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

attack() защищенный Метод

Attacks another lifelet with the given amount of energy.
protected attack ( ShelledLifelet other, double amount ) : void
other ShelledLifelet
amount double
Результат void

audibleMessages() защищенный Метод

Returns all audible messages.
protected audibleMessages ( ) : List
Результат List

closestLifelet() защищенный Метод

Returns the closest visible lifelet.
protected closestLifelet ( ) : ShelledLifelet
Результат ShelledLifelet

debugDraw() защищенный Метод

protected debugDraw ( Graphics g ) : void
g System.Drawing.Graphics
Результат void

getLifeletByUID() защищенный Метод

Returns the visible lifelet by UID.
protected getLifeletByUID ( long uid ) : ShelledLifelet
uid long
Результат ShelledLifelet

giveEnergy() защищенный Метод

Gives a specific amount of energy to another lifelet.
protected giveEnergy ( ShelledLifelet other, double amount ) : void
other ShelledLifelet
amount double
Результат void

move() защищенный Метод

Sets a request to move the lifelet with the given velocity.
protected move ( Vector v ) : void
v Vector
Результат void

moveRandomly() защищенный Метод

Sets a request to move the lifelet randomly with the given speed.
protected moveRandomly ( double speed ) : void
speed double
Результат void

moveToDestination() защищенный Метод

Sets a request to move the lifelet in the direction of destination with the given speed.
protected moveToDestination ( Vector destination, double speed ) : void
destination Vector
speed double
Результат void

talk() защищенный Метод

Creates a new message originating from this lifelet.
protected talk ( char message ) : void
message char
Результат void

visibleFood() защищенный Метод

Returns all visible food.
protected visibleFood ( ) : List
Результат List

visibleLifelets() защищенный Метод

Returns all visible lifelets.
protected visibleLifelets ( ) : List
Результат List