// Instantiate acid public void Attack() { GameObject acid = Instantiate(_acid, transform.position, Quaternion.identity); AcidEffect acidEffect = acid.GetComponent <AcidEffect>(); if (acidEffect != null) { acidEffect.facingRight = facingRight; } }
public void Attack() { if (_acidPrefab != null) { GameObject obj = Instantiate(_acidPrefab, transform.position, Quaternion.identity); AcidEffect acidScript = obj.GetComponent <AcidEffect>(); if (acidScript != null) { acidScript.SetMoveDirection(_sprite.flipX); } } }
/**********************************************************************************************/ // инициализация дефолтного набора эффектов // /**********************************************************************************************/ protected virtual void SetEffectsCollection() { // добавляем всем юнитам эффект урона DamageEffect de = new DamageEffect(); de.ObjectUnderEffect = gameObject; m_effectMaster.SetEffect(de.Type, de); // для отображения кислотного урона DamageEffect ade = new DamageEffect(); ade.ObjectUnderEffect = gameObject; ade.SetAcidType(); m_effectMaster.SetEffect(ade.Type, ade); // эффект нанесения урона кислотой AcidEffect ae = new AcidEffect(); ae.ObjectUnderEffect = gameObject; m_effectMaster.SetEffect(ae.Type, ae); // эффект замораживания FreezeEffect fe = new FreezeEffect(); fe.ObjectUnderEffect = gameObject; m_effectMaster.SetEffect(fe.Type, fe); // получаем саб компоненты Transform[] allChildren = GetComponentsInChildren <Transform>(); for (int ind = 0; ind < allChildren.Length; ind++) { GameObject component = allChildren[ind].gameObject; // настраваем FreezeEffect if (component.tag == "FreezeEffect") { Animator freezeEffectAnimator = component.GetComponent <Animator>(); if (freezeEffectAnimator == null) { Debug.Log("ERROR! freezeEffect Animator is NULL!!!"); return; } // вручаем ему аниматор fe.EffectAnimator = freezeEffectAnimator; } } }
/// <summary> /// Decompile entire acid effects block into Vector of separate elements. /// </summary> /// <param name="byteptr_t">Pointer to the beginning of acid effects block in Global data.</param> /// <param name="length">Length of the block to be read.</param> /// <param name="db">Database to which add classes.</param> private static unsafe void E_AcidEffects(byte *byteptr_t, uint length, Database.Underground2 db) { const uint size = 0xD0; for (uint loop = 0; loop < length / size; ++loop) { uint offset = 0x18 + loop * size; // current offset of the acid effect (padding included) // Get CollectionName string CName = ScriptX.NullTerminatedString(byteptr_t + offset + 0x90, 0x40); CName = Resolve.GetPathFromCollection(CName); Map.BinKeys[Bin.Hash(CName)] = CName; var Class = new AcidEffect((IntPtr)(byteptr_t + offset), CName, db); db.AcidEffects.Collections.Add(Class); } }