|
Last change
on this file since bbee931 was 1a1e8c7, checked in by dportnoy <devnull@…>, 15 years ago |
|
Added a basic draw function to Unit and made some other minor code changes.
|
-
Property mode
set to
100644
|
|
File size:
890 bytes
|
| Line | |
|---|
| 1 | package com.medievaltech.game;
|
|---|
| 2 |
|
|---|
| 3 | import java.util.List;
|
|---|
| 4 |
|
|---|
| 5 | import android.graphics.Canvas;
|
|---|
| 6 | import android.graphics.Paint;
|
|---|
| 7 | import android.graphics.Point;
|
|---|
| 8 |
|
|---|
| 9 | public abstract class Unit
|
|---|
| 10 | {
|
|---|
| 11 | public enum Type
|
|---|
| 12 | {
|
|---|
| 13 | LAND,SEA
|
|---|
| 14 | }
|
|---|
| 15 |
|
|---|
| 16 | private Paint p;
|
|---|
| 17 |
|
|---|
| 18 | public Type type;
|
|---|
| 19 | public Player owner;
|
|---|
| 20 |
|
|---|
| 21 | public int maxHealth;
|
|---|
| 22 | public int currentHealth;
|
|---|
| 23 |
|
|---|
| 24 | public int maxFuel;
|
|---|
| 25 | public int currentFuel;
|
|---|
| 26 |
|
|---|
| 27 | public int sightRange;
|
|---|
| 28 | public int move;
|
|---|
| 29 |
|
|---|
| 30 | public int minAttackRange;
|
|---|
| 31 | public int maxAttackRange;
|
|---|
| 32 | public Point location;
|
|---|
| 33 |
|
|---|
| 34 | public Unit(Paint p) {
|
|---|
| 35 | this.p = p;
|
|---|
| 36 | }
|
|---|
| 37 |
|
|---|
| 38 | public abstract boolean move(Point point);
|
|---|
| 39 | public abstract boolean attack(Point point);
|
|---|
| 40 |
|
|---|
| 41 | public abstract List<Point> getRange();
|
|---|
| 42 | public abstract List<Point> getAttackRange();
|
|---|
| 43 |
|
|---|
| 44 | public void die() {
|
|---|
| 45 |
|
|---|
| 46 | }
|
|---|
| 47 |
|
|---|
| 48 | public void draw(Canvas c, int x, int y) {
|
|---|
| 49 | c.drawCircle(x, y, 20, p);
|
|---|
| 50 | }
|
|---|
| 51 | }
|
|---|
Note:
See
TracBrowser
for help on using the repository browser.