public string AddPartyToDungeon(GameObject new_party) { PartyController pc = new_party.GetComponent <PartyController>(); // TODO aherrera : probably make sure i'm unique string packet_key = checkDictionaryForKey(pc.GetAdventureTitle()); m_questingParties.Add(packet_key, new_party); InitializePacketToRoom(packet_key, mDungeonModel.GetEntrance()); return(packet_key); }
// TODO aherrera : DEBUG SCRIPT; kill this before it's too late public void AddRandomParty() { GameObject new_Adventurer = Instantiate(AdventurerPrefab); AdventurerModel new_model = AdventurerGenerator.instance.GenerateRandom(ref new_Adventurer, 1, Enums.UnitRarity.e_rarity_COMMON); GameObject new_party = new GameObject(); PartyModel new_party_model = new_party.AddComponent <PartyModel> (); PartyController new_party_controller = new_party.AddComponent <PartyController> (); //AdventurerPacket newpackofcigs = go_adventurerpacket.AddComponent<AdventurerPacket>(); new_party.name = checkDictionaryForKey(new_party_controller.GetAdventureTitle()); new_party_controller.InitializeParty(); new_party_model._Adventurers.Add(new_Adventurer); RoomModel room_model = mDungeonModel.GetRoom(new_party_controller.GetCurrentRoomIndex()); AddNewParty(new_party, true); new_party_controller.BeginRoom(room_model.timer_frequency); }
//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); }