Exemplo 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;
    }
Exemplo n.º 2
0
    private int updatesSinceLastTurn = 0; // Used in the UpdateMovingState-method to fix a bug where the enemy keeps turning back and forth

    private void Awake()
    {
        rb            = gameObject.GetComponent <Rigidbody2D>();
        player        = GameObject.Find("Player");
        animator      = GetComponent <Animator>();
        currentState  = State.MOVING;
        currentHealth = maxHealth;
        initialPos    = transform.position;
        particles     = GetComponent <ParticleSystemScript>();
    }
Exemplo n.º 3
0
 private void Awake()
 {
     rb            = gameObject.GetComponent <Rigidbody2D>();
     boxCollider   = GetComponent <BoxCollider2D>();
     player        = GameObject.Find("Player");
     animator      = GetComponent <Animator>();
     currentState  = State.MOVING;
     currentHealth = maxHealth;
     initialPos    = transform.position;
     particles     = GetComponent <ParticleSystemScript>();
     Physics2D.IgnoreCollision(GetComponent <Collider2D>(), GameObject.Find("CageKey").GetComponent <Collider2D>());
 }
Exemplo n.º 4
0
    void Awake()
    {
        Time.timeScale      = 1f;
        body                = GetComponent <Rigidbody2D>();
        body.freezeRotation = true;
        arm           = transform.Find("Arm").GetComponent <PlayerArm>();
        animator      = GetComponent <Animator>();
        attackDetails = new float[2];
        currentHealth = maxHealth;
        healthbar     = GameObject.Find("HealthBar").GetComponent <HealthBar>();
        healthbar.SetMaxHealth(maxHealth);
        particles = GetComponent <ParticleSystemScript>();
        GameObject cageDoor = GameObject.Find("Cage").transform.Find("CageDoor").gameObject;

        Physics2D.IgnoreCollision(GetComponent <Collider2D>(), cageDoor.GetComponent <Collider2D>()); // Ignore collision with the door as the cage collision is enough
    }
Exemplo n.º 5
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);
    }
Exemplo n.º 6
0
    // Update is called once per frame
    void Update()
    {
        if (psd == null || !gameObject.activeSelf)
        {
            return;
        }

        // if (psd.isBurst == true)
        //  psd.rate = 0;
        ParticleSystemScript.SetPSHromData(psh, psd);
        if (true)
        {
            // Debug.Log(psd.isBurst);
            // Debug.Log(psd.rate);
            // Debug.Log(psd.mode);
            // Debug.Log(psd.shape);
        }
    }
Exemplo n.º 7
0
 void Start()
 {
     PSS         = GameObject.FindObjectOfType <ParticleSystem>().GetComponent <ParticleSystemScript>();
     partikkelit = GameObject.Find("Particle System");
 }