/// <summary> /// Advances Packet to the next room. /// Updates packet with new room data. /// Returns : TRUE if packet has completed dungeon /// </summary> /// <param name="packet"></param> public bool UpdatePacketToNextRoom(string packet_key) { PartyController party = m_questingParties[packet_key].GetComponent <PartyController>(); if (party != null) { // We move in the list from last->first bool completed_dungeon = (0 > party.AdvanceRoom()); if (completed_dungeon) { // TODO aherrera : Party has defeated the boss? party.SetState(PartyState.PARTY_SUCCESS); } else { RoomModel party_new_current_room = mDungeonModel.GetRoom(party.GetCurrentRoomIndex()); if (party_new_current_room != null) { InitializePacketToRoom(packet_key); } } return(completed_dungeon); } else { Debug.LogError("DungeonModel::UpdatePacketToNextRoom -- packet not found in list with string: " + packet_key); } // Hey pls don't be here // TODO aherrera : handle these kinds of errors to search out and erase traces of this packet? return(false); }
//TODO Should be in DungeonController.cs /// <summary> /// Challenge packet to their CurrentRoom. /// Returns : TRUE if party is still ALIVE /// </summary> /// <param name="packet_key"></param> /// <returns>Returns TRUE if the party is ALIVE</returns> public bool ChallengePacketInCurrentRoom(string packet_key) { GameObject party_object = m_questingParties[packet_key]; PartyController party = party_object.GetComponent <PartyController>(); if (party != null) { RoomModel party_current_room = mDungeonModel.GetRoom(party.GetCurrentRoomIndex()); if (party_current_room != null) { bool challenge_successful = party_current_room.challengeParty(party.GetAdventurers()); if (challenge_successful) { //party_packet.AwardPacket(party_current_room); } else { ResolveChallengeFailure(party, party_current_room); } } else { Debug.LogError("DungeonModel::ChallengePacketInCurrentRoom -- room not in list from packet: " + party.GetAdventureTitle()); } // TODO aherrera, wspier : like, should this logic be in the Model?? Should it be in charge to figure it out? if (party.isPartyDead()) { party.SetState(PartyState.PARTY_FAILED); NewsFeedController.instance.CreateNewAlert("Party just died! lol"); } return(!party.isPartyDead()); } else { Debug.LogError("DungeonModel::ChallengePacketInCurrentRoom -- packet not found in list with string: " + packet_key); } // Hey! Pls don't come here okay thanks return(false); }