C# 클래스 SimpleSoccer.Net.SoccerBall

상속: MovingEntity
파일 보기 프로젝트 열기: soshimozi/SimpleSoccer.Net 1 사용 예제들

공개 메소드들

메소드 설명
AddNoiseToKick ( Vector2D BallPos, Vector2D BallTarget ) : Vector2D

this can be used to vary the accuracy of a player's kick. Just call it prior to kicking the ball using the ball's position and the ball target as parameters.

CalculateFuturePosition ( double time ) : Vector2D

Given a time this method returns the ball position at that time in the future

CalucateTimeToCoverDistance ( Vector2D A, Vector2D B, double force ) : double

Given a force and a distance to cover given by two vectors, this method calculates how long it will take the ball to travel between the two points

Kick ( Vector2D direction, double force ) : void

applys a force to the ball in the direction of heading. Truncates the new velocity to make sure it doesn't exceed the max allowable.

PlaceAtPosition ( Vector2D NewPos ) : void

positions the ball at the desired location and sets the ball's velocity to zero

Render ( Graphics g ) : void
SoccerBall ( Vector2D position, double ballSize, double mass, List pitchBoundary ) : System
TestCollisionWithWalls ( List walls ) : void

Tests to see if the ball has collided with a ball and reflects the ball's velocity accordingly

Trap ( ) : void
Update ( ) : void

updates the ball physics, tests for any collisions and adjusts the ball's velocity accordingly

비공개 메소드들

메소드 설명
RandomClamp ( ) : double

returns a random double in the range -1 < n < 1

메소드 상세

AddNoiseToKick() 공개 정적인 메소드

this can be used to vary the accuracy of a player's kick. Just call it prior to kicking the ball using the ball's position and the ball target as parameters.
public static AddNoiseToKick ( Vector2D BallPos, Vector2D BallTarget ) : Vector2D
BallPos Vector2D
BallTarget Vector2D
리턴 Vector2D

CalculateFuturePosition() 공개 메소드

Given a time this method returns the ball position at that time in the future
public CalculateFuturePosition ( double time ) : Vector2D
time double
리턴 Vector2D

CalucateTimeToCoverDistance() 공개 메소드

Given a force and a distance to cover given by two vectors, this method calculates how long it will take the ball to travel between the two points
public CalucateTimeToCoverDistance ( Vector2D A, Vector2D B, double force ) : double
A Vector2D
B Vector2D
force double
리턴 double

Kick() 공개 메소드

applys a force to the ball in the direction of heading. Truncates the new velocity to make sure it doesn't exceed the max allowable.
public Kick ( Vector2D direction, double force ) : void
direction Vector2D
force double
리턴 void

PlaceAtPosition() 공개 메소드

positions the ball at the desired location and sets the ball's velocity to zero
public PlaceAtPosition ( Vector2D NewPos ) : void
NewPos Vector2D
리턴 void

Render() 공개 메소드

public Render ( Graphics g ) : void
g System.Drawing.Graphics
리턴 void

SoccerBall() 공개 메소드

public SoccerBall ( Vector2D position, double ballSize, double mass, List pitchBoundary ) : System
position Vector2D
ballSize double
mass double
pitchBoundary List
리턴 System

TestCollisionWithWalls() 공개 메소드

Tests to see if the ball has collided with a ball and reflects the ball's velocity accordingly
public TestCollisionWithWalls ( List walls ) : void
walls List
리턴 void

Trap() 공개 메소드

public Trap ( ) : void
리턴 void

Update() 공개 메소드

updates the ball physics, tests for any collisions and adjusts the ball's velocity accordingly
public Update ( ) : void
리턴 void