 |
Gridarta Editor
|
Go to the documentation of this file.
20 package net.sf.gridarta.model.mapmodel;
22 import java.awt.Point;
23 import java.util.ArrayList;
24 import java.util.Collections;
25 import java.util.List;
31 import org.jetbrains.annotations.NotNull;
32 import org.jetbrains.annotations.Nullable;
80 private List<MapSquare<G, A, R>>
lightSources = Collections.emptyList();
143 public void getMapLocation(@NotNull
final Point pos,
final int dx,
final int dy) {
172 @SuppressWarnings(
"unchecked")
181 gameObject.setContainer(
this,
mapX,
mapY);
197 for (
final G gameObject :
reverse()) {
198 if (gameObjectMatcher.isMatching(gameObject)) {
215 for (
final G gameObject :
reverse()) {
216 if (gameObjectMatcher.isMatching(gameObject)) {
231 for (
final G gameObject :
this) {
232 if (gameObjectMatcher.isMatching(gameObject)) {
249 for (
final G gameObject :
this) {
250 if (gameObjectMatcher.isMatching(gameObject)) {
267 @Nullable G result =
null;
268 for (
final G tmp :
this) {
269 if (!gameObjectMatcher.isMatching(tmp)) {
295 public boolean equals(@Nullable
final Object obj) {
296 if (obj ==
null || obj.getClass() != getClass()) {
int getMapY()
Returns the y coordinate on the map.
A getMapArchObject()
Returns the Map Arch Object with the meta information about the map.
MapSquare< G, A, R > getMapSquareOptional()
Returns the MapSquare this game object is part of.
G getLast(@NotNull final GameObjectMatcher gameObjectMatcher)
Returns the last occurrence of a matching game object.
Point getMapLocation()
Returns the coordinate on the map.
final int mapY
The Y Coordinate of this map square within the model's grid.
int getMapX()
Returns the x coordinate on the map.
Base package of all Gridarta classes.
G getFirst(@NotNull final GameObjectMatcher gameObjectMatcher)
Returns the first occurrence of a matching game object.
int lightRadius
The maximum light radius of all objects within this map square.
void removeLightSource(@NotNull final MapSquare< G, A, R > mapSquare)
Removes a light emitting game object that affects this map square.
void beginSquareChange(@NotNull MapSquare< G, A, R > mapSquare)
Method to notify the model that a map square is about to change.
void notifyEndChange()
Notifies the map model that this container has changed.
void notifyBeginChange()
Notifies the map model that this container is about to change.
Interface for classes that match GameObjects.
Reflects a game object (object on a map).
void endSquareChange()
Method to notify the model that a map square was changed.
void endSquareChange(@NotNull MapSquare< G, A, R > mapSquare)
Method to notify the model that a map square was changed.
List< MapSquare< G, A, R > > lightSources
The MapSquares on the map that contain light emitting game objects that affect this map square.
void getMapLocation(@NotNull final Point pos, final int dx, final int dy)
Returns the coordinate with an offset on the map.
GameObjects are the objects based on Archetypes found on maps.
final int mapX
The X Coordinate of this map square within the model's grid.
int getLightRadius()
Returns the maximum light radius of all light emitting objects within this map square.
Classes related to matching {GameObjects}, so called { net.sf.gridarta.model.match....
transient Iterable< G > reverse
Iterable implementation for reverse traversal.
G getBeforeFirst(@NotNull final GameObjectMatcher gameObjectMatcher)
Returns the game object before the first occurrence of a matching game object.
Interface for MapArchObjects.
static final long serialVersionUID
The serial version UID.
boolean equals(@Nullable final Object obj)
}
boolean isLight()
Returns whether this map square is affected by any light emitting game objects.
void setLightRadius(final int lightRadius)
Sets the maximum light radius of all light emitting objects within this map square.
MapModel< G, A, R > getMapModel()
Returns the MapModel this map square is part of.
G asGameObject()
Returns this instance as a GameObject or.
final MapModel< G, A, R > mapModel
The MaoModel this square is associated with.
MapSquare(@NotNull final MapModel< G, A, R > mapModel, final int mapX, final int mapY)
Creates a new instance.
void getMapLocation(@NotNull final Point pos)
Returns the coordinate on the map.
void setThisContainer(@NotNull final G gameObject)
Sets a GameObject's container to this container.
G getAfterLast(@NotNull final GameObjectMatcher gameObjectMatcher)
Returns the game object after the last occurrence of a matching game object.
void addLightSource(@NotNull final MapSquare< G, A, R > mapSquare)
Adds a light emitting game object that affects this map square.
G getLastOfLeadingSpan(@NotNull final GameObjectMatcher gameObjectMatcher)
Returns the last game object of the initial segment of matching game objects.
MapSquare< G, A, R > clone()
Base class for classes that contain GameObjects as children in the sense of containment.
void beginSquareChange()
Method to notify the model that a map square is about to change.
MapSquare< G, A, R > getMapSquare()
Returns the MapSquare this game object is part of.