Ejemplo n.º 1
0
    void UpdatePatternData()
    {
        currentPatternData = BinaryLoader.LoadPatternData(currentSpellcard, currentSave);

        //if the file does not exists:
        if (currentPatternData == null)
        {
            currentPatternData      = new PatternData();
            currentPatternData.name = "Spellcard name";
        }

        for (int i = 0; i < previewParticleSystems.Length; i++)
        {
            var emission = previewParticleSystems[i].emission;

            if (i < currentPatternData.particlePatterns.Count)
            {
                ParticleSystemScript.SetPSFromData(previewParticleSystems[i], currentPatternData.particlePatterns[i]);
                emission.enabled = true;
            }
            else
            {
                emission.enabled = false;
            }
        }

        spellcardName.text = currentPatternData.name;
    }
Ejemplo n.º 2
0
    void Start()
    {
        rigidbody = GetComponent <Rigidbody>();
        HPSlider  = HPbar.GetComponent <Slider>();

        HP = HPmax;

        //Load the spellcards using the current save number;

        int saveIndex = Global.GetCurrentSaveIndex();

        patterns.Clear();

        for (int i = 0; i < 5; i++)
        {
            PatternData data = BinaryLoader.LoadPatternData(i, saveIndex);

            if (data != null)
            {
                var pattern = ParticleSystemScript.GetPSListFromDataList(data, transform);

                //set loop to true for auto attack
                if (i == 0)
                {
                    foreach (var ps in pattern.particleSystems)
                    {
                        var main = ps.main;
                        main.loop = true;
                    }
                }

                patterns.Add(pattern);
            }
        }

        //disable all particle system emissions
        foreach (var kp in patterns)
        {
            foreach (var system in kp.particleSystems)
            {
                var emission = system.emission;
                emission.enabled = false;
            }
        }

        ActivateSpellCard(0);
    }