001         package com.croftsoft.apps.mars.model;
002    
003         import java.awt.*;
004         import java.util.*;
005    
006         import com.croftsoft.core.math.geom.PointXY;
007    
008         /*********************************************************************
009         * Provides methods for manipulating the Models in the game.
010         *
011         * @version
012         *   2003-05-11
013         * @since
014         *   2003-04-14
015         * @author
016         *   <a href="https://www.croftsoft.com/">David Wallace Croft</a>
017         *********************************************************************/
018    
019         public interface  World
020           extends WorldAccessor
021         //////////////////////////////////////////////////////////////////////
022         //////////////////////////////////////////////////////////////////////
023         {
024    
025         public void  clear ( );
026    
027         public AmmoDump  createAmmoDump (
028           double  centerX,
029           double  centerY );
030    
031         public Obstacle  createObstacle (
032           double     centerX,
033           double     centerY,
034           double     radius,
035           double     radiusMin,
036           Rectangle  driftBounds );
037    
038         public Tank  createTank (
039           double  centerX,
040           double  centerY,
041           Color   color );
042    
043         public void  remove ( Model  model );
044    
045         //////////////////////////////////////////////////////////////////////
046         //////////////////////////////////////////////////////////////////////
047    
048         public void  prepare ( );
049    
050         public void  update ( double  timeDelta );
051    
052         //////////////////////////////////////////////////////////////////////
053         //////////////////////////////////////////////////////////////////////
054    
055         /*********************************************************************
056         * Fires a Bullet from the origin.
057         *********************************************************************/
058         public void  fireBullet (
059           double  originX,
060           double  originY,
061           double  heading );
062    
063         /*********************************************************************
064         * Gets all active AmmoDumps that contain the point.
065         *********************************************************************/
066         public AmmoDump [ ]  getAmmoDumps (
067           PointXY       pointXY,
068           AmmoDump [ ]  ammoDumps );
069    
070         /*********************************************************************
071         * Gets all active and inactive Obstacles in the World.
072         *********************************************************************/
073         public Obstacle [ ]  getObstacles ( );
074    
075         /*********************************************************************
076         * Gets all active and inactive Tanks in the World.
077         *********************************************************************/
078         public Tank [ ]  getTanks ( );
079    
080         /*********************************************************************
081         * Gets the center of the active AmmoDump that is closest to the point.
082         *********************************************************************/
083         public PointXY  getClosestAmmoDumpCenter ( PointXY  pointXY );
084    
085         /*********************************************************************
086         * Gets the center of the closest active tank that is not of the color.
087         *********************************************************************/
088         public PointXY  getClosestEnemyTankCenter (
089            PointXY  pointXY,
090            Color    friendColor );
091    
092         /*********************************************************************
093         * Gets all active Damageables that overlap the shape.
094         *********************************************************************/
095         public Damageable [ ]  getDamageables (
096           Shape           shape,
097           Damageable [ ]  damageables );
098    
099         /*********************************************************************
100         * Gets all active Impassables that overlap the shape.
101         *********************************************************************/
102         public Iterator  getImpassables (
103           Shape  shape,
104           Model  model );
105    
106         /*********************************************************************
107         * Gets an active Model that contains the point.
108         *
109         * @param  classes
110         *
111         *   The returned Model will be an instance of one of the classes.
112         *
113         * @param  model
114         *
115         *   The Model to ignore, usually the one calling this method.
116         *********************************************************************/
117         public Model  getModel (
118           PointXY    pointXY,
119           Class [ ]  classes,
120           Model      model );
121    
122         /*********************************************************************
123         * Determines whether an active Impassable overlaps the model shape.
124         *********************************************************************/
125         public boolean  isBlocked ( Model  model );
126    
127         /*********************************************************************
128         * Determines whether an active Impassable overlaps the shape.
129         *
130         * @param  model
131         *
132         *   The model to ignore.
133         *********************************************************************/
134         public boolean  isBlocked (
135           Shape  shape,
136           Model  model );
137    
138         public boolean  isBlockedByObstacle ( Shape  shape );
139    
140         //////////////////////////////////////////////////////////////////////
141         //////////////////////////////////////////////////////////////////////
142         }