C# Class PathfindingTest.Units.Unit

Inheritance: OnCollisionChangedListener, Aggroable, Damageable
Afficher le fichier Open project: Wotuu/RTS_XNA_v2 Class Usage Examples

Méthodes publiques

Свойство Type Description
isDead System.Boolean

Private Properties

Свойство Type Description
Draw void
DrawHealthBar void
Move void
SetMoveToTarget void
isTargetDead System.Boolean
isUnitDead System.Boolean

Méthodes publiques

Méthode Description
AttackBuilding ( Building enemyBuilding ) : void
AttackUnit ( Unit unitToAttack ) : void

Sets the target to attack

CalculatePath ( Point p ) : CustomArrayList

Calculates a path between the current unit and the point.

CheckCollision ( ) : void

Repels other units that dare come close to our unit!

CheckForBuildingsInRange ( float rangeToCheck ) : void

Updates the buildingsInRange variable, to contain all the buildings within the attack range of this unit.

CheckForEnemiesInRange ( float rangeToCheck ) : void

Updates the enemiesInRange variable, to contain all the enemies within the attack range of this unit.

Defend ( Unit unitToDefend ) : void

Sets the target to defend

DefineDrawRectangle ( ) : Rectangle

Defines the rectangle/hitbox for the Unit. With draw offset

DefineRectangle ( ) : Rectangle

Defines the rectangle/hitbox for the Unit. without draw offset

Dispose ( ) : void

Dispose of this unit.

GetCost ( Type t ) : int

Gets the cost of a unit

GetDrawRectangle ( ) : Rectangle

Gets the draw rectangle of this unit.

GetLocation ( ) : Point

Gets a point location of this unit

MoveToNow ( Point p ) : void

Feel free to use "\ <(*^_^*)> /"

MoveToQueue ( Point p ) : void

Moves to a point in a while, by placing this unit and the point in a queue. When the time is there, process the pathfind This method is preferred to MoveToNow(Point p), as it doesn't cause a performance peek, but it may take a few frames before your path is ready.

OnAggro ( AggroEvent e ) : void
OnAggroRecieved ( AggroEvent e ) : void
OnCollisionChangedListener ( CollisionChangedEvent collisionEvent ) : void
OnDamage ( DamageEvent e ) : void
SetAssaultLocation ( Point assaultPoint ) : void
SetJob ( Unit newJob ) : void

Set's the new Job for the unit

Swing ( Damageable target ) : void

This unit will attempt to fire/swing/kill/cast!

TryToSwing ( ) : void
Unit ( Player p, int x, int y, float movementSpeed, float attackRange, float aggroRange, float rateOfFire ) : System
Update ( KeyboardState ks, Microsoft.Xna.Framework.Input.MouseState ms ) : void
UpdateAttack ( ) : void
UpdateDefense ( ) : void

Méthodes protégées

Méthode Description
UpdateMovement ( ) : void

Updates the movement of this unit.

Private Methods

Méthode Description
Draw ( SpriteBatch sb ) : void
DrawHealthBar ( SpriteBatch sb ) : void
Move ( ) : void

Updates the drawing position of this Unit.

SetMoveToTarget ( int x, int y ) : void

Set the point this Unit has to move to. direction != direction is used for checking NaNExceptions.

isTargetDead ( ) : System.Boolean

Checks to see wether the set target has died yet.

isUnitDead ( Unit unit ) : System.Boolean

Method Details

AttackBuilding() public méthode

public AttackBuilding ( Building enemyBuilding ) : void
enemyBuilding Building
Résultat void

AttackUnit() public méthode

Sets the target to attack
public AttackUnit ( Unit unitToAttack ) : void
unitToAttack Unit
Résultat void

CalculatePath() public méthode

Calculates a path between the current unit and the point.
public CalculatePath ( Point p ) : CustomArrayList
p Point The point to calculate to.
Résultat CustomArrayList

CheckCollision() public méthode

Repels other units that dare come close to our unit!
public CheckCollision ( ) : void
Résultat void

CheckForBuildingsInRange() public méthode

