1
0
python-roguelike/components/base_component.py

21 lines
415 B
Python
Raw Normal View History

2022-01-07 16:39:37 -05:00
from __future__ import annotations
from typing import TYPE_CHECKING
if TYPE_CHECKING:
from engine import Engine
from entity import Entity
2022-01-12 13:45:52 -05:00
from game_map import GameMap
2022-01-07 16:39:37 -05:00
class BaseComponent:
2022-01-12 13:45:52 -05:00
parent: Entity # Owning entity instance
@property
def gamemap(self) -> GameMap:
return self.parent.gamemap
2022-01-07 16:39:37 -05:00
@property
def engine(self) -> Engine:
2022-01-12 13:45:52 -05:00
return self.gamemap.engine