AI Testing Simulator
Loading...
Searching...
No Matches
AdversaryViewController Class Reference

Controller for an Adversary. More...

Inheritance diagram for AdversaryViewController:
VehicleViewController IBaseEntityController IBaseEntityView IBaseController IBaseView

Public Member Functions

override void Awake ()
 
override void Init (AdversaryCategory cat, Color color)
 Initializes the Adversary entity with the specified category and color.
 
void Init (Adversary adversary)
 Initializes the Adversary field with the specified Adversary.
 
override void OnChangePosition (float x, float y)
 Moves the Adversary GameObject and, if available, the first Waypoint of the Adversary.
 
override Sprite GetSprite ()
 Gets the sprite for this adversary.
 
override void OnChangeCategory (AdversaryCategory cat)
 Called when the category of this adversary changes. Changes the sprite of this adversary based on the new category and sets the size of the BoxCollider2D accordingly.
 
BoxCollider2D GetCollider ()
 Gets the BoxCollider2D component of this adversary.
 
override void Select ()
 Selects this adversary, the pathController, if available, and signals the SnapController to ignore clicks.
 
override void Deselect ()
 Deselects this adversary, the pathController, if available, and signals the SnapController not to ignore clicks.
 
override void Destroy ()
 Removes this adversary from the main controller and destroys it and the PathController.
 
override void OnChangeColor (Color color)
 Called when the color of this adversary changes. Sets the color of the sprite and path controller accordingly and refreshes the entity list of the main controller.
 
override BaseEntity GetEntity ()
 Returns the Adversary.
 
override void OpenEditDialog ()
 Opens the edit dialog for this adversary.
 
override void ShouldIgnoreWaypoints (bool b)
 Sets whether to ignore waypoints for this adversary and its path controller. If waypoints should not be ignored, moves the Adversary and its first waypoint to the nearest waypoint.
 
- Public Member Functions inherited from VehicleViewController
virtual void Awake ()
 
abstract Sprite GetSprite ()
 Returns the Sprite associated with the vehicle.
 
Location GetLocation ()
 Gets the location of the vehicle.
 
abstract void Init (AdversaryCategory cat, Color color)
 Initializes the vehicle view controller with the specified category and color.
 
virtual void OnChangePosition (float x, float y)
 Changes the position of the entity to the given coordinates.
 
virtual void OnChangeRotation (float angle)
 Changes the rotation of the entity to the given angle.
 
virtual void OnChangeCategory (AdversaryCategory cat)
 Changes the category of the entity to the given category.
 
void OnChangeModel (EntityModel model)
 Changes the model of the entity to the given model.
 
void OnChangeID (string id)
 Changes the ID of the entity to the given ID.
 
virtual void Select ()
 Selects the entity and changes its position and material.
 
virtual void Deselect ()
 Deselects the entity and changes its position and material.
 
abstract void Destroy ()
 Destroys the entity.
 
Vector2 GetPosition ()
 Gets the position of the entity.
 
void Update ()
 Updates the entity's position and rotation.
 
void OnMouseDrag ()
 Handles the OnMouseDrag event to move the entity.
 
void OnMouseDown ()
 Handles the OnMouseDown event to select and place the entity.
 
bool IsIgnoringWaypoints ()
 Returns whether the entity should ignore waypoints.
 
virtual void ShouldIgnoreWaypoints (bool b)
 Sets whether the entity should ignore waypoints.
 
abstract BaseEntity GetEntity ()
 Gets the BaseEntity instance of the entity.
 
abstract void OpenEditDialog ()
 Opens the edit dialog for the entity.
 
abstract void OnChangeColor (Color c)
 Changes the color of the entity.
 
BaseEntity GetEntity ()
 Returns the entity associated with the controller. This can be Ego or Adversary.
 
void Select ()
 Selects the controller.
 
void Deselect ()
 Deselects the controller.
 
void Destroy ()
 Destroys the controller.
 
void OpenEditDialog ()
 Opens the edit dialog for the controller.
 
bool IsIgnoringWaypoints ()
 Returns a boolean indicating whether or not the controller ignores waypoints.
 
void ShouldIgnoreWaypoints (bool b)
 Sets the value indicating whether or not the controller should ignore waypoints.
 
Location GetLocation ()
 Returns the location of the object that the controller belongs to.
 
void OnChangeCategory (AdversaryCategory cat)
 Called when the category of the entity changes. </summary

Parameters
catThe new category of the entity.

 
void OnChangeModel (EntityModel model)
 Called when the model of the entity changes.
 
void OnChangeID (string id)
 Called when the ID of the entity changes.
 
