// public void EmitDamageEffect(Transform target, int time = 300){ // GameObject effect = GameObject.Instantiate (damagedEffectPrefab,effectLayer); // DamagedEffect e = effect.GetComponent<DamagedEffect> (); // e.init (target,time); // } public void EmitNormalEffectOnFixedPos(string effectName, Vector2Int targetPos, int lasting){ GameObject effect; if (_componentPool.Count > 0) effect = _componentPool.Pop (); else effect = GameObject.Instantiate (effectBasePrefab,effectLayer); AnimatorOverrideController animator = getEffect (effectName); BaseEffect be = effect.GetComponent<BaseEffect> (); effect.GetComponentInChildren<SpriteRenderer> ().sprite = null; effect.GetComponentInChildren<Animator>().runtimeAnimatorController = animator; be.init (lasting,targetPos); }
public void EmitFollowingEffect(string effectName, int lasting, MapObject owner){ GameObject effect; if (_componentPool.Count > 0) effect = _componentPool.Pop (); else effect = GameObject.Instantiate (effectBasePrefab,effectLayer); AnimatorOverrideController animator = getEffect (effectName); BaseEffect be = effect.GetComponent<BaseEffect> (); effect.GetComponentInChildren<SpriteRenderer> ().sprite = null; effect.GetComponentInChildren<Animator>().runtimeAnimatorController = animator; be.init ((int)(animator["effect_default"].length*1000),owner); }