import mwpy_gameobject
import time

clock = time.clock

MWPYGameObject = mwpy_gameobject.MWPYGameObject
MWPYGameObjectType = mwpy_gameobject.MWPYGameObjectType
MWPYGameObjectState = mwpy_gameobject.MWPYGameObjectState


class MWPYPortal(MWPYGameObject):
	def __init__(self, gameObjectType = MWPYGameObjectType['MWGOT_PORTAL']):
		MWPYGameObject.__init__(self, gameObjectType)
		self.play_mode_time = 3
		self.current_time = clock()
		self.is_portal = True

	def can_render(self):
		return True
	def can_update(self):
		return True
	def do_update(self, delta, currenttime, world_dict):
		currenttime =  clock()
		if(self.state == MWPYGameObjectState['AS_PLAY']):
			if((currenttime - self.current_time) > self.play_mode_time):
				self.state = MWPYGameObjectState['AS_NONE']

