Last change
on this file since 379005b was 379005b, checked in by dportnoy <devnull@…>, 13 years ago |
Moved all the enums to an Enum.java file.
|
-
Property mode
set to
100644
|
File size:
1022 bytes
|
Rev | Line | |
---|
[113d7cf] | 1 | package com.medievaltech.advancewars;
|
---|
| 2 |
|
---|
[2e798d9] | 3 | import android.graphics.Canvas;
|
---|
| 4 | import android.graphics.Paint;
|
---|
[a0f5455] | 5 | import android.graphics.Point;
|
---|
[2e798d9] | 6 |
|
---|
[379005b] | 7 | import com.medievaltech.unit.*;
|
---|
| 8 | import com.medievaltech.advancewars.Enum.*;
|
---|
| 9 |
|
---|
[2e798d9] | 10 | public class Tile {
|
---|
[a0f5455] | 11 | TerrainType type;
|
---|
| 12 | public double moveCoefficent;
|
---|
| 13 | public Unit currentUnit;
|
---|
| 14 | public Point point;
|
---|
[1a1e8c7] | 15 | private Paint p;
|
---|
[a0f5455] | 16 |
|
---|
[113d7cf] | 17 | public Tile(Paint p, TerrainType type) {
|
---|
[1a1e8c7] | 18 | this.p = p;
|
---|
[113d7cf] | 19 | this.type = type;
|
---|
[1a1e8c7] | 20 | this.currentUnit = null;
|
---|
| 21 | }
|
---|
| 22 |
|
---|
[ebaddd9] | 23 | public Tile(Tile t, Point point) {
|
---|
[1a1e8c7] | 24 | this.type = t.type;
|
---|
| 25 | this.moveCoefficent = t.moveCoefficent;
|
---|
| 26 | this.p = t.p;
|
---|
[ebaddd9] | 27 | this.point = point;
|
---|
[1a1e8c7] | 28 | }
|
---|
| 29 |
|
---|
| 30 | public void addUnit(Unit unit) {
|
---|
[ebaddd9] | 31 | currentUnit = unit;
|
---|
| 32 | unit.location = point;
|
---|
[a0f5455] | 33 | }
|
---|
| 34 |
|
---|
[bdd63ba] | 35 | public void removeUnit() {
|
---|
[1a1e8c7] | 36 | if(currentUnit != null) {
|
---|
[a0f5455] | 37 | currentUnit = null;
|
---|
| 38 | }
|
---|
| 39 |
|
---|
| 40 | }
|
---|
[2e798d9] | 41 |
|
---|
| 42 | public void draw(Canvas c, int x, int y) {
|
---|
| 43 | c.drawRect(x, y, x+50, y+50, p);
|
---|
[b97a618] | 44 | }
|
---|
| 45 |
|
---|
| 46 | public void drawUnit(Canvas c, int x, int y) {
|
---|
[1a1e8c7] | 47 | if(currentUnit != null)
|
---|
| 48 | currentUnit.draw(c, x+25, y+25);
|
---|
[2e798d9] | 49 | }
|
---|
| 50 | }
|
---|
Note:
See
TracBrowser
for help on using the repository browser.