Constructors

We should create a constructor for Invader class.

class Invader
{
    private readonly Path _path;
    private int _pathStep = 0;

    public MapLocation Location { get; set; }

    public Invader(Path path)
    {
        _path = path;
    }

    public void Move()
    {
        _pathStep += 1;
    }

}

To get or set the invader location, we could use something like this.

// example only

Invader invader = new Invader();

// set invader location
invader.Location = 0,2;

// get invader location
Console.WriteLine(invader.Location);

results matching ""

    No results matching ""