Updates the buildingsInRange variable, to contain all the buildings within the attack range of this unit.
public CheckForBuildingsInRange ( float rangeToCheck ) : void
rangeToCheck float
Résultat void

CheckForEnemiesInRange() public méthode

Updates the enemiesInRange variable, to contain all the enemies within the attack range of this unit.
public CheckForEnemiesInRange ( float rangeToCheck ) : void
rangeToCheck float
Résultat void

Defend() public méthode

Sets the target to defend
public Defend ( Unit unitToDefend ) : void
unitToDefend Unit
Résultat void

DefineDrawRectangle() public méthode

Defines the rectangle/hitbox for the Unit. With draw offset
public DefineDrawRectangle ( ) : Rectangle
Résultat Microsoft.Xna.Framework.Rectangle

DefineRectangle() public méthode

Defines the rectangle/hitbox for the Unit. without draw offset
public DefineRectangle ( ) : Rectangle
Résultat Microsoft.Xna.Framework.Rectangle

Dispose() public méthode

Dispose of this unit.
public Dispose ( ) : void
Résultat void

GetCost() public static méthode

Gets the cost of a unit
public static GetCost ( Type t ) : int
t System.Type The unit type of which the cost is wanted
Résultat int

GetDrawRectangle() public méthode

Gets the draw rectangle of this unit.
public GetDrawRectangle ( ) : Rectangle
Résultat Microsoft.Xna.Framework.Rectangle

GetLocation() public méthode

Gets a point location of this unit
public GetLocation ( ) : Point
Résultat Point

MoveToNow() public méthode

Feel free to use "\ <(*^_^*)> /"
public MoveToNow ( Point p ) : void
p Point The point to move to
Résultat void

MoveToQueue() public méthode

Moves to a point in a while, by placing this unit and the point in a queue. When the time is there, process the pathfind This method is preferred to MoveToNow(Point p), as it doesn't cause a performance peek, but it may take a few frames before your path is ready.
public MoveToQueue ( Point p ) : void
p Point The point to move to, in a few frames depending on the queue
Résultat void

OnAggro() public abstract méthode

public abstract OnAggro ( AggroEvent e ) : void
e PathfindingTest.Combat.AggroEvent
Résultat void

OnAggroRecieved() public abstract méthode

public abstract OnAggroRecieved ( AggroEvent e ) : void
e PathfindingTest.Combat.AggroEvent
Résultat void

OnCollisionChangedListener() public méthode

public OnCollisionChangedListener ( CollisionChangedEvent collisionEvent ) : void
collisionEvent AStarCollisionMap.Collision.CollisionChangedEvent
Résultat void

OnDamage() public méthode

public OnDamage ( DamageEvent e ) : void
e PathfindingTest.Combat.DamageEvent
Résultat void

SetAssaultLocation() public méthode

public SetAssaultLocation ( Point assaultPoint ) : void
assaultPoint Point
Résultat void

SetJob() public méthode

Set's the new Job for the unit
public SetJob ( Unit newJob ) : void
newJob Unit
Résultat void

Swing() public abstract méthode

This unit will attempt to fire/swing/kill/cast!
public abstract Swing ( Damageable target ) : void
target Damageable
Résultat void

TryToSwing() public méthode

public TryToSwing ( ) : void
Résultat void

Unit() public méthode

public Unit ( Player p, int x, int y, float movementSpeed, float attackRange, float aggroRange, float rateOfFire ) : System
p PathfindingTest.Players.Player
x int
y int
movementSpeed float
attackRange float
aggroRange float
rateOfFire float
Résultat System

Update() public abstract méthode

public abstract Update ( KeyboardState ks, Microsoft.Xna.Framework.Input.MouseState ms ) : void
ks Microsoft.Xna.Framework.Input.KeyboardState
ms Microsoft.Xna.Framework.Input.MouseState
Résultat void

UpdateAttack() public méthode

public UpdateAttack ( ) : void
Résultat void

UpdateDefense() public méthode

public UpdateDefense ( ) : void
Résultat void

UpdateMovement() protected méthode

Updates the movement of this unit.
protected UpdateMovement ( ) : void
Résultat void

Property Details

isDead public_oe property

public Boolean,System isDead
Résultat System.Boolean