Refactor: interactable now has methods from pickupable
This commit is contained in:
parent
c69c923d31
commit
c6ab7cc2f4
@ -2,23 +2,13 @@ from src.entities.Entity import Entity
|
|||||||
|
|
||||||
|
|
||||||
class Interactable(Entity):
|
class Interactable(Entity):
|
||||||
|
def __init__(self, texture, size, pos, Statistics):
|
||||||
|
super().__init__(texture, size, pos, Statistics)
|
||||||
|
self.Statistics = Statistics
|
||||||
|
|
||||||
def __init__(self, texture, pos, id):
|
def on_interaction(self, Player):
|
||||||
super().__init__(texture, pos, id)
|
Player.statistics.set_hp(self.Statistics.hp)
|
||||||
|
Player.statistics.set_stamina(self.Statistics.stamina)
|
||||||
@staticmethod
|
Player.statistics.set_thirst(self.Statistics.thirst)
|
||||||
def interact_with_hp(hp, Statistics):
|
Player.statistics.set_hunger(self.Statistics.hunger)
|
||||||
Statistics.set_hp(hp)
|
|
||||||
|
|
||||||
@staticmethod
|
|
||||||
def interact_with_hunger(hunger, Statistics):
|
|
||||||
Statistics.set_hunger(hunger)
|
|
||||||
|
|
||||||
@staticmethod
|
|
||||||
def interact_with_thirst(thirst, Statistics):
|
|
||||||
Statistics.set_thirst(thirst)
|
|
||||||
|
|
||||||
@staticmethod
|
|
||||||
def interact_with_stamina(stamina, Statistics):
|
|
||||||
Statistics.set_stamina(stamina)
|
|
||||||
|
|
||||||
|
@ -1,4 +1,3 @@
|
|||||||
from src.entities import Statistics, Player
|
|
||||||
from src.entities.Interactable import Interactable
|
from src.entities.Interactable import Interactable
|
||||||
|
|
||||||
|
|
||||||
@ -6,11 +5,4 @@ class Pickupable(Interactable):
|
|||||||
def __init__(self, texture, size, pos, Statistics):
|
def __init__(self, texture, size, pos, Statistics):
|
||||||
super().__init__(texture, size, pos)
|
super().__init__(texture, size, pos)
|
||||||
self.is_pickupable = True
|
self.is_pickupable = True
|
||||||
self.Statistics = Statistics
|
|
||||||
|
|
||||||
def on_pickup(self, Player):
|
|
||||||
Player.statistics.set_hp(self.Statistics.hp)
|
|
||||||
Player.statistics.set_stamina(self.Statistics.stamina)
|
|
||||||
Player.statistics.set_thirst(self.Statistics.thirst)
|
|
||||||
Player.statistics.set_hunger(self.Statistics.hunger)
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user