void OnChangePosition (float x, float y)
 Called when the position of the corresponding object changes.
 
void OnChangeRotation (float angle)
 Called when the rotation of the corresponding object changes.
 
void OnChangeColor (Color color)
 Called when the color of the corresponding object changes.
 

Public Attributes

GameObject pathPrefab
 
- Public Attributes inherited from VehicleViewController
Material selectionMaterial
 

Protected Member Functions

override void RegisterEntity ()
 Registers this adversary entity with the main controller.
 
abstract void RegisterEntity ()
 Registers the entity with the main controller.
 

Additional Inherited Members

- Protected Attributes inherited from VehicleViewController
SpriteRenderer sprite
 
bool placed = false
 
Vector2 difference = Vector2.zero
 
Vector2 lastClickPos = Vector2.zero
 
SnapController snapController
 
MainController mainController
 
bool ignoreWaypoints
 

Detailed Description

Controller for an Adversary.

Member Function Documentation

◆ Awake()

override void AdversaryViewController.Awake ( )
inlinevirtual

Reimplemented from VehicleViewController.

◆ Deselect()

override void AdversaryViewController.Deselect ( )
inlinevirtual

Deselects this adversary, the pathController, if available, and signals the SnapController not to ignore clicks.

Reimplemented from VehicleViewController.

◆ Destroy()

override void AdversaryViewController.Destroy ( )
inlinevirtual

Removes this adversary from the main controller and destroys it and the PathController.

Implements VehicleViewController.

◆ GetCollider()

BoxCollider2D AdversaryViewController.GetCollider ( )
inline

Gets the BoxCollider2D component of this adversary.

Returns
The BoxCollider2D component of this adversary.

◆ GetEntity()

override BaseEntity AdversaryViewController.GetEntity ( )
inlinevirtual

Returns the Adversary.

Returns
The entity of this adversary.

Implements VehicleViewController.

◆ GetSprite()

override Sprite AdversaryViewController.GetSprite ( )
inlinevirtual

Gets the sprite for this adversary.

Returns
The sprite for this vehicle.

Implements VehicleViewController.

◆ Init() [1/2]

void AdversaryViewController.Init ( Adversary  adversary)
inline

Initializes the Adversary field with the specified Adversary.

Parameters
adversaryThe Adversary entity to be initialized

◆ Init() [2/2]

override void AdversaryViewController.Init ( AdversaryCategory  cat,
Color  color 
)
inlinevirtual

Initializes the Adversary entity with the specified category and color.

Parameters
catThe category of the Adversary entity
colorThe color of the Adversary entity

Implements VehicleViewController.

◆ OnChangeCategory()

override void AdversaryViewController.OnChangeCategory ( AdversaryCategory  cat)
inlinevirtual

Called when the category of this adversary changes. Changes the sprite of this adversary based on the new category and sets the size of the BoxCollider2D accordingly.

Parameters
catThe new category of this adversary.

Reimplemented from VehicleViewController.

◆ OnChangeColor()

override void AdversaryViewController.OnChangeColor ( Color  color)
inlinevirtual

Called when the color of this adversary changes. Sets the color of the sprite and path controller accordingly and refreshes the entity list of the main controller.

Parameters
colorThe new color of this adversary.

Implements VehicleViewController.

◆ OnChangePosition()

override void AdversaryViewController.OnChangePosition ( float  x,
float  y 
)
inlinevirtual

Moves the Adversary GameObject and, if available, the first Waypoint of the Adversary.

Parameters
xThe x coordinate of the position
yThe y coordinate of the position

Reimplemented from VehicleViewController.

◆ OpenEditDialog()

override void AdversaryViewController.OpenEditDialog ( )
inlinevirtual

Opens the edit dialog for this adversary.

Implements VehicleViewController.

◆ RegisterEntity()

override void AdversaryViewController.RegisterEntity ( )
inlineprotectedvirtual

Registers this adversary entity with the main controller.

Implements VehicleViewController.

◆ Select()

override void AdversaryViewController.Select ( )
inlinevirtual

Selects this adversary, the pathController, if available, and signals the SnapController to ignore clicks.

Reimplemented from VehicleViewController.

◆ ShouldIgnoreWaypoints()

override void AdversaryViewController.ShouldIgnoreWaypoints ( bool  b)
inlinevirtual

Sets whether to ignore waypoints for this adversary and its path controller. If waypoints should not be ignored, moves the Adversary and its first waypoint to the nearest waypoint.

Parameters
bThe boolean value to set for ignoring waypoints.

Reimplemented from VehicleViewController.


The documentation for this class was generated from the following file: