public class ActionableModel extends TraitModel implements Actionable
The ObjectGame
owner must provide a valid Configurer
compatible
with ActionConfig
.
The Services
must provide the following services:
If the ObjectGame
owner is an Action
, it will automatically setAction(Action)
on it.
Constructor and Description |
---|
ActionableModel()
Create an actionable model.
|
Modifier and Type | Method and Description |
---|---|
Rectangle |
getButton()
Get the button surface representation.
|
String |
getDescription()
Get the action description.
|
boolean |
isOver()
Check if cursor is over the action button.
|
void |
prepare(ObjectGame owner,
Services services)
Prepare the trait.
|
void |
setAction(Action action)
Set the executable action.
|
void |
setClickAction(int click)
Set the mouse click selection value to
Action.execute() the action. |
void |
update(double extrp) |
getOwner
public void prepare(ObjectGame owner, Services services)
Trait
prepare
in interface Trait
prepare
in class TraitModel
owner
- The owner reference.services
- The services reference.public void setAction(Action action)
Actionable
setAction
in interface Actionable
action
- The action to execute.public void setClickAction(int click)
Actionable
Action.execute()
the action.setClickAction
in interface Actionable
click
- The click number.InputDevicePointer
public Rectangle getButton()
Actionable
getButton
in interface Actionable
public String getDescription()
Actionable
getDescription
in interface Actionable
public boolean isOver()
Actionable
isOver
in interface Actionable
true
if cursor is over, false
else.Copyright © 2016 Byron 3D Games Studio. All rights reserved.