示例#1
0
    public Item LoadItem(SaveItemClass i)
    {
        Item _result = null;

        _result.itm_Name           = i.itm_Name;
        _result.itm_Desc           = i.itm_Desc;
        _result.itm_FullName       = i.itm_FullName;
        _result.itm_Lore           = i.itm_Lore;
        _result.itm_Type           = i.itm_Type;
        _result.itm_Slot           = i.itm_Slot;
        _result.itm_Value          = i.itm_Value;
        _result.itm_Quality        = i.itm_Quality;
        _result.itm_AttackBonus    = i.itm_AttackBonus;
        _result.itm_MinDamage      = i.itm_MinDamage;
        _result.itm_MaxDamage      = i.itm_MaxDamage;
        _result.itm_DefenseBonus   = i.itm_DefenseBonus;
        _result.itm_MaxCharges     = i.itm_MaxCharges;
        _result.itm_MaxFuel        = i.itm_MaxFuel;
        _result.itm_Icon           = i.itm_Icon;
        _result.itm_ID_Quality     = i.itm_ID_Quality;
        _result.itm_ID_Damage      = i.itm_ID_Damage;
        _result.itm_ID_Defense     = i.itm_ID_Defense;
        _result.itm_ID_Charges     = i.itm_ID_Charges;
        _result.itm_ID             = i.itm_ID;
        _result.itm_Active         = i.itm_Active;
        _result.itm_CurrentCharges = i.itm_CurrentCharges;
        _result.itm_CurrentFuel    = i.itm_CurrentFuel;


        return(_result);
    }
示例#2
0
 public Item LoadItem(SaveItemClass _itm)
 {
     this.itm_Name           = _itm.itm_Name;
     this.itm_Desc           = _itm.itm_Desc;
     this.itm_FullName       = _itm.itm_FullName;
     this.itm_Lore           = _itm.itm_Lore;
     this.itm_Magical        = _itm.itm_Magical;
     this.itm_Cursed         = _itm.itm_Cursed;
     this.itm_Type           = _itm.itm_Type;
     this.itm_Slot           = _itm.itm_Slot;
     this.itm_Value          = _itm.itm_Value;
     this.itm_Quality        = _itm.itm_Quality;
     this.itm_AttackBonus    = _itm.itm_AttackBonus;
     this.itm_MinDamage      = _itm.itm_MinDamage;
     this.itm_MaxDamage      = _itm.itm_MaxDamage;
     this.itm_DefenseBonus   = _itm.itm_DefenseBonus;
     this.itm_MaxCharges     = _itm.itm_MaxCharges;
     this.itm_MaxFuel        = _itm.itm_MaxFuel;
     this.itm_Icon           = _itm.itm_Icon;
     this.itm_ID_Quality     = _itm.itm_ID_Quality;
     this.itm_ID_AttackBonus = _itm.itm_ID_AttackBonus;
     this.itm_ID_Damage      = _itm.itm_ID_Damage;
     this.itm_ID_Defense     = _itm.itm_ID_Defense;
     this.itm_ID_Charges     = _itm.itm_ID_Charges;
     this.itm_ID             = _itm.itm_ID;
     this.itm_Active         = _itm.itm_Active;
     this.itm_CurrentCharges = _itm.itm_CurrentCharges;
     this.itm_CurrentFuel    = _itm.itm_CurrentFuel;
     return(this);
 }
 public SaveChestClass(Item[] i)
 {
     for (int _i = 0; _i < 16; _i++)
     {
         if (i[_i] != null)
         {
             inventory[_i] = new SaveItemClass(i[_i]);
         }
         if (i[_i] == null)
         {
             inventory[_i] = null;
         }
     }
 }
