Пример #1
0
        /// <summary>
        /// LoadContent will be called once per game and is the place to load
        /// all of your content.
        /// </summary>

        protected override void LoadContent()
        {
            // Create a new SpriteBatch, which can be used to draw textures.
            spriteBatch = new SpriteBatch(GraphicsDevice);
            TheCursor.Create(Content.Load <Texture2D>("ASCursor"), Content.Load <Texture2D>("CursorAim"), Content.Load <Texture2D>("CharacAim"), Color.White);


            // TODO: use this.Content to load your game content here

            List <String> TextureNames = FileServices.ReadFileLines(@"Files\TextureNames.txt");

            foreach (string TexName in TextureNames)
            {
                TextureHolder temp = new TextureHolder();
                temp.Texture  = Content.Load <Texture2D>(TexName);
                temp.Filename = TexName;
                TheContentHolder.Textures.Add(temp);
            }

            Areas.Create(TheContentHolder, graphics, TheCamera);

            List <string> WeaponLines = FileServices.ReadFileLines(@"Files\Weapons.txt");

            TheWeapons.Create(WeaponLines, TheContentHolder);

            //must make sure character spawns within normal camera boundaries
            TheMainCharacter.Create(150, 150, 0f, TheContentHolder.GetTexture("Man2"), TheContentHolder.GetTexture("Man_Aim2"), TheWeapons.WeaponList[0], TheCamera);
        }
Пример #2
0
    private void LoadPlayer(int pers = 0)
    {
        string type = Perso != "" ? Perso : StaticData.PlayerChoice;

        pers = pers == 0 ? FindClass(type) : pers - 1;

        PlayerDataSave data = SaveSystem.LoadPlayer(type);

        if (data == null)
        {
            /* ResetStats(pers);
             *
             * GamesItem ite = FindItems(0);
             * Weapons i = ScriptableObject.CreateInstance<Weapons>();
             * i.Create(ite as Weapons, 0);
             *
             * _playerData.Inventory.Weapon = i;
             */
            return;
        }

        ResetStats(pers, data.Lvl);
        _playerData.Xp = data.Xp;

        GamesItem item = FindItems(data.weapon);
        Weapons   it   = ScriptableObject.CreateInstance <Weapons>();

        it.Create(item as Weapons, data.weaponLvl);

        _playerData.Inventory.AddItem(it, Vector3.zero);
        _playerData.StateProj = it.EffectType;

        _playerData.Inventory.Potions = new Potions[4];
    }
Пример #3
0
    public void CreateWeapon(Weapons weaponData, Transform transform, int lvl = 1, Transform parent = null)
    {
        GameObject newWeapon     = Instantiate(weapon, transform.position, Quaternion.identity);
        Weapons    newWeaponData = ScriptableObject.CreateInstance <Weapons>();

        newWeaponData.Create(weaponData, lvl);
        if (parent != null)
        {
            newWeaponData.inPlayerInventory = true;
            newWeapon.transform.parent      = parent;
            newWeapon.layer = defaultLayer;
        }
        newWeapon.GetComponent <WeaponManager>().Create(newWeaponData);
    }
Пример #4
0
    private void LoadPlayer(int pers = 0)
    {
        string type = Perso != "" ? Perso : StaticData.PlayerChoice;

        pers = pers == 0 ? FindClass(type) : pers - 1;

        PlayerDataSave data = SaveSystem.LoadPlayer(type);

        if (data == null)
        {
            ResetStats(pers);

            GamesItem ite = FindItems(0);
            Weapons   i   = ScriptableObject.CreateInstance <Weapons>();
            i.Create(ite as Weapons, 0);

            _playerData.Inventory.Weapon = i;
            _playerData.CompPoint        = 0;

            return;
        }

        ResetStats(pers, data.Lvl);
        _playerData.Xp        = data.Xp;
        _playerData.CompPoint = data.CompPoint;

        for (int i = 0; i < 4; i++)
        {
            for (int j = 0; j < data.Lvl[i + 1]; j++)
            {
                _playerData.Competences[i].UpgradeStats();
            }
        }

        GamesItem item = FindItems(data.weapon);
        Weapons   it   = ScriptableObject.CreateInstance <Weapons>();

        it.Create(item as Weapons, data.weaponLvl);

        _playerData.Inventory.AddItem(it, Vector3.zero);
        _playerData.StateProj = it.EffectType;

        _playerData.Inventory.Potions = new Potions[4];
    }
Пример #5
0
    private void SpawnItem()
    {
        Weapons[] weaponses;

        if (StaticData.PlayerChoice == "Assassin")
        {
            weaponses = assassinW;
        }
        else if (StaticData.PlayerChoice == "Mage")
        {
            weaponses = mageW;
        }
        else if (StaticData.PlayerChoice == "Archer")
        {
            weaponses = archerW;
        }
        else
        {
            weaponses = warriorW;
        }

        Weapons w1 = ScriptableObject.CreateInstance <Weapons>();

        w1.Create(weaponses[Random.Range(0, weaponses.Length)], StaticData.RandomLevel() + 5);

        Weapons w2 = ScriptableObject.CreateInstance <Weapons>();

        w2.Create(weaponses[Random.Range(0, weaponses.Length)], StaticData.RandomLevel() + 5);

        Weapons w3 = ScriptableObject.CreateInstance <Weapons>();

        w3.Create(weaponses[Random.Range(0, weaponses.Length)], StaticData.RandomLevel() + 5);

        Instantiate(Item, new Vector3(8, 12, 0), Quaternion.identity).GetComponent <WeaponManager>().Create(w1);
        Instantiate(Item, new Vector3(10, 12, 0), Quaternion.identity).GetComponent <WeaponManager>().Create(w2);
        Instantiate(Item, new Vector3(12, 12, 0), Quaternion.identity).GetComponent <WeaponManager>().Create(w3);
    }