Changeset c3ad11c in advance-wars for src/com/medievaltech/unit/Unit.java


Ignore:
Timestamp:
Aug 26, 2011, 9:54:05 PM (13 years ago)
Author:
dportnoy <devnull@…>
Branches:
master
Children:
511177b
Parents:
99433bb
Message:

Units are now colored based on the player that controls them. The controlling player is specified in the unit's constructor.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/com/medievaltech/unit/Unit.java

    r99433bb rc3ad11c  
    88
    99public abstract class Unit {
    10         private Paint p;
    11        
    1210        public UnitType type;
    13         //public Player owner;
     11        public Player owner;
    1412       
    1513        public int maxHealth;
     
    2624        public Point location;
    2725       
    28         public Unit(Paint p)
     26        public Unit(Player p)
    2927        {
    30                 this.p = p;
     28                p.addUnit(this);
     29               
     30                owner = p;
    3131                maxHealth = 10;
    3232                currentHealth = 10;
    33                
    3433        }
    3534       
     
    8786       
    8887        public void draw(Canvas c, int x, int y) {
    89                 c.drawCircle(x, y, 20, p);
     88                c.drawCircle(x, y, 20, owner.getColor());
    9089        }
    9190}
Note: See TracChangeset for help on using the changeset viewer.