Esempio n. 1
0
    public void SetStats(AsteroidValues stats)
    {
        base.angle  = base.speed * 10 * (Random.Range(stats.minMaxRotation.x, stats.minMaxRotation.y) < 50 ? 1 : -1);
        base.health = stats.maxHealth;
        int maxPossibleAsteroidLvl = 0;

        if (stats.maxLevelOfAsteroid > stats.AsteroidSpriteList.Count - 1)
        {
            maxPossibleAsteroidLvl = stats.maxLevelOfAsteroid;
        }
        else
        {
            maxPossibleAsteroidLvl = stats.AsteroidSpriteList.Count - 1;
        }
        if (asteroidLevel > maxPossibleAsteroidLvl)
        {
            asteroidLevel = maxPossibleAsteroidLvl;
        }

        /*
         * List<int> sameLvlAsteroid = new List<int>();
         * for (int i = 0; i < stats.AsteroidLvlGrouping.Count; i++)
         * {
         *  if (stats.AsteroidLvlGrouping[i] == asteroidLevel)
         *      sameLvlAsteroid.Add(i);
         * }
         * int choosenAsteroid = sameLvlAsteroid[(int)Random.Range(0, sameLvlAsteroid.Count - 1)];
         * Debug.Log(choosenAsteroid);
         *      base.sprite = stats.AsteroidSpriteList[choosenAsteroid];
         * gameObject.GetComponent<CircleCollider2D>().radius = stats.AsteroidRadiusList[choosenAsteroid];
         */
        base.sprite = stats.AsteroidSpriteList[asteroidLevel];
        gameObject.GetComponent <CircleCollider2D>().radius = stats.AsteroidRadiusList[asteroidLevel];
        objectsCreator = new ObjectsCreator.ResourcesObjectsCreator(stats.baseAsteroidID);
    }
Esempio n. 2
0
    public override void Initialize()
    {
        SetStats(stats);

        base.Initialize();

        if (objectsCreator == null)
        {
            objectsCreator = new ObjectsCreator.ResourcesObjectsCreator(stats.baseAsteroidID);
        }
    }