source:
advance-wars/src/com/medievaltech/game/Tile.java@
5d77d43
Last change on this file since 5d77d43 was 1a1e8c7, checked in by , 14 years ago | |
---|---|
|
|
File size: 842 bytes |
Rev | Line | |
---|---|---|
[1a1e8c7] | 1 | package com.medievaltech.game; |
[a0f5455] | 2 | |
[2e798d9] | 3 | import android.graphics.Canvas; |
4 | import android.graphics.Paint; | |
[a0f5455] | 5 | import android.graphics.Point; |
[2e798d9] | 6 | |
7 | public class Tile { | |
[a0f5455] | 8 | public enum TerrainType |
9 | { | |
10 | LAND, SEA | |
11 | } | |
12 | ||
13 | TerrainType type; | |
14 | public double moveCoefficent; | |
15 | public Unit currentUnit; | |
16 | public Point point; | |
[1a1e8c7] | 17 | private Paint p; |
[a0f5455] | 18 | |
[1a1e8c7] | 19 | public Tile(Paint p) { |
20 | this.p = p; | |
21 | this.currentUnit = null; | |
22 | } | |
23 | ||
24 | public Tile(Tile t) { | |
25 | this.type = t.type; | |
26 | this.moveCoefficent = t.moveCoefficent; | |
27 | this.p = t.p; | |
28 | } | |
29 | ||
30 | public void addUnit(Unit unit) { | |
[a0f5455] | 31 | currentUnit = unit; |
32 | } | |
33 | ||
[1a1e8c7] | 34 | public void removeUnit(Unit unit) { |
35 | if(currentUnit != null) { | |
[a0f5455] | 36 | currentUnit = null; |
37 | } | |
38 | ||
39 | } | |
[2e798d9] | 40 | |
41 | public void draw(Canvas c, int x, int y) { | |
42 | c.drawRect(x, y, x+50, y+50, p); | |
[1a1e8c7] | 43 | |
44 | if(currentUnit != null) | |
45 | currentUnit.draw(c, x+25, y+25); | |
[2e798d9] | 46 | } |
47 | } |
Note:
See TracBrowser
for help on using the repository browser.