home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Singles (French)
/
Singles-FrenchVersion-Win95.iso
/
data1.cab
/
Statemachine
/
dishwasherChar.lua
< prev
next >
Wrap
Text File
|
2004-03-05
|
2KB
|
82 lines
-- dishwasher character state machine
beginStateMachine()
onEnter(function(msg)
--local dishwasher = getStateObjectFromID(msg.sender);
local dishwasher = getStoredOrSender("dishwasher", msg)
storeStateObject("dishwasher", dishwasher);
if (dishwasher) then
-- dishwasher does exist
if (getParent().isOneActionPointLocked(dishwasher)) then
-- action point is locked
getParent().setEmoticon(EMOTICON_CANNOT, EMOTICON_DELAY);
sendMsg("emoThink", getParent().walkSO);
exitStateMachine();
else
getParent().lockActionPoints(dishwasher);
end
else
-- dishwasher does not exist anymore
getParent().setEmoticon(EMOTICON_CANNOT, EMOTICON_DELAY);
sendMsg("emoThink", getParent().walkSO);
exitStateMachine();
end
--freeHands(getParent());
end )
onExit(function(msg)
-- local dishwasher = retrieveStateObject("dishwasher");
-- getParent().unlockActionPoints(dishwasher);
-- getParent().stopAllActivities(dishwasher);
-- removeStateObject("dishwasher");
unlockAll("dishwasher");
getParent().stopAllActivities();
end )
state("washDishes")
onEnter(function(msg)
getParent().handSO.stopAnimation(0.0);
startAnimation("loadDishwasher", true, 1.0, 0.0);
local dishwasher = retrieveStateObject("dishwasher");
dishwasher.startAnimation("dishwasher");
sendDelayedMsgThis("openSound", 1300);
sendDelayedMsgThis("openSound", 4200);
sendDelayedMsgThis("dropDishes", 2000);
end )
onMsg("openSound", function(msg)
local dishwasher = retrieveStateObject("dishwasher");
dishwasher.playSound("fridgeOpen");
end)
onMsg("dropDishes", function(msg)
local dishHeap = getParent().getRightHeldObject();
if (dishHeap) then dishHeap.deleteGameObject(); end
getParent().detachRightObjectHolder();
getParent().playSound("dishwasherLoad");
--getParent().playSound("stackPlates");
end )
onMsg("end", function(msg)
local dishwasher = retrieveStateObject("dishwasher");
dishwasher.playSound("dishwasherStart");
exitAndGoAway();
end )
endStateMachine()