import mwpy_gameobject

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



class MWPYGate(MWPYGameObject):
	def __init__(self, gameObjectType = MWPYGameObjectType['MWGOT_GATE']):
		MWPYGameObject.__init__(self, gameObjectType)
		self.last_contact_time = clock()
		self.step = 0.001
		self.state = MWPYGameObjectState['AS_LEFT']
		self.status = 'AS_LEFT'
		self.last_delta = 0
		self.up_border = 0
		self.bigwater_id = 0

	def switchon(self):
	       self.status = 'AS_RIGHT'
	       self.state = MWPYGameObjectState[self.status]

	def do_update(self, delta, currenttime, world_dict):
		if self.state == MWPYGameObjectState['AS_PLAY']:
			if (clock() - self.last_contact_time) < 2:
				self.last_delta += delta
				return
		self.state = MWPYGameObjectState[self.status]




