コード例 #1
0
ファイル: DungeonController.cs プロジェクト: abnerrd/NBMRepo
    //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);
    }