Пример #1
0
    /**
     * Spawns a PowerUp on the map.  Type, buff status, and element should be
     * randomized
     */
    private void SpawnPowUp()
    {
        PowerUp powUp;

        if (inactivePow.Count > 0)
        {
            powUp = inactivePow.Pop();
        }
        else
        {
            powUp = (PowerUp)(Instantiate(powPrefab, new Vector3(0f, 0f, -100f), Quaternion.identity));
        }

        activePow.Add(powUp);

        // TODO randomize these
        powType type    = RandPowType();
        int     level   = 2;
        bool    isBuff  = true; // It's a buff not a debuff
        Element element = RandomElement();

        powUp.Spawn(type,
                    level,
                    element,
                    PowData[type][level - 1].speedMult,
                    PowData[type][level - 1].duration,
                    new Vector3(SpawnX, (float)(MaxY * (2 * rng.NextDouble() - 1)), 0f),
                    isBuff);
    }
Пример #2
0
    /**
     * Method that checks if a powType is effective
     *
     * @param type the type to check
     */
    public int isEffective(powType type)
    {
        for (int i = 0; i < effectivePow.Count; i++)
        {
            if (effectivePow[i].Type == type)
            {
                return(i);
            }
        }

        return(-1);
    }