SpaceRTS - Starter Pack  1.3
NullPointerGame.BuildSystem.Builder Class Referenceabstract

GameEntityComponent that gives to the GameEntity the property of been able to build buildable entities. More...

Inheritance diagram for NullPointerGame.BuildSystem.Builder:
GameBase.GameEntityComponent NullPointerGame.BuildSystem.MobileBuilder NullPointerGame.BuildSystem.StaticBuilder

Classes

struct  BuildItem
 Struct info for each build item in the queue More...
 

Public Member Functions

virtual bool IsBuilding ()
 Returns true if this builder is actually working over a buildable. More...
 
void Build (UnitConfig toBuild)
 Request the 'toBuild' unit to be built. More...
 
void AddUnitToBuild (UnitConfig toBuild, Vector3 location, Vector3 dir)
 Adds a Unit of type UnitConfig to the build queue. More...
 
void SetupBuild (Buildable buildable)
 Sets the given buildable as as the current working target to build. More...
 
virtual bool CanBuildBeStarted ()
 Indicates if the current build work can be started More...
 
void CancelCurrentBuild ()
 Cancels the current build. More...
 
void CancelBuildAt (int index)
 Removes the build item from the queue, also cancel the build if index is zero. More...
 
bool CanBuild (Buildable buildable)
 Indicates if the buildable can be built by this builder. More...
 
Buildable CreateBuildable (UnitConfig toBuild, Vector3 location, Quaternion rotation, Transform parent)
 Creates the Buildable object with the visual module of the final object. This object should control the build process until it's finished. More...
 
- Public Member Functions inherited from GameBase.GameEntityComponent
virtual void OnVisualModuleSetted ()
 Called when the Visual Module is setted. Here we need to initialize all the component related functionality. More...
 
virtual void OnVisualModuleRemoved ()
 Called when the Visual Module is removed. Here we need to uninitialize all the component related functionality. More...
 

Public Attributes

Buildable constructPrefab
 The temporal prefab to use as gameplay controller for the constructed unit, until its finished. More...
 
List< UnitConfigbuildables = new List<UnitConfig>()
 List of Units that this one is capable of build. More...
 
float buildRate = 1.0f
 Means how many buildPoints will be built per second according with the Buildable.buildPoints. More...
 
Action BuildQueueChanged
 Triggered each time the internal build queue changes. More...
 
Action BuildStarted
 Triggered each time the build progress starts by any builder. More...
 
Action BuildCompleted
 Triggered after each build progress is completed. More...
 
Action UnableToBuild
 Triggered when the builder its about to build but one of the conditions has failed. More...
 
Action BuildCanceled
 Triggered after each build progress is canceled. More...
 

Protected Member Functions

virtual Transform GetBuildableParent ()
 Returns the transform that must be used as parent for the instantiated buildable. Must be overiden to change its behaviour, will use the builder's transform parent as default transform to be used as parent of the buildable. More...
 
abstract void OnBuildRequested (UnitConfig toBuild)
 
abstract void OnWorkOverBuildableRequested (Buildable buildable)
 overridable method to control how must procceed after a buildable was requested as next target to build. More...
 
void StartBuildProgress ()
 Starts the build progress for the current buildable target. More...
 
virtual void OnBuildCompleted ()
 
- Protected Member Functions inherited from GameBase.GameEntityComponent
virtual void SetupEntityComponent ()
 virtual class to be implemented. This will be called on the Awake to do a proper initialization of the component ensuring that the GameEntity thisEntity it's already defined at this point. Version 1.1: This will no longer be used in the future. Use instead OnVisualModuleSetted and OnVisualModuleRemoved. More...
 
virtual void OnValidate ()
 Called by unity when the script is reloaded. Here we setup the component and check that all is setted correctly. More...
 
GetSceneSystem< T > ()
 Shortcut for access a SceneSystem registered in the GameScene. More...
 
GetVisualProxyProperty< T > (string name)
 Shortcut for access the property located at the GameEntity visual module. More...
 
void LogsClear ()
 Clears all log messages More...
 
void Log (string message)
 Stores the message as a log that can be used later to show a warning in the editor or console. More...
 
void PushLogs ()
 Push all the stored logs to the console. More...
 

Protected Attributes

