C# Класс PathfindingTest.Units.Unit

Наследование: OnCollisionChangedListener, Aggroable, Damageable
Показать файл Открыть проект Примеры использования класса

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

Свойство Тип Описание
isDead System.Boolean

Private Properties

Свойство Тип Описание
Draw void
DrawHealthBar void
Move void
SetMoveToTarget void
isTargetDead System.Boolean
isUnitDead System.Boolean

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

Метод Описание
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

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

Метод Описание
UpdateMovement ( ) : void

Updates the movement of this unit.

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

Метод Описание
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

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

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

public AttackBuilding ( Building enemyBuilding ) : void
enemyBuilding Building
Результат void

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

Sets the target to attack
public AttackUnit ( Unit unitToAttack ) : void
unitToAttack Unit
Результат void

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

Calculates a path between the current unit and the point.
public CalculatePath ( Point p ) : CustomArrayList
p Point The point to calculate to.
Результат CustomArrayList

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

Repels other units that dare come close to our unit!
public CheckCollision ( ) : void
Результат void

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

Updates the buildingsInRange variable, to contain all the buildings within the attack range of this unit.
public CheckForBuildingsInRange ( float rangeToCheck ) : void
rangeToCheck float
Результат void

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

Updates the enemiesInRange variable, to contain all the enemies within the attack range of this unit.
public CheckForEnemiesInRange ( float rangeToCheck ) : void
rangeToCheck float
Результат void

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

Sets the target to defend
public Defend ( Unit unitToDefend ) : void
unitToDefend Unit
Результат void

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

Defines the rectangle/hitbox for the Unit. With draw offset
public DefineDrawRectangle ( ) : Rectangle
Результат Microsoft.Xna.Framework.Rectangle

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

Defines the rectangle/hitbox for the Unit. without draw offset
public DefineRectangle ( ) : Rectangle
Результат Microsoft.Xna.Framework.Rectangle

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

Dispose of this unit.
public Dispose ( ) : void
Результат void

GetCost() публичный статический Метод

Gets the cost of a unit
public static GetCost ( Type t ) : int
t System.Type The unit type of which the cost is wanted
Результат int

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

Gets the draw rectangle of this unit.
public GetDrawRectangle ( ) : Rectangle
Результат Microsoft.Xna.Framework.Rectangle

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

Gets a point location of this unit
public GetLocation ( ) : Point
Результат Point

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

Feel free to use "\ <(*^_^*)> /"
public MoveToNow ( Point p ) : void
p Point The point to move to
Результат void

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

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
Результат void

OnAggro() публичный абстрактный Метод

public abstract OnAggro ( AggroEvent e ) : void
e PathfindingTest.Combat.AggroEvent
Результат void

OnAggroRecieved() публичный абстрактный Метод

public abstract OnAggroRecieved ( AggroEvent e ) : void
e PathfindingTest.Combat.AggroEvent
Результат void

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

public OnCollisionChangedListener ( CollisionChangedEvent collisionEvent ) : void
collisionEvent AStarCollisionMap.Collision.CollisionChangedEvent
Результат void

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

public OnDamage ( DamageEvent e ) : void
e PathfindingTest.Combat.DamageEvent
Результат void

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

public SetAssaultLocation ( Point assaultPoint ) : void
assaultPoint Point
Результат void

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

Set's the new Job for the unit
public SetJob ( Unit newJob ) : void
newJob Unit
Результат void

Swing() публичный абстрактный Метод

This unit will attempt to fire/swing/kill/cast!
public abstract Swing ( Damageable target ) : void
target Damageable
Результат void

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

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

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

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
Результат System

Update() публичный абстрактный Метод

public abstract Update ( KeyboardState ks, Microsoft.Xna.Framework.Input.MouseState ms ) : void
ks Microsoft.Xna.Framework.Input.KeyboardState
ms Microsoft.Xna.Framework.Input.MouseState
Результат void

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

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

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

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

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

Updates the movement of this unit.
protected UpdateMovement ( ) : void
Результат void

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

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

public Boolean,System isDead
Результат System.Boolean