當前位置: 首頁>>代碼示例>>Python>>正文


Python StateMachine.states方法代碼示例

本文整理匯總了Python中statemachine.StateMachine.states方法的典型用法代碼示例。如果您正苦於以下問題:Python StateMachine.states方法的具體用法?Python StateMachine.states怎麽用?Python StateMachine.states使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在statemachine.StateMachine的用法示例。


在下文中一共展示了StateMachine.states方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: StateMachine

# 需要導入模塊: from statemachine import StateMachine [as 別名]
# 或者: from statemachine.StateMachine import states [as 別名]
#defining the colors ahead of time so I can easily call them when needed.

# === Init Stuff === #

# Here the statemachine object is created. 
# stateDefault is set to be run as the first state.
buttonStateMachine = StateMachine()
buttonStateMachine.activeState = stateDefault
buttonStateMachine.nextState = stateDefault
# The different state functions are added to the states dictionary.
# the left part is the key, the right part the value
buttonStateMachine.states = {
	'default': stateDefault,
    'lookButton': stateLook,
    'openButton': stateOpen,
    'useButton': stateUse,
    'goButton': stateGo
    }

buttonDict = {	
	(0, 111, 500, 50): 'lookButton',
	(113, 111, 500, 50): 'openButton',
	(226, 111, 500, 50): 'useButton',
	(338, 111, 500, 50): 'goButton'  
	}

# === Room Image === #

backgroundImage = "room_pictures/1firstroom.png"
開發者ID:samjar,項目名稱:Suhvaaage,代碼行數:31,代碼來源:fsmfreddy.py


注:本文中的statemachine.StateMachine.states方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。