View Javadoc
1   package com.jed.actor;
2   
3   import com.jed.core.Displayable;
4   import com.jed.state.State;
5   import com.jed.util.Vector2f;
6   import org.colapietro.lang.LangConstants;
7   import org.colapietro.lang.NotImplementedException;
8   import org.colapietro.lwjgl.physics.Collidable;
9   
10  import javax.annotation.Nonnull;
11  
12  /**
13   *
14   * Abstract class whose subclasses are displayable, collidable, and contain various states. It is also
15   * composed of a position and movement vector, acceleration, and a {@link com.jed.actor.Boundary}.
16   * 
17   * @author jlinde, Peter Colapietro
18   * @since 0.1.0
19   * @see com.jed.core.Displayable
20   * @see com.jed.state.State
21   * @see org.colapietro.lwjgl.physics.Collidable
22   *
23   */
24  public abstract class AbstractEntity implements Displayable, State, Collidable {
25  
26      /**
27       * 
28       */
29      private Vector2f position;
30      
31      /**
32       * 
33       */
34      @Nonnull
35      private final Boundary bounds;
36      
37      /**
38       * 
39       */
40      private Vector2f movement;
41      
42      /**
43       * 
44       */
45      private float acceleration = 0;
46  
47      /**
48       *
49       * @param position position vector.
50       * @param movement movement vector.
51       * @param bounds entity's bounds.
52       */
53      protected AbstractEntity(Vector2f position, Vector2f movement, @Nonnull Boundary bounds) {
54          this.position = position;
55          this.bounds = bounds;
56          this.bounds.setOwner(this);
57          this.movement = movement;
58      }
59  
60      @Override
61      public void drawChildVertex2f(float x, float y) throws NotImplementedException {
62          throw new NotImplementedException(LangConstants.NOT_IMPLEMENTED_YET_MESSAGE);
63      }
64  
65      @Override
66      public void entered() throws NotImplementedException {
67          throw new NotImplementedException(LangConstants.NOT_IMPLEMENTED_YET_MESSAGE);
68      }
69  
70      @Override
71      public void leaving() throws NotImplementedException {
72          throw new NotImplementedException(LangConstants.NOT_IMPLEMENTED_YET_MESSAGE);
73      }
74  
75      @Override
76      public void update() throws NotImplementedException {
77          throw new NotImplementedException(LangConstants.NOT_IMPLEMENTED_YET_MESSAGE);
78      }
79  
80      @Override
81      public void render() throws NotImplementedException {
82          throw new NotImplementedException(LangConstants.NOT_IMPLEMENTED_YET_MESSAGE);
83      }
84  
85      @Override
86      public void collideDown(AbstractEntity entity) throws NotImplementedException {
87          throw new NotImplementedException(LangConstants.NOT_IMPLEMENTED_YET_MESSAGE);
88      }
89  
90      @Override
91      public void collideUp(AbstractEntity entity) throws NotImplementedException {
92          throw new NotImplementedException(LangConstants.NOT_IMPLEMENTED_YET_MESSAGE);
93      }
94  
95      @Override
96      public void collideLeft(AbstractEntity entity) throws NotImplementedException {
97          throw new NotImplementedException(LangConstants.NOT_IMPLEMENTED_YET_MESSAGE);
98      }
99  
100     @Override
101     public void collideRight(AbstractEntity entity) throws NotImplementedException {
102         throw new NotImplementedException(LangConstants.NOT_IMPLEMENTED_YET_MESSAGE);
103     }
104 
105     /**
106      *
107      * @return acceleration
108      */
109     public float getAcceleration() {
110         return acceleration;
111     }
112 
113     /**
114      *
115      * @param acceleration acceleration
116      */
117     public void setAcceleration(float acceleration) {
118         this.acceleration = acceleration;
119     }
120 
121     /**
122      *
123      * @return bounds
124      */
125     @Nonnull
126     public Boundary getBounds() {
127         return bounds;
128     }
129 
130     /**
131      *
132      * @return position
133      */
134     public Vector2f getPosition() {
135         return position;
136     }
137 
138     /**
139      *
140      * @param position position
141      */
142     public void setPosition(Vector2f position) {
143         this.position = position;
144     }
145 
146     /**
147      *
148      * @return movement
149      */
150     public Vector2f getMovement() {
151         return movement;
152     }
153 
154     /**
155      *
156      * @param movement movement
157      */
158     public void setMovement(Vector2f movement) {
159         this.movement = movement;
160     }
161 
162     //TODO Implement Equals/hashCode
163 }