protected void CreateSpawnEffect() { if (string.IsNullOrEmpty(spawnEffect) == true) { //Debug.Log(parentEffect.effectName + " has no impact effect name. " + impactEffect + " has been given."); return; } GameObject loadedPrefab = Resources.Load("SpawnEffects/" + spawnEffect) as GameObject; if (loadedPrefab == null) { Debug.Log("Couldn't load " + spawnEffect); return; } Transform location = parentEffect.Source.Entity().EffectDelivery.GetOriginPoint(parentEffect.effectOrigin); GameObject effect = Instantiate(loadedPrefab, location.position, Quaternion.identity) as GameObject; EntityMovement.FacingDirection facing = parentEffect.Source.Entity().Movement.Facing; if (facing == EntityMovement.FacingDirection.Left) { effect.transform.localRotation = Quaternion.Euler(0f, 0f, 180f); } Destroy(effect, 2f); }
private void TestVelocitySwap() { ParticleSystem[] particles = GetComponentsInChildren <ParticleSystem>(); EntityMovement.FacingDirection facing = parentEffect.Source.Entity().Movement.Facing; foreach (ParticleSystem p in particles) { ParticleSystem.VelocityOverLifetimeModule vMod = p.velocityOverLifetime; float min = facing == EntityMovement.FacingDirection.Left ? -vMod.x.constantMin : vMod.x.constantMin; float max = facing == EntityMovement.FacingDirection.Left ? -vMod.x.constantMax : vMod.x.constantMax; ParticleSystem.MinMaxCurve curve = new ParticleSystem.MinMaxCurve(min, max); vMod.x = curve; } }
public static EffectZone CreateEffect(ZoneInfo zoneInfo, Constants.EffectOrigin location, GameObject source) { EffectZone result = null; Vector3 spawnPoint; if (location != Constants.EffectOrigin.MousePointer) { Transform point = source.Entity().EffectDelivery.GetOriginPoint(location); spawnPoint = point.position; } else { Debug.LogError("Add Raycasting for MouseLocation effect creation"); spawnPoint = source.transform.position; } GameObject zoneObject = LoadAndSpawnZonePrefab(zoneInfo, spawnPoint, Quaternion.identity); if (zoneObject == null) { return(null); } EntityMovement.FacingDirection facing = source.Entity().Movement.Facing; if (facing == EntityMovement.FacingDirection.Left) { zoneObject.transform.localScale = new Vector3(zoneObject.transform.localScale.x * -1, zoneObject.transform.localScale.y, zoneObject.transform.localScale.z); } result = ConfigureZone(zoneInfo, ref zoneObject, ref result); return(result); }