package ecs.systems;

import ecs.core.System;

class EconomicsSystem extends System {
	public var ore(default, set):Int = 0;

	function set_ore(val:Int) {
		ore = val;

		onChange(ore);

		return ore;
	}

	var onChange:Int->Void;

	public function new(onChange:Int->Void) {
		super();

		this.onChange = onChange;
	}

	public function collect(num:Int) {
		ore += num;
	}

	public function spend(num:Int) {
		ore -= num;
	}
}
