source: advance-wars/src/com/medievaltech/game/Unit.java@ 1a1e8c7

Last change on this file since 1a1e8c7 was 1a1e8c7, checked in by dportnoy <devnull@…>, 14 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 
1package com.medievaltech.game;
2
3import java.util.List;
4
5import android.graphics.Canvas;
6import android.graphics.Paint;
7import android.graphics.Point;
8
9public 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.