List< BuildItembuildQueue = new List<BuildItem>()
 Build queue holding the list of units to build. More...
 

Properties

bool HasTarget [get]
 has a buildable target assigned? More...
 
Buildable BuildTarget [get]
 Buildable target asigned to this builder. can be null if there is no buildable assigned. More...
 
abstract bool RemoveOnInterrupt [get]
 Indicated if the builder must delete the buildable unit when interrupted. More...
 
Vector3 RallyPointOffset [get]
 Offset from the Builder position to the rally point. Deprecated. Use BuildExpelLocation instead. More...
 
float UnitRadius [get, set]
 Means the radius of this builder unit. Its used to calculate distance between the builder and the buildable.
Probably it's not the proper place to have this property, maybe in a more spatialy related component. For now, its here because its the only one that its realy using it. More...
 
int BuildsInQueue [get]
 Indicates the current quantity of units to build in the queue. More...
 
Conditionals< BuildableBuildConditionals [get]
 A list of conditionals to check if its possible to start to build the buildable passed as parameter. only when all of this conditionals returns true then the construction will start. More...
 
IEnumerable< UnitConfigQueuedUnits [get]
 Enumerates the units to build in queue. More...
 
- Properties inherited from GameBase.GameEntityComponent
GameEntity ThisEntity [get]
 The GameEntity attached to this component. More...
 
MessageSink Messages [get]
 Shortcut for the Message sink located at the GameEntity attached to this component. More...
 
ComponentProxy VisualProxy [get]
 Shortcut for the ComponentProxy located at the GameEntity attached to this component. More...
 

Detailed Description

GameEntityComponent that gives to the GameEntity the property of been able to build buildable entities.

Member Function Documentation

◆ AddUnitToBuild()

void NullPointerGame.BuildSystem.Builder.AddUnitToBuild ( UnitConfig  toBuild,
Vector3  location,
Vector3  dir 
)

Adds a Unit of type UnitConfig to the build queue.

Parameters
toBuildUnit tye to be builded.
locationlocation where be built the unit.
dirFace direction that will have the builded unit once completed.

◆ Build()

void NullPointerGame.BuildSystem.Builder.Build ( UnitConfig  toBuild)

Request the 'toBuild' unit to be built.

Parameters
toBuildThe unit configuration to be built.

◆ CanBuild()

bool NullPointerGame.BuildSystem.Builder.CanBuild ( Buildable  buildable)

Indicates if the buildable can be built by this builder.

Parameters
buildableThe buildable to check.
Returns
true if this Builder is able to build the specified buildable; false in otherwise.

◆ CanBuildBeStarted()

virtual bool NullPointerGame.BuildSystem.Builder.CanBuildBeStarted ( )
virtual

Indicates if the current build work can be started

Returns

◆ CancelBuildAt()

void NullPointerGame.BuildSystem.Builder.CancelBuildAt ( int  index)

Removes the build item from the queue, also cancel the build if index is zero.

Parameters
index

◆ CancelCurrentBuild()

void NullPointerGame.BuildSystem.Builder.CancelCurrentBuild ( )

Cancels the current build.

◆ CreateBuildable()

Buildable NullPointerGame.BuildSystem.Builder.CreateBuildable ( UnitConfig  toBuild,
Vector3  location,
Quaternion  rotation,
Transform  parent 
)

Creates the Buildable object with the visual module of the final object. This object should control the build process until it's finished.

Parameters
toBuildThe config info of the object to build.
locationThe world coords of the object builded.
rotationThe rotation that will have the object during its build process.
parentThe parent transform fo the new created buildable entity.
Returns
The Buildable component of the object to build.

◆ GetBuildableParent()

virtual Transform NullPointerGame.BuildSystem.Builder.GetBuildableParent ( )
protectedvirtual

Returns the transform that must be used as parent for the instantiated buildable. Must be overiden to change its behaviour, will use the builder's transform parent as default transform to be used as parent of the buildable.

Returns
The transform that must be used as parent for the instantiated buildable.

Reimplemented in NullPointerGame.BuildSystem.StaticBuilder.

◆ IsBuilding()

virtual bool NullPointerGame.BuildSystem.Builder.IsBuilding ( )
virtual

