--
PROP_NEUTRAL = 0
PROP_ACTIVE = 1

--
Object_Dictionary = {}
Game_Objects = {}

-- Meta class
GameObject = {ID = 0, PosX=0, PosY=0, TileX=0, TileY=0, Type=0, Prop=False, Direction =0}

-- Base class method new
function GameObject:new (o, ID, PosX, PosY, TileX, TileY, Type, Prop, Direction)
o = o or {}
setmetatable(o, self)
self.__index = self
self.ID = ID
self.PosX = PosX
self.PosY = PosY
self.TileX = TileX
self.TileY = TileY
self.Type = Type
self.Prop = Prop
self.Direction = Direction
return o
end

-- Base class sync
function GameObject:sync(a,b,c,d,e)
    self.PosX = a
    self.PosY = b
    self.TileX = c
    self.TileY = d
    self.Direction = e
end

function syncObject(ID, posX, posY, tileX, tileY, direction)
    Game_Objects[ID]:sync(posX,posY,tileX,tileY,direction)
end


-- Base class method scare
function GameObject:scare (ID,amount)
    displayDialog("This Object has no AI and was scared by " .. ID .. " for " .. amount .. " amount");
end

-- Base class method possess
function GameObject:possess (ID,amount)
    displayDialog("This Object has no AI", 2.0);
end

function GameObject:think()
    if (self.ThinkDebut==nil) then
        displayDialog("This Object has no AI", 2.0);
        self.ThinkDebut=true;
    end
end


function addObject(UID,xPos,yPos,tileX,tileY,type,prop,direction)
    if Game_Objects[UID]==nil then
        insertObject = Object_Dictionary[type]:new()
        insertObject.PosX=xPos
        insertObject.PosY=yPos
        insertObject.TileX=tileX
        insertObject.TileY=tileY
        insertObject.ID = UID
        insertObject.direction=direction
        Game_Objects[UID]=insertObject
    end
end




