Add method updating ui based on player stats

This commit is contained in:
Michał Czekański 2020-04-05 23:44:31 +02:00
parent a60a46cc53
commit 0fb5f925d2

View File

@ -2,6 +2,7 @@ from enum import Enum
import pygame import pygame
from src.entities.Statistics import Statistics
from src.ui.UiBar import UiBar from src.ui.UiBar import UiBar
from src.ui.UiConsole import UiConsole from src.ui.UiConsole import UiConsole
from src.ui.UiText import UiText from src.ui.UiText import UiText
@ -50,6 +51,17 @@ class Ui():
screenHeight - self.timerTextView.rect.h - self.isDayTextView.rect.h), screenHeight - self.timerTextView.rect.h - self.isDayTextView.rect.h),
font=self.font) font=self.font)
def updateBasedOnPlayerStats(self, statistics: Statistics):
self.healthBar.updateFill(statistics.hp)
self.hungerBar.updateFill(statistics.hunger)
self.staminaBar.updateFill(statistics.stamina)
self.thirstBar.updateFill(statistics.thirst)
def updateBasedOnPygameEvent(self, event: pygame.event):
pass
class Colors(Enum): class Colors(Enum):
RED = (255, 0, 0) RED = (255, 0, 0)