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