public GameObject FireParticlesInPosition(GameObject ps, CharacterNameType characterId, AttackParticlePhaseTypes particleType, Vector3 pos, SideType side, AttackInputType attackInput) { using (FiredAttackParticle psToFire = AttackParticlesFired.Where(r => r.ParticleType == particleType && r.CharaterId == characterId && !r.PS.gameObject.activeInHierarchy && r.Side == side && r.AttackInput == attackInput).FirstOrDefault()) { if (psToFire != null) { psToFire.PS.transform.position = pos; psToFire.PS.SetActive(true); return(psToFire.PS); } else { GameObject res = Instantiate(ps, pos, Quaternion.identity, Container); res.SetActive(true); AttackParticlesFired.Add(new FiredAttackParticle(res, characterId, particleType, side, attackInput)); return(res); } } }
public GameObject FireParticlesInTransform(GameObject ps, CharacterNameType characterId, AttackParticlePhaseTypes particleType, Transform parent, SideType side, AttackInputType attackInput, bool particlesVisible) { //pType = AttackParticleTypes.Test_Mesh; using (FiredAttackParticle psToFire = AttackParticlesFired.Where(r => r.ParticleType == particleType && r.CharaterId == characterId && !r.PS.gameObject.activeInHierarchy && r.Side == side && r.AttackInput == attackInput).FirstOrDefault()) { if (psToFire != null) { psToFire.PS.transform.parent = parent; psToFire.PS.transform.localPosition = Vector3.zero; psToFire.PS.SetActive(particlesVisible);//particlesVisible return(psToFire.PS); } else { GameObject res = Instantiate(ps, parent.position, parent.rotation, parent); res.transform.localPosition = Vector3.zero; res.SetActive(particlesVisible);//particlesVisible AttackParticlesFired.Add(new FiredAttackParticle(res, characterId, particleType, side, attackInput)); return(res); } } }