package Alexandria

import HashMap

public HashMap<int, MobWrapper> mobMap = new HashMap<int, MobWrapper>
public HashMap<int, TowerWrapper> towerMap = new HashMap<int, TowerWrapper>

public abstract class TowerWrapper
    unit u

    construct(unit u)
        this.u = u
        towerMap.put(this.u.getHandleId(), this)

    function getUnit() returns unit
        return this.u

    ondestroy
        towerMap.remove(this.u.getHandleId())

public class EmptyMobWrapper extends MobWrapper
    construct(unit u)
        super(u)

public abstract class MobWrapper implements Spawner, Enterer, Deather, Ender, Ticker
    unit u

    construct(unit u)
        this.u = u
        mobMap.put(this.u.getHandleId(), this)

    function getUnit() returns unit
        return this.u

    function onSpawn()
        skip

    function onEnter()
        skip

    function onEnd() returns bool
        return false

    function onDeath()
        skip

    function startTick()
        skip

    ondestroy
        mobMap.remove(this.u.getHandleId())
        u.remove()

public interface Spawner
    function onSpawn()

public interface Enterer
    function onEnter()

public interface Deather
    function onDeath()

public interface Ender
    function onEnd() returns bool

public interface Ticker
    function startTick()
