예제 #1
0
    private void Save()
    {
        BetweenLevelsData bld = SceneManager.GetSceneByName("BetweenLevelsScene").GetRootGameObjects()[0].GetComponent <BetweenLevelsData>();

        Player player = GameObject.FindGameObjectWithTag("Player").GetComponent <Player>();

        bld.playerInventoryItems = player.PlayerInventory.Items;
        bld.playerGold           = player.PlayerInventory.Gold;
        bld.playerName           = player.GetComponent <Entity>().entityName;
        bld.hp   = player.GetComponent <Damageable>().Hp;
        bld.mana = player.GetComponent <ManaManager>().Mana;
        bld.xp   = player.Characteristics.Experience;
        bld.playerCharacteristics.remaining = player.Characteristics.RemainingPoints;
        bld.playerCharacteristics.targetXP  = player.Characteristics.TargetExp;
        bld.level = player.Characteristics.Level;

        bld.playerCharacteristics.strength     = player.Characteristics.Strength;
        bld.playerCharacteristics.constitution = player.Characteristics.Constitution;
        bld.playerCharacteristics.intelligence = player.Characteristics.Intelligence;
        bld.playerCharacteristics.dexterity    = player.Characteristics.Dexterity;

        bld.playerArsenal.headArmor       = player.Arsenal.HeadArmor;
        bld.playerArsenal.chestArmor      = player.Arsenal.ChestArmor;
        bld.playerArsenal.feetsArmor      = player.Arsenal.FeetsArmor;
        bld.playerArsenal.rightHandWeapon = player.Arsenal.RightHandWeapon;
        bld.playerArsenal.leftHandWeapon  = player.Arsenal.LeftHandWeapon;
        bld.playerArsenal.shield          = player.Arsenal.Shield;

        bld.spells = player.Arsenal.spells;

        bld.timeSinceFirstStart = TimeManager.Instance.TimeSinceFirstStart;
    }
예제 #2
0
    private void Load()
    {
        BetweenLevelsData bld = SceneManager.GetSceneByName("BetweenLevelsScene").GetRootGameObjects()[0].GetComponent <BetweenLevelsData>();

        if (!GameObject.FindGameObjectWithTag("Player"))
        {
            return;
        }

        Player player = GameObject.FindGameObjectWithTag("Player").GetComponent <Player>();

        player.PlayerInventory.Items = bld.playerInventoryItems;
        player.PlayerInventory.Gold  = bld.playerGold;
        player.GetComponent <Entity>().entityName = bld.playerName;
        player.GetComponent <Damageable>().Hp     = bld.hp;
        player.GetComponent <ManaManager>().Mana  = bld.mana;
        player.Characteristics.RemainingPoints    = bld.playerCharacteristics.remaining;
        player.Characteristics.Experience         = bld.xp;
        player.Characteristics.TargetExp          = bld.playerCharacteristics.targetXP;
        player.Characteristics.Level = bld.level;

        player.Characteristics.Strength     = bld.playerCharacteristics.strength;
        player.Characteristics.Constitution = bld.playerCharacteristics.constitution;
        player.Characteristics.Intelligence = bld.playerCharacteristics.intelligence;
        player.Characteristics.Dexterity    = bld.playerCharacteristics.dexterity;

        player.Arsenal.HeadArmor  = bld.playerArsenal.headArmor;
        player.Arsenal.ChestArmor = bld.playerArsenal.chestArmor;
        player.Arsenal.FeetsArmor = bld.playerArsenal.feetsArmor;
        player.PlayerInventory.RefreshWeight();

        player.Arsenal.RightHandWeapon = bld.playerArsenal.rightHandWeapon;

        player.Arsenal.LeftHandWeapon = bld.playerArsenal.leftHandWeapon;

        player.Arsenal.Shield = bld.playerArsenal.shield;

        player.Arsenal.spells = bld.spells;

        if (bld.timeSinceFirstStart != 0f)
        {
            TimeManager.Instance.TimeSinceFirstStart = bld.timeSinceFirstStart;
        }

        ++bld.curLevel;
        currentLevel = bld.curLevel;
        loadNeeded   = false;

        if (bld.curLevel >= bld.lastLevel)
        {
            dungeonGenerator.bossCreated += BossCreated;
            dungeonGenerator.SpawnBoss();
            dungeonGenerator.portalCreated += DestroyPortal;
        }
    }
예제 #3
0
    private void Load()
    {
        BetweenLevelsData bld = SceneManager.GetSceneByName("BetweenLevelsScene").GetRootGameObjects()[0].GetComponent <BetweenLevelsData>();

        Player player = GameObject.FindGameObjectWithTag("Player").GetComponent <Player>();

        player.GetComponent <Entity>().entityName = bld.playerName;
        player.GetComponent <Damageable>().Hp     = bld.hp;
        player.GetComponent <ManaManager>().Mana  = bld.mana;
        player.Characteristics.Level      = bld.level;
        player.Characteristics.TargetExp  = bld.playerCharacteristics.targetXP;
        player.Characteristics.Experience = bld.xp;

        player.Characteristics.Strength     = bld.playerCharacteristics.strength;
        player.Characteristics.Constitution = bld.playerCharacteristics.constitution;
        player.Characteristics.Intelligence = bld.playerCharacteristics.intelligence;
        player.Characteristics.Dexterity    = bld.playerCharacteristics.dexterity;

        if (bld.curLevel == 0)
        {
            return;
        }
        else
        {
            --bld.curLevel;
        }

        player.Arsenal.HeadArmor     = bld.playerArsenal.headArmor;
        player.Arsenal.ChestArmor    = bld.playerArsenal.chestArmor;
        player.Arsenal.FeetsArmor    = bld.playerArsenal.feetsArmor;
        player.PlayerInventory.Items = bld.playerInventoryItems;
        player.PlayerInventory.RefreshWeight();
        player.PlayerInventory.Gold = bld.playerGold;

        player.Arsenal.RightHandWeapon = bld.playerArsenal.rightHandWeapon;
        if (bld.playerArsenal.rightHandWeapon)
        {
            player.Arsenal.InitializeWeaponSocket(WeaponHandSocket.Right, player.Arsenal.RightHandWeapon);
        }

        player.Arsenal.LeftHandWeapon = bld.playerArsenal.leftHandWeapon;
        if (bld.playerArsenal.leftHandWeapon)
        {
            player.Arsenal.InitializeWeaponSocket(WeaponHandSocket.Left, player.Arsenal.LeftHandWeapon);
        }

        player.Arsenal.Shield = bld.playerArsenal.shield;

        player.Arsenal.spells = bld.spells;

        if (bld.timeSinceFirstStart != 0f)
        {
            TimeManager.Instance.TimeSinceFirstStart = bld.timeSinceFirstStart;
        }
    }
예제 #4
0
    public void OnStartGame()
    {
        if (characteristics.RemainingPoints > 0 || entity.entityName == "")
        {
            return;
        }

        BetweenLevelsData bld = SceneManager.GetSceneByName("BetweenLevelsScene").GetRootGameObjects()[0].GetComponent <BetweenLevelsData>();

        bld.playerCharacteristics.strength     = characteristics.Strength;
        bld.playerCharacteristics.constitution = characteristics.Constitution;
        bld.playerCharacteristics.intelligence = characteristics.Intelligence;
        bld.playerCharacteristics.dexterity    = characteristics.Dexterity;
        bld.playerCharacteristics.targetXP     = 100;
        bld.playerCharacteristics.remaining    = characteristics.RemainingPoints;
        bld.level      = 1;
        bld.playerName = entity.entityName;
        bld.hp         = 120f + characteristics.Constitution * 1.5f;

        SceneManager.LoadScene("StartZone", LoadSceneMode.Additive);
        SceneManager.UnloadScene(SceneManager.GetActiveScene().buildIndex);
    }