示例#4
0
    public void UpdateSaveSlot(int thisLevel)
    {
        //Same as in initialization, want to update this every time the game is saved
        for (int _p = 0; _p < GameManager.PARTYSIZE; _p++)
        {
            PC.Add(new SaveCharacterClass(GameManager.PARTY.PC[_p]));
        }
        for (int _i = 0; _i < 20; _i++)
        {
            if (GameManager.PARTY.bagInventory[_i] != null)
            {
                bagInventory[_i] = new SaveItemClass(GameManager.PARTY.bagInventory[_i]);
            }
        }
        wealth = GameManager.PARTY.wealth;
        light  = GameManager.PARTY.light;
        currentDungeonLevel = UnityEngine.SceneManagement.SceneManager.GetActiveScene().buildIndex;
        xCoord      = (int)GameManager.PARTY.transform.position.x;
        yCoord      = (int)GameManager.PARTY.transform.position.z;
        face_xCoord = GameManager.PARTY.FaceMe.transform.position.x;
        face_yCoord = GameManager.PARTY.FaceMe.transform.position.y;
        face_zCoord = GameManager.PARTY.FaceMe.transform.position.z;
        facing      = GameManager.PARTY.facing;

        //Save data for this level only
        List <GameObject> chestlist = new List <GameObject>(); List <GameObject> lootList = new List <GameObject>(); List <GameObject> doorList = new List <GameObject>();
        List <GameObject> spawnerList = new List <GameObject>();

        FindAllChildrenWithTag(GameManager.GAME.Levels[thisLevel].transform, "Chest", chestlist);   //Make a list of chests
        FindAllChildrenWithTag(GameManager.GAME.Levels[thisLevel].transform, "GridNode", lootList); //Make a list of loot
        FindAllChildrenWithTag(GameManager.GAME.Levels[thisLevel].transform, "MapDoor", doorList);  //Make a list of doors
        foreach (GameObject _spawnr in GameObject.FindGameObjectsWithTag("Spawner"))
        {
            spawnerList.Add(_spawnr);                                                                         //Make a list of spawners
        }
        if (chestlist.Count > 0)
        {
            for (int _i = 0; _i < chestlist.Count; _i++)
            {
                Levels[thisLevel].chest[_i] = new SaveChestClass(chestlist[_i].GetComponent <Hello_I_am_a_chest>().inventory);                                                              //Save the chests to the save slot
            }
        }
        if (lootList.Count > 0)
        {
            for (int _i = 0; _i < lootList.Count; _i++)
            {
                Levels[thisLevel].loot[_i] = new SaveLootClass(lootList[_i].GetComponent <GridNode>().inventory); //Save the loot to the save slot\
                Levels[thisLevel].trap[_i] = new SaveTrapClass(lootList[_i].GetComponent <GridNode>());           //Save trap data
            }
        }
        if (doorList.Count > 0)
        {
            for (int _i = 0; _i < doorList.Count; _i++)
            {
                Levels[thisLevel].door[_i] = new SaveDoorClass(doorList[_i].GetComponent <Hello_I_am_a_Door>());
            }
        }
        if (spawnerList.Count > 0)
        {
            for (int _i = 0; _i < spawnerList.Count; _i++)
            {
                Levels[thisLevel].SpawnTimer[_i] = spawnerList[_i].GetComponent <Spawner>().timer;
                if (spawnerList[_i].transform.childCount > 0)
                {
                    for (int _p = 0; _p < spawnerList[_i].transform.childCount; _p++)
                    {
                        SaveMobLogicClass _thisOne = new SaveMobLogicClass(spawnerList[_i].transform.GetChild(_p).GetComponent <MobLogic>());
                        spawnerList[_i].transform.GetChild(_p).GetComponent <MobLogic>().mob_data.xCoord = spawnerList[_i].transform.GetChild(_p).transform.localPosition.x;
                        spawnerList[_i].transform.GetChild(_p).GetComponent <MobLogic>().mob_data.yCoord = spawnerList[_i].transform.GetChild(_p).transform.localPosition.z;
                        Levels[thisLevel].Spawn[_i].InsertKiddo(_p, _thisOne, spawnerList[_i].transform.GetChild(_p).transform.localPosition.x, spawnerList[_i].transform.GetChild(_p).transform.localPosition.z);
                    }
                }
            }
        }
    }