Returns true if this builder is actually working over a buildable.

Returns

◆ OnBuildCompleted()

virtual void NullPointerGame.BuildSystem.Builder.OnBuildCompleted ( )
protectedvirtual

◆ OnBuildRequested()

abstract void NullPointerGame.BuildSystem.Builder.OnBuildRequested ( UnitConfig  toBuild)
protectedpure virtual

◆ OnWorkOverBuildableRequested()

abstract void NullPointerGame.BuildSystem.Builder.OnWorkOverBuildableRequested ( Buildable  buildable)
protectedpure virtual

overridable method to control how must procceed after a buildable was requested as next target to build.

Parameters
buildableThe buildable requested to build.

Implemented in NullPointerGame.BuildSystem.StaticBuilder, and NullPointerGame.BuildSystem.MobileBuilder.

◆ SetupBuild()

void NullPointerGame.BuildSystem.Builder.SetupBuild ( Buildable  buildable)

Sets the given buildable as as the current working target to build.

Parameters
buildablethe buildable to be used as target to build.

◆ StartBuildProgress()

void NullPointerGame.BuildSystem.Builder.StartBuildProgress ( )
protected

Starts the build progress for the current buildable target.

Member Data Documentation

◆ buildables

List<UnitConfig> NullPointerGame.BuildSystem.Builder.buildables = new List<UnitConfig>()

List of Units that this one is capable of build.

◆ BuildCanceled

Action NullPointerGame.BuildSystem.Builder.BuildCanceled

Triggered after each build progress is canceled.

◆ BuildCompleted

Action NullPointerGame.BuildSystem.Builder.BuildCompleted

Triggered after each build progress is completed.

◆ buildQueue

List<BuildItem> NullPointerGame.BuildSystem.Builder.buildQueue = new List<BuildItem>()
protected

Build queue holding the list of units to build.

◆ BuildQueueChanged

Action NullPointerGame.BuildSystem.Builder.BuildQueueChanged

Triggered each time the internal build queue changes.

◆ buildRate

float NullPointerGame.BuildSystem.Builder.buildRate = 1.0f

Means how many buildPoints will be built per second according with the Buildable.buildPoints.

◆ BuildStarted

Action NullPointerGame.BuildSystem.Builder.BuildStarted

Triggered each time the build progress starts by any builder.

◆ constructPrefab

Buildable NullPointerGame.BuildSystem.Builder.constructPrefab

The temporal prefab to use as gameplay controller for the constructed unit, until its finished.

◆ UnableToBuild

Action NullPointerGame.BuildSystem.Builder.UnableToBuild

Triggered when the builder its about to build but one of the conditions has failed.

Property Documentation

◆ BuildConditionals

Conditionals<Buildable> NullPointerGame.BuildSystem.Builder.BuildConditionals
get

A list of conditionals to check if its possible to start to build the buildable passed as parameter. only when all of this conditionals returns true then the construction will start.

◆ BuildsInQueue

int NullPointerGame.BuildSystem.Builder.BuildsInQueue
get

Indicates the current quantity of units to build in the queue.

◆ BuildTarget

Buildable NullPointerGame.BuildSystem.Builder.BuildTarget
get

Buildable target asigned to this builder. can be null if there is no buildable assigned.

◆ HasTarget

bool NullPointerGame.BuildSystem.Builder.HasTarget
get

has a buildable target assigned?

◆ QueuedUnits

IEnumerable<UnitConfig> NullPointerGame.BuildSystem.Builder.QueuedUnits
get

Enumerates the units to build in queue.

◆ RallyPointOffset

Vector3 NullPointerGame.BuildSystem.Builder.RallyPointOffset
get

Offset from the Builder position to the rally point. Deprecated. Use BuildExpelLocation instead.

◆ RemoveOnInterrupt

abstract bool NullPointerGame.BuildSystem.Builder.RemoveOnInterrupt
get

Indicated if the builder must delete the buildable unit when interrupted.

◆ UnitRadius

float NullPointerGame.BuildSystem.Builder.UnitRadius
getset

Means the radius of this builder unit. Its used to calculate distance between the builder and the buildable.
Probably it's not the proper place to have this property, maybe in a more spatialy related component. For now, its here because its the only one that its realy using it.