C# 클래스 LifeSimulation.Core.Lifelet

The Lifelet class represents a single lifeform in the simulation.
파일 보기 프로젝트 열기: dankrusi/life-simulation-challenge 1 사용 예제들

공개 메소드들

메소드 설명
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