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; }
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>(); }
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>()); }
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 }
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); }
// 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); } }
void Start() { PSS = GameObject.FindObjectOfType <ParticleSystem>().GetComponent <ParticleSystemScript>(); partikkelit = GameObject.Find("Particle System"); }