Converted Brushes to solid brudhes and increased performances
This commit is contained in:
@@ -10,10 +10,21 @@ namespace PropagationRemasteredBeta
|
||||
public class Human : ICloneable
|
||||
{
|
||||
//State values
|
||||
/*
|
||||
public Color SAIN_COLOR = Color.Green;
|
||||
public Color INFECTED_COLOR = Color.Red;
|
||||
public Color IMMUNE_COLOR = Color.Blue;
|
||||
public Color DEATH_COLOR = Color.Black;
|
||||
|
||||
public SolidBrush SAIN_COLOR = new SolidBrush(Color.Green);
|
||||
public SolidBrush INFECTED_COLOR = new SolidBrush(Color.Red);
|
||||
public SolidBrush IMMUNE_COLOR = new SolidBrush(Color.Blue);
|
||||
public SolidBrush DEATH_COLOR = new SolidBrush(Color.Black);
|
||||
*/
|
||||
public SolidBrush SAIN_COLOR;
|
||||
public SolidBrush INFECTED_COLOR;
|
||||
public SolidBrush IMMUNE_COLOR;
|
||||
public SolidBrush DEATH_COLOR;
|
||||
|
||||
public const int SAIN = 0;
|
||||
public const int INFECTED = 1;
|
||||
@@ -27,7 +38,8 @@ namespace PropagationRemasteredBeta
|
||||
private Size _humanSize;
|
||||
private int _lifeTimeCounter;
|
||||
private int _InfectedTimeCounter;
|
||||
private Color _sprite;
|
||||
//private Color _sprite;
|
||||
private SolidBrush _sprite;
|
||||
|
||||
public Point Position { get => _position; set => _position = value; }
|
||||
public int State
|
||||
@@ -58,15 +70,27 @@ namespace PropagationRemasteredBeta
|
||||
public Size HumanSize { get => _humanSize; set => _humanSize = value; }
|
||||
public int LifeTimeCounter { get => _lifeTimeCounter; set => _lifeTimeCounter = value; }
|
||||
public int InfectedTimeCounter { get => _InfectedTimeCounter; set => _InfectedTimeCounter = value; }
|
||||
public Color Sprite { get => _sprite; set => _sprite = value; }
|
||||
|
||||
public Human(Point position, int state, Size humanSize)
|
||||
//public Color Sprite { get => Sprite; set => Sprite = value; }
|
||||
public SolidBrush Sprite { get => _sprite; set => _sprite = value; }
|
||||
public Human(Point position, int state, Size humanSize, SolidBrush sainColor, SolidBrush infectedColor, SolidBrush immuneColor, SolidBrush deadColor)
|
||||
{
|
||||
HumanSize = humanSize;
|
||||
Position = position;
|
||||
State = state;
|
||||
|
||||
LifeTimeCounter = 1;
|
||||
InfectedTimeCounter = 0;
|
||||
SAIN_COLOR = sainColor;
|
||||
INFECTED_COLOR = infectedColor;
|
||||
IMMUNE_COLOR = immuneColor;
|
||||
DEATH_COLOR = deadColor;
|
||||
|
||||
//IMPORTANT only set state AFTER colors
|
||||
State = state;
|
||||
}
|
||||
|
||||
public Human(Point position, int state, Size humanSize) : this(position,state,humanSize, new SolidBrush(Color.Green), new SolidBrush(Color.Red), new SolidBrush(Color.Blue), new SolidBrush(Color.Black))
|
||||
{
|
||||
|
||||
}
|
||||
public Human(Point position, int state) : this(position, state, new Size(DEFAULT_HUMAN_SIZE, DEFAULT_HUMAN_SIZE))
|
||||
{
|
||||
@@ -74,7 +98,7 @@ namespace PropagationRemasteredBeta
|
||||
}
|
||||
//we dont have any constructor with only default values because the human needs his position in the field to process the infection
|
||||
|
||||
public void ChangeBaseColors(Color sainColor, Color infectedColor, Color immuneColor, Color deadColor)
|
||||
public void ChangeBaseColors(SolidBrush sainColor, SolidBrush infectedColor, SolidBrush immuneColor, SolidBrush deadColor)
|
||||
{
|
||||
SAIN_COLOR = sainColor;
|
||||
IMMUNE_COLOR = immuneColor;
|
||||
@@ -112,7 +136,7 @@ namespace PropagationRemasteredBeta
|
||||
{
|
||||
T.PeopleToCheck.Add(target);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
//check top
|
||||
|
||||
Reference in New Issue
Block a user