示例#5
0
    public SaveSlot()
    {
        //Load Party members into SaveSlot
        for (int _p = 0; _p < GameManager.PARTYSIZE; _p++)
        {
            PC.Add(new SaveCharacterClass(GameManager.PARTY.PC[_p]));
        }

        //Load party baggage into SaveSlot
        for (int _i = 0; _i < 20; _i++)
        {
            if (GameManager.PARTY.bagInventory[_i] != null)
            {
                bagInventory[_i] = new SaveItemClass(GameManager.PARTY.bagInventory[_i]);
            }
        }

        //Load Party variables into SaveSlot
        wealth = GameManager.PARTY.wealth;
        light  = GameManager.PARTY.light;
        currentDungeonLevel = UnityEngine.SceneManagement.SceneManager.GetActiveScene().buildIndex;
        xCoord      = (int)GameManager.PARTY.transform.position.x;
        yCoord      = (int)GameManager.PARTY.transform.position.z;
        face_xCoord = GameManager.PARTY.FaceMe.transform.position.x;
        face_yCoord = GameManager.PARTY.FaceMe.transform.position.y;
        face_zCoord = GameManager.PARTY.FaceMe.transform.position.z;
        facing      = GameManager.PARTY.facing;

        //Initialize Level List by grabbing data from all levels in the GameManager.GAME.Levels array
        List <GameObject> chestlist = new List <GameObject>(); List <GameObject> lootList = new List <GameObject>(); List <GameObject> doorList = new List <GameObject>();//Need these lists later
        List <GameObject> spawnerList = new List <GameObject>();

        for (int _l = 0; _l < GameManager.GAME.Levels.Length; _l++)
        {
            Levels.Add(new SaveLevelClass());                                                    //start by adding an entry to the list

            chestlist.Clear(); lootList.Clear();                                                 //make sure the lists are empty.

            FindAllChildrenWithTag(GameManager.GAME.Levels[_l].transform, "Chest", chestlist);   //Make a list of chests
            FindAllChildrenWithTag(GameManager.GAME.Levels[_l].transform, "GridNode", lootList); //Make a list of loot
            FindAllChildrenWithTag(GameManager.GAME.Levels[_l].transform, "MapDoor", doorList);  //Make a list of doors
            foreach (GameObject _spawnr in GameObject.FindGameObjectsWithTag("Spawner"))
            {
                spawnerList.Add(_spawnr);                                                                          //Make a list of spawners
            }
            if (chestlist.Count > 0)
            {
                foreach (GameObject _ch in chestlist)
                {
                    Levels[_l].chest.Add(new SaveChestClass(_ch.GetComponent <Hello_I_am_a_chest>().inventory));                                                       //Save the chests to the save slot
                }
            }
            if (lootList.Count > 0)
            {
                foreach (GameObject _lt in lootList)
                {
                    Levels[_l].loot.Add(new SaveLootClass(_lt.GetComponent <GridNode>().inventory)); //Save the loot to the save slot
                    Levels[_l].trap.Add(new SaveTrapClass(_lt.GetComponent <GridNode>()));           //Save the trap data from Gridnodes
                }
            }
            if (doorList.Count > 0)
            {
                foreach (GameObject _dr in doorList)
                {
                    Levels[_l].door.Add(new SaveDoorClass(_dr.GetComponent <Hello_I_am_a_Door>()));
                }
            }
            if (spawnerList.Count > 0)
            {
                foreach (GameObject _sp in spawnerList)
                {
                    Levels[_l].SpawnTimer.Add(_sp.GetComponent <Spawner>().timer);

                    _sp.GetComponent <Spawner>().InitialSpawn(); //Kick off initial spawn of spawners
                    Levels[_l].Spawn.Add(new SaveLevelClass.SpawnChildren(_sp.GetComponent <Spawner>()));
                }
            }
        }
    }
    public SaveCharacterClass(Character c)
    {
        this.pc_Name           = c.pc_Name;
        this.pc_Class          = c.pc_Class;
        this.pc_PortraintIndex = c.pc_PortraintIndex;
        this.pc_HP             = c.pc_HP; this.pc_Max_HP = c.pc_Max_HP; this.pc_MP = c.pc_MP; this.pc_Max_MP = c.pc_Max_MP;
        this.pc_XP_Level       = c.pc_XP_Level; this.pc_XP = c.pc_XP; this.pc_XP_NNL = c.pc_XP_NNL;
        this.pc_Base_Str       = c.pc_Base_Str; this.pc_Str_Mod = c.pc_Str_Mod;
        this.pc_Base_Dex       = c.pc_Base_Dex; this.pc_Dex_Mod = c.pc_Dex_Mod;
        this.pc_Base_IQ        = c.pc_Base_IQ; this.pc_IQ_Mod = c.pc_IQ_Mod;
        this.pc_Base_Wis       = c.pc_Base_Wis; this.pc_Wis_Mod = c.pc_Wis_Mod;
        this.pc_Base_Charm     = c.pc_Base_Charm; this.pc_Charm_Mod = c.pc_Charm_Mod;
        this.pc_Base_Health    = c.pc_Base_Health; this.pc_Health_Mod = c.pc_Health_Mod;
        this.skills            = c.skills;
        this.pc_Defense        = c.pc_Defense; this.pc_Attack = c.pc_Attack;
        this.isDead            = c.isDead;
        this.con_Bless         = c.con_Bless; this.tmr_Bless = c.tmr_Bless;
        this.con_Curse         = c.con_Curse; this.tmr_Curse = c.tmr_Curse;
        this.con_Regen         = c.con_Regen; this.tmr_Regen = c.tmr_Regen; this.val_Regen = c.val_Regen;
        this.con_Poison        = c.con_Poison; this.tmr_Poison = c.tmr_Poison; this.val_Poison = c.val_Poison;
        this.con_Haste         = c.con_Haste; this.tmr_Haste = c.val_Haste;
        this.con_Slow          = c.con_Slow; this.tmr_Slow = c.tmr_Slow; this.val_Slow = c.val_Slow;
        this.con_Sevrd         = c.con_Sevrd; this.tmr_Sevrd = c.tmr_Sevrd;
        this.con_Paralyzed     = c.con_Paralyzed; this.tmr_Paralyzed = c.tmr_Paralyzed;
        this.con_Stone         = c.con_Stone; this.tmr_Stone = c.tmr_Stone;
        this.con_Frog          = c.con_Frog; this.tmr_Frog = c.tmr_Frog;
        this.con_Shield        = c.con_Shield; this.tmr_Shield = c.tmr_Shield; this.val_Shield = c.val_Shield;
        this.con_Weak          = c.con_Weak; this.tmr_Weak = c.tmr_Weak; this.val_Weak = c.val_Weak;
        this.con_StrDisease    = c.con_StrDisease; this.tmr_StrDisease = c.tmr_StrDisease; this.val_StrDisease = c.val_StrDisease;
        this.con_DexDisease    = c.con_DexDisease; this.tmr_DexDisease = c.tmr_DexDisease; this.val_DexDisease = c.val_DexDisease;
        this.con_IQDisease     = c.con_IQDisease; this.tmr_IQDisease = c.tmr_IQDisease; this.val_IQDisease = c.val_IQDisease;
        this.con_WisDisease    = c.con_WisDisease; this.tmr_WisDisease = c.tmr_WisDisease; this.val_WisDisease = c.val_WisDisease;
        this.con_CharmDisease  = c.con_CharmDisease; this.tmr_CharmDisease = c.tmr_CharmDisease; this.val_CharmDisease = c.val_CharmDisease;
        this.con_HealthDisease = c.con_HealthDisease; this.tmr_HealthDisease = c.tmr_HealthDisease; this.val_HealthDisease = c.val_HealthDisease;

        if (c.eq_Head != null)
        {
            this.eq_Head = new SaveItemClass(c.eq_Head);
        }
        if (c.eq_Neck != null)
        {
            this.eq_Neck = new SaveItemClass(c.eq_Neck);
        }
        if (c.eq_LeftFinger != null)
        {
            this.eq_LeftFinger = new SaveItemClass(c.eq_LeftFinger);
        }
        if (c.eq_RightFinger != null)
        {
            this.eq_RightFinger = new SaveItemClass(c.eq_RightFinger);
        }
        if (c.eq_LeftHand != null)
        {
            this.eq_LeftHand = new SaveItemClass(c.eq_LeftHand);
        }
        if (c.eq_RightHand != null)
        {
            this.eq_RightHand = new SaveItemClass(c.eq_RightHand);
        }
        if (c.eq_Torso != null)
        {
            this.eq_Torso = new SaveItemClass(c.eq_Torso);
        }
        if (c.eq_Legs != null)
        {
            this.eq_Legs = new SaveItemClass(c.eq_Legs);
        }
        if (c.eq_Feet != null)
        {
            this.eq_Feet = new SaveItemClass(c.eq_Feet);
        }
    }