Exemplo n.º 1
0
    def __init__(self, air, partyDoId, x, y, h, actId, phaseToMusicData):
        self.notify.debug("Intializing.")
        DistributedPartyActivityAI.__init__(
            self, air, partyDoId, x, y, h, actId,
            PartyGlobals.ActivityTypes.Continuous)

        # Holds the list of songs requested by each avatar.
        # Format: { toonId : (phase, filename), ... }
        self.phaseToMusicData = phaseToMusicData
        self.toonIdToSongData = {}
        # Holds the queue of songs to be played by avatarId
        self.toonIdQueue = []

        self.songPlaying = False
        self.songTimerTask = None

        self.timeoutTask = None

        # listen for fireworks show starting and stopping
        self.accept(PartyGlobals.FireworksStartedEvent,
                    self.__handleFireworksStarted)
        self.accept(PartyGlobals.FireworksFinishedEvent,
                    self.__handleFireworksFinished)

        # this ensure the first song we hear is one of the new ones
        self.randomSongPhase = 13
Exemplo n.º 2
0
 def __init__(self, air, partyDoId, x, y, h):
     DistributedPartyActivityAI.__init__(
         self, air, partyDoId, x, y, h, PartyGlobals.ActivityIds.PartyCatch,
         PartyGlobals.ActivityTypes.HostInitiated)
     self.toonIdsToScores = {}
     # create state machine and set initial state
     self.activityFSM = CatchActivityFSM(self)
 def __init__(self, air, parent, activityTuple):
     DistributedPartyActivityAI.__init__(self, air, parent, activityTuple)
     FSM.__init__(self, 'DistributedPartyTrampolineActivityAI')
     self.currentAv = 0
     self.record = 0
     self.jellybeans = []
     self.collected = 0
 def __init__(self, air, parent, activityTuple):
     DistributedPartyActivityAI.__init__(self, air, parent, activityTuple)
     self.numGenerations = 1
     self.generations = []
     self.player2catches = {}
     self.startTimestamp = globalClockDelta.getRealNetworkTime(bits=32)
     self.playing = False
 def __init__(self, air, parent, activityTuple):
     DistributedPartyActivityAI.__init__(self, air, parent, activityTuple)
     self.music = PartyGlobals.PhaseToMusicData40
     self.queue = []
     self.owners = []
     self.currentToon = 0
     self.playing = False
 def __init__(self, air, parent, activityTuple):
     DistributedPartyActivityAI.__init__(self, air, parent, activityTuple)
     self.numGenerations = 1
     self.generations = []
     self.player2catches = {}
     self.startTimestamp = globalClockDelta.getRealNetworkTime(bits=32)
     self.playing = False
 def __init__(self, air, parent, activityTuple):
     DistributedPartyActivityAI.__init__(self, air, parent, activityTuple)
     self.music = PartyGlobals.PhaseToMusicData40
     self.queue = []
     self.owners = []
     self.currentToon = 0
     self.playing = False
 def __init__(self, air, parent, activityTuple):
     DistributedPartyActivityAI.__init__(self, air, parent, activityTuple)
     FSM.__init__(self, 'DistributedPartyTrampolineActivityAI')
     self.currentAv = 0
     self.record = 0
     self.jellybeans = []
     self.collected = 0
Exemplo n.º 9
0
 def __init__(self, air, partyDoId, x, y, h, activityId,
              dancePatternToAnims):
     self.notify.debug("Intializing.")
     DistributedPartyActivityAI.__init__(
         self, air, partyDoId, x, y, h, activityId,
         PartyGlobals.ActivityTypes.Continuous)
     self.toonIdsToHeadings = {}  # toon's heading when it joined
     self.dancePatternToAnims = dancePatternToAnims
Exemplo n.º 10
0
 def __init__(self, air, parent, activityTuple):
     DistributedPartyActivityAI.__init__(self, air, parent, activityTuple)
     self.music = PartyGlobals.PhaseToMusicData40
     self.queue = []
     self.owners = []
     self.currentToon = 0
     self.playing = False
     self.paused = False
     self.accept('fireworksStarted%i' % self.getPartyDoId(),
                 self.handleFireworksStart)
     self.accept('fireworksFinished%i' % self.getPartyDoId(),
                 self.handleFireworksEnd)
    def __init__(self, air, partyDoId, x, y, h):
        DistributedPartyActivityAI.__init__(
            self, air, partyDoId, x, y, h,
            PartyGlobals.ActivityIds.PartyCannon,
            PartyGlobals.ActivityTypes.Continuous)

        # map of cannons by cannon doId
        self.cannons = {}
        # map of flying toon doIds to firing cannons doIds
        self.flyingToons = {}
        self.flyingToonCloudsHit = {}
        self.toonIdsToJellybeanRewards = {}

        # Map of cloudNumber to rgb info
        self.cloudColors = {}
Exemplo n.º 12
0
    def __init__(self,
                 air,
                 partyDoId,
                 x,
                 y,
                 h,
                 actId=PartyGlobals.ActivityIds.PartyTrampoline):
        DistributedPartyActivityAI.__init__(
            self, air, partyDoId, x, y, h, actId,
            PartyGlobals.ActivityTypes.GuestInitiated)

        self.activityFSM = TrampolineActivityFSM(self)
        # bestHeightInfo is a tuple of toon's name and their height
        self.bestHeightInfo = ("", 0)
        self.accept("NewBestHeightInfo", self.newBestHeightInfo)
 def __init__(self, air, parent, activityTuple, isTF=False):
     DistributedPartyActivityAI.__init__(self, air, parent, activityTuple)
     self.cloudColors = {}
     self.cloudsHit = {}
     self.isTF = isTF
 def __init__(self, air, parent, activityTuple):
     DistributedPartyActivityAI.__init__(self, air, parent, activityTuple)
     FSM.__init__(self, 'DistributedPartyActivityAI')
     self.state = 'Idle'
Exemplo n.º 15
0
    def __init__(self, air, parent, activityTuple):
        self.toonIds = ([], [])
        self.responses = set()
        self.fsm = TeamActivityAIFSM(self)

        DistributedPartyActivityAI.__init__(self, air, parent, activityTuple)
 def __init__(self, air, parent, activityTuple):
     DistributedPartyActivityAI.__init__(self, air, parent, activityTuple)
     self.cloudColors = {}
     self.cloudsHit = {}
    def __init__(
        self,
        air,
        partyDoId,
        x,
        y,
        h,
        activityId,
        minPlayersPerTeam=PartyGlobals.TeamActivityDefaultMinPlayersPerTeam,
        maxPlayersPerTeam=PartyGlobals.TeamActivityDefaultMaxPlayersPerTeam,
        duration=PartyGlobals.TeamActivityDefaultDuration,
        conclusionDuration=PartyGlobals.TeamActivityDefaultConclusionDuration,
        startDelay=PartyGlobals.TeamActivityStartDelay,
        balanceTeams=False,
        calcAdvantage=False,
        canSwitchTeams=False,
    ):
        DistributedPartyActivityAI.__init__(
            self,
            air,
            partyDoId,
            x,
            y,
            h,
            activityId,
            PartyGlobals.ActivityTypes.GuestInitiated,
        )
        self.notify.debug("__init__")

        self._minPlayersPerTeam = minPlayersPerTeam
        self._maxPlayersPerTeam = maxPlayersPerTeam

        # How long should the conclusion state last in seconds?
        self._conclusionDuration = conclusionDuration

        # How long the active state lasts
        self._duration = simbase.config.GetFloat(
            "party-team-activity-duration", duration)

        # How long should it wait for more players before going to the active state
        self._startDelay = simbase.config.GetFloat(
            "party-team-activity-start-delay", startDelay)

        # Should it calculate whether both team have roughly an equal amount of players?
        self._shouldBalanceTeams = balanceTeams

        # Should it calculate the advantage of a smaller team over a larger team?
        self._shouldCalcAdvantage = calcAdvantage

        # Can players willingly switch teams before the game starts?
        self._canSwitchTeams = canSwitchTeams

        # Do we allow a single player? (This is for testing purposes)
        self._allowSinglePlayer = simbase.config.GetBool(
            "party-team-activity-single-player", False)

        self.toonIds = (
            [],  # doIds of toons on the left team, ordered from those nearest the water to those furthest
            [],  # doIds of toons on the right team, ordered from those nearest the water to those furthest
        )

        self.readyToonIds = set()

        # Keep track of which side each avatar is on for quick look up during game
        self.toonIdsToTeams = {}

        # state transition request doLater
        self._srTask = None

        self.activityFSM = TeamActivityAIFSM(self)
 def __init__(self, air, parent, activityTuple):
     DistributedPartyActivityAI.__init__(self, air, parent, activityTuple)
     self.toons = []
     self.headings = []
 def __init__(self, air, parent, activityTuple):
     DistributedPartyActivityAI.__init__(self, air, parent, activityTuple)
     FSM.__init__(self, 'DistributedPartyActivityAI')
     self.state_ = 'Idle'
 def __init__(self, air, parent, activityTuple):
     DistributedPartyActivityAI.__init__(self, air, parent, activityTuple)
     self.toons = []
     self.headings = []
 def __init__(self, air, parent, activityTuple):
     self.toonIds = ([], [])
     self.responses = set()
     self.fsm = TeamActivityAIFSM(self)
     DistributedPartyActivityAI.__init__(self, air, parent, activityTuple)