Пример #1
0
    // data this model uses
    //private ProtoCharacterData m_data;
    //public ProtoCharacterData GetData() {
    //    return m_data;
    //}

    //////////////////////////////////////////
    /// Awake()
    //////////////////////////////////////////
    void Awake()
    {
        // init data asap
        if (Name == "Goblin")
        {
            ProtoCharacterData data = IDL_ProtoCharacters.GetCharacter(Name);

            // set various things
            SetProperty("HP", data.HP);
            SetProperty("Abilities", data.Abilities);
            SetProperty("Name", data.Name);
        }
        else
        {
            // load the player's data
            PlayerData data = PlayerLoader.LoadPlayer();

            SetProperty("HP", data.GetMaxHP());
            SetProperty("Name", data.Name);
            SetProperty("Abilities", data.GetAbilities());
        }

        SetProperty("Effects", new Dictionary <string, Effect>());

        // listen for messages
        ListenForMessages(true);
    }
Пример #2
0
    //////////////////////////////////////////
    /// Awake()
    //////////////////////////////////////////
    void Awake()
    {
        // load the player's data
        PlayerData data = PlayerLoader.LoadPlayer();

        // set various properties based on our data
        SetProperty("XP", data.XP);
        SetProperty("Perks", data.Perks);

        // send out a message about all the perks the player has
        //foreach ( KeyValuePair<string,int> pair in data.Perks ) {
        //Messenger.Broadcast<string, int>( "SetPerk", pair.Key, pair.Value );
        //}
    }
Пример #3
0
        /**
         * Load the players current party into the game
         */
        public static Party LoadParty()
        {
            List <PartyReference> reference = PartyRepository.LoadParty();

            try
            {
                if (party != null)
                {
                    return(party);
                }
                else
                {
                    party = new Party();

                    List <PartyReference> pr = PartyRepository.LoadParty();
                    pr.ForEach(partyReference =>
                    {
                        Player player          = PlayerLoader.LoadPlayer(partyReference.Code);
                        player.isCurrentPlayer = partyReference.IsCurrentPlayer;
                        player.startX          = partyReference.X;
                        player.startY          = partyReference.Y;
                        party.CharacterConfiguration[partyReference.Position] = player;
                        if (partyReference.IsCurrentPlayer)
                        {
                            party.CurrentPlayer = player;
                        }
                    });
                }
            }
            catch (MissingReferenceException e)
            {
                party = null;
                LoadParty();
                //TEMP
                print(e.Message);
            }
            return(party);
        }