SpaceRTS - Starter Pack  1.3
NullPointerGame.ParkingSystem.Parkable Class Reference

Component that controls the navigation during a parking sequence agains another entity. Requires a Parking system in the destination target. More...

Inheritance diagram for NullPointerGame.ParkingSystem.Parkable:
GameBase.GameEntityComponent NullPointerCore.Backend.JobScheduling.SimpleJob.ISlotChanged

Classes

interface  IParkingEvents
 Interface to deliver the main events during the parking sequence. More...
 
class  ParkingJob
 class that handles the parking job once a slot is assigned to it. More...
 

Public Member Functions

void Start ()
 
void RequestParkingSlot (Parking parking, IParkingEvents parkingControl=null)
 Request a parking slot at the given parking system. More...
 
void ForceParkingSlot (Parking parking, IParkingEvents parkingControl=null)
 Request a parking slot no matter the actual position of the entity. More...
 
void CancelParkingRequest ()
 Cancels the current parking request, sends the entity to the exit position if the actual parkig job was already started. More...
 
void ForceCancelParkingRequest ()
 
void OnJobSlotAssigned (SimpleJob job, SimpleScheduler.JobSlot slot)
 Called after a parking slot is requested to the parking system, and that system assigns a slot to it. More...
 
void OnJobSlotRemoved (SimpleJob job)
 Called once the slot is removed from the parking job. More...
 
GetParkingSlot< T > ()
 Converts the current assigned slot to the type passed as T in the method. 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

Action ParkingSlotEnter
 Action that is called once the parkable reachs the exact slot position. More...
 
Action ParkingSlotExit
 Action that is called once the parking is canceled and the parkable is at the slot position. More...
 
Action ParkingEnded
 Action that is called once the parkable leaves the parking slot and reachs the exit position. More...
 

Protected Member Functions

virtual void OnParkingEnded ()
 Called once the total parking job was ended. Can be overrided to extend its behaviour. More...
 
- 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...
 

Properties

bool IsParked [get]
 Indicates if the parkable is actually parking at the assigned slot. More...
 
Navigation Nav [get]
 Shortcut and cache to the Navigation component used by this component. More...
 
ParkingJob ThisParkingJob [get]
 Shortcut to a valid cache of the parking job associated with this parkable. 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

Component that controls the navigation during a parking sequence agains another entity. Requires a Parking system in the destination target.

When a paking slot is requested this parkable will move the entity close to the target (in the wait area of the parking) and through its Navigation component.

Once reached, internally will request to the parking system a parking slot and will wait until the the assignment. Then moves to the slot position and informs through the ParkingSlotEnter action that the position was reached.

A call to CancelParkingRequest() will be needed to release the slot and exit the position.

Member Function Documentation

◆ CancelParkingRequest()

void NullPointerGame.ParkingSystem.Parkable.CancelParkingRequest ( )

Cancels the current parking request, sends the entity to the exit position if the actual parkig job was already started.

◆ ForceCancelParkingRequest()

void NullPointerGame.ParkingSystem.Parkable.ForceCancelParkingRequest ( )

◆ ForceParkingSlot()

void NullPointerGame.ParkingSystem.Parkable.ForceParkingSlot ( Parking  parking,
IParkingEvents  parkingControl = null 
)

Request a parking slot no matter the actual position of the entity.

This method is similar to the RequestParkingSlot method but in that case the Parkable will try to move the entity close to the Parking entity and then the slot will be requested. Here the slot will be requested regardless of the actual position.

Parameters
parkingThe parking system where to request a slot.
parkingControlInterface that acts as a callback to inform the parking events sequence during the parking.

◆ GetParkingSlot< T >()

T NullPointerGame.ParkingSystem.Parkable.GetParkingSlot< T > ( )

Converts the current assigned slot to the type passed as T in the method.

Template Parameters
TType where to be casted the parking slot.
Returns
The casted current slot.
Type Constraints
T :SimpleScheduler.JobSlot 

◆ OnJobSlotAssigned()

void NullPointerGame.ParkingSystem.Parkable.OnJobSlotAssigned ( SimpleJob  job,
SimpleScheduler.JobSlot  slot 
)

Called after a parking slot is requested to the parking system, and that system assigns a slot to it.

Remember that the slot request goes to a ordered wait queue, so a slot will be assigned only if it's the correct turn of the entity.

Parameters
jobThe job provided by this Parkable where to assign the slot.
slotThe Parking slot assigned by the system.

Implements NullPointerCore.Backend.JobScheduling.SimpleJob.ISlotChanged.

◆ OnJobSlotRemoved()

void NullPointerGame.ParkingSystem.Parkable.OnJobSlotRemoved ( SimpleJob  job)

Called once the slot is removed from the parking job.

Parameters
jobThe job provided by this Parkable and where the slot was removed.

Implements NullPointerCore.Backend.JobScheduling.SimpleJob.ISlotChanged.

◆ OnParkingEnded()

virtual void NullPointerGame.ParkingSystem.Parkable.OnParkingEnded ( )
protectedvirtual

Called once the total parking job was ended. Can be overrided to extend its behaviour.

◆ RequestParkingSlot()

void NullPointerGame.ParkingSystem.Parkable.RequestParkingSlot ( Parking  parking,
IParkingEvents  parkingControl = null 
)

Request a parking slot at the given parking system.

Parameters
parkingThe parking system where to request a slot.
parkingControlInterface that acts as a callback to inform the parking events sequence during the parking.

◆ Start()

void NullPointerGame.ParkingSystem.Parkable.Start ( )

Member Data Documentation

◆ ParkingEnded

Action NullPointerGame.ParkingSystem.Parkable.ParkingEnded

Action that is called once the parkable leaves the parking slot and reachs the exit position.

◆ ParkingSlotEnter

Action NullPointerGame.ParkingSystem.Parkable.ParkingSlotEnter

Action that is called once the parkable reachs the exact slot position.

◆ ParkingSlotExit

Action NullPointerGame.ParkingSystem.Parkable.ParkingSlotExit

Action that is called once the parking is canceled and the parkable is at the slot position.

Property Documentation

◆ IsParked

bool NullPointerGame.ParkingSystem.Parkable.IsParked
get

Indicates if the parkable is actually parking at the assigned slot.

◆ Nav

Navigation NullPointerGame.ParkingSystem.Parkable.Nav
get

Shortcut and cache to the Navigation component used by this component.

◆ ThisParkingJob

ParkingJob NullPointerGame.ParkingSystem.Parkable.ThisParkingJob
getprotected

Shortcut to a valid cache of the parking job associated with this parkable.