Esempio n. 1
0
    private List <GameObject> MakeFoundEnemiesIntoGameObjects(List <QRCode> list)
    {
        // Find the enemy holder to store the enemy in
        Destroy(GameObject.Find("Enemy Holder"));
        GameObject enemyHolder = new GameObject("Enemy Holder");

        List <GameObject> objList = new List <GameObject>();

        foreach (QRCode code in list)
        {
            var obj = CreateGameObjectForPlayerOrEnemy.CreateEnemyFromQRCode(code, StylesEnum.GetRandomType(), Sprites.Instance.GetRandomEnemySprite(), false);
            obj.GetComponent <Transform>().parent = enemyHolder.GetComponent <Transform>();
            objList.Add(obj);
        }

        return(objList);
    }
Esempio n. 2
0
    private void GenerateCharacters(List <Stats> characterStatsArray, List <List <Skill> > charactersAbilitySetArray)
    {
        // Find the character holder to store the characters in
        GameObject characterHolder = GameObject.Find("Character Holder");

        if (characterHolder == null)
        {
            characterHolder = new GameObject("Character Holder");
        }

        string[] characterNames = new string[numberOfCharacters] {
            "Shroud", "Vitalus", "Merlin"
        };
        List <StylesEnum.CombatTypes> cb = new List <StylesEnum.CombatTypes>()
        {
            StylesEnum.CombatTypes.assassin, StylesEnum.CombatTypes.guardian, StylesEnum.CombatTypes.wizard
        };

        List <GameObject> objs = new List <GameObject>();

        for (int i = 0; i < numberOfCharacters; i++)
        {
            try
            {
                GameObject temp = CreateGameObjectForPlayerOrEnemy.NewCharacter(characterNames[i], cb[i], characterStatsArray[i], charactersAbilitySetArray[i]);
                temp.GetComponent <Transform>().parent = characterHolder.transform;
                objs.Add(temp);
            }
            catch (System.Exception e)
            {
                Debug.LogWarning(e.Message + " index: " + i);
            }
        }

        // Characters
        // names: shroud, vitalus, merlin
        character1_Assassin = objs[0].GetComponent <Player>();
        character2_Guardian = objs[1].GetComponent <Player>();
        character3_Wizard   = objs[2].GetComponent <Player>();

        charactersArrayOfPlayer = new Player[] { character1_Assassin, character2_Guardian, character3_Wizard };

        DontDestroyOnLoad(characterHolder);
    }
    private List <GameObject> MakeFoundEnemiesIntoGameObjects(List <EnemyDataSaver> list)
    {
        // Find the enemy holder to store the enemy in
        GameObject enemyHolder = GameObject.Find("Enemy Holder");

        if (enemyHolder == null)
        {
            enemyHolder = new GameObject("Enemy Holder");
        }


        List <GameObject> objList = new List <GameObject>();

        foreach (EnemyDataSaver eds in list)
        {
            var obj = CreateGameObjectForPlayerOrEnemy.CreateEnemy(eds.name, eds.type, eds.GeoPoint, eds.sprite, eds.isBoss);
            obj.GetComponent <Transform>().parent = enemyHolder.GetComponent <Transform>();
            objList.Add(obj);
        }

        return(objList);
    }