Пример #1
0
    def __init__(self, air, zones, avId):
        FSM.__init__(self, 'TutorialFSM')

        self.air = air
        self.zones = zones
        self.avId = avId

        npcDesc = NPCToons.NPCToonDict.get(20000)
        self.tutorialTom = NPCToons.createNPC(self.air, 20000, npcDesc, self.zones['building'])
        self.tutorialTom.setTutorial(1)

        npcDesc = NPCToons.NPCToonDict.get(20002)
        self.hqHarry = NPCToons.createNPC(self.air, 20002, npcDesc, self.zones['hq'])
        self.hqHarry.setTutorial(1)
        self.hqHarry.setHq(1)

        self.building = TutorialBuildingAI(
            self.air, self.zones['street'], self.zones['building'], 2, self.tutorialTom.getDoId())
        self.hq = HQBuildingAI(self.air, self.zones['street'], self.zones['hq'], 1)

        self.forceTransition('Introduction')
Пример #2
0
class TutorialFSM(FSM):
    def __init__(self, air, zones, avId):
        FSM.__init__(self, 'TutorialFSM')

        self.air = air
        self.zones = zones
        self.avId = avId

        npcDesc = NPCToons.NPCToonDict.get(20000)
        self.tutorialTom = NPCToons.createNPC(self.air, 20000, npcDesc, self.zones['building'])
        self.tutorialTom.setTutorial(1)

        npcDesc = NPCToons.NPCToonDict.get(20002)
        self.hqHarry = NPCToons.createNPC(self.air, 20002, npcDesc, self.zones['hq'])
        self.hqHarry.setTutorial(1)
        self.hqHarry.setHq(1)

        self.building = TutorialBuildingAI(
            self.air, self.zones['street'], self.zones['building'], 2, self.tutorialTom.getDoId())
        self.hq = HQBuildingAI(self.air, self.zones['street'], self.zones['hq'], 1)

        self.forceTransition('Introduction')

    def enterIntroduction(self):
        self.building.insideDoor.setDoorLock(FADoorCodes.TALK_TO_TOM)

    def exitIntroduction(self):
        self.building.insideDoor.setDoorLock(FADoorCodes.UNLOCKED)

    def enterBattle(self, av):
        if av:
            if (av.hasTrackAccess(0) and av.hasTrackAccess(1)) or (av.hasTrackAccess(0) and av.hasTrackAccess(2)):
                self.suit = None
                self.building.door.setDoorLock(FADoorCodes.TALK_TO_HQ)
                self.hq.door0.setDoorLock(FADoorCodes.UNLOCKED)
                self.hq.door1.setDoorLock(FADoorCodes.UNLOCKED)
            else:
                self.suit = DistributedTutorialSuitAI(self.air)
                self.suit.generateWithRequired(self.zones['street'])

                self.building.door.setDoorLock(FADoorCodes.DEFEAT_FLUNKY_TOM)
                self.hq.door0.setDoorLock(FADoorCodes.DEFEAT_FLUNKY_HQ)
                self.hq.door1.setDoorLock(FADoorCodes.DEFEAT_FLUNKY_HQ)

    def exitBattle(self):
        if self.suit:
            self.suit.requestDelete()

    def enterHQ(self):
        self.building.door.setDoorLock(FADoorCodes.TALK_TO_HQ)
        self.hq.door0.setDoorLock(FADoorCodes.UNLOCKED)
        self.hq.door1.setDoorLock(FADoorCodes.UNLOCKED)
        self.hq.insideDoor0.setDoorLock(FADoorCodes.TALK_TO_HQ)
        self.hq.insideDoor1.setDoorLock(FADoorCodes.TALK_TO_HQ)

    def enterTunnel(self):
        npcDesc = NPCToons.NPCToonDict.get(20001)
        self.flippy = NPCToons.createNPC(self.air, 20001, npcDesc, self.zones['street'], 0)

        if simbase.air.wantHalloween:
            self.BlackCatManager = DistributedBlackCatMgrAI.DistributedBlackCatMgrAI(self.air)
            self.BlackCatManager.generateWithRequired(self.zones['street'])

        self.hq.insideDoor0.setDoorLock(FADoorCodes.WRONG_DOOR_HQ)
        self.hq.insideDoor1.setDoorLock(FADoorCodes.UNLOCKED)
        self.hq.door0.setDoorLock(FADoorCodes.GO_TO_PLAYGROUND)
        self.hq.door1.setDoorLock(FADoorCodes.GO_TO_PLAYGROUND)
        self.building.door.setDoorLock(FADoorCodes.GO_TO_PLAYGROUND)

    def exitTunnel(self):
        self.flippy.requestDelete()

    def enterCleanup(self):
        self.building.cleanup()
        self.hq.cleanup()
        self.tutorialTom.requestDelete()
        self.hqHarry.requestDelete()

        self.air.deallocateZone(self.zones['street'])
        self.air.deallocateZone(self.zones['building'])
        self.air.deallocateZone(self.zones['hq'])

        del self.air.tutorialManager.avId2fsm[self.avId]