protected virtual void CreateImpactEffect() { if (string.IsNullOrEmpty(impactEffect)) { return; } GameObject loadedEffect = Resources.Load(impactEffect) as GameObject; if (loadedEffect == null) { Debug.LogError("[Projectile] Impact Effect was null"); return; } Vector2 dir = parentEffect.Source.transform.position - transform.position; float angle = Mathf.Atan2(dir.y, dir.x) * Mathf.Rad2Deg - 90f; Quaternion q = Quaternion.AngleAxis(angle, Vector3.forward); //Quaternion impactRotation = Quaternion.LookRotation(dir, Vector3.forward); GameObject activeHitEffect = Instantiate(loadedEffect, transform.position, q) as GameObject; VisualEffectManager.SetParticleEffectLayer(activeHitEffect, gameObject); }
//public static void AddStaticPlayerStatAdjustment(StatCollection.BaseStat.BaseStatType targetStat, float value) { // ApplyUntrackedStatMod(null, GameManager.GetPlayer(), targetStat, value); //} public static void ApplyUntrackedStatMod(Entity causeOfChagne, Entity targetOfChagnge, StatCollection.BaseStat.BaseStatType stat, float value, StatCollection.StatModificationType modType = StatCollection.StatModificationType.Additive) { float sendableValue = 0f; if (stat == StatCollection.BaseStat.BaseStatType.Health) { //Debug.Log(targetOfChagnge); float armor = targetOfChagnge.stats.GetStatModifiedValue(StatCollection.BaseStat.BaseStatType.Armor); //Debug.Log(armor + " is the armor of " + targetOfChagnge.entityName); sendableValue = Mathf.Clamp(value + armor, value, 0f); float damageReduction = targetOfChagnge.stats.GetStatModifiedValue(StatCollection.BaseStat.BaseStatType.DamageReduction); float convertedDR = Mathf.Clamp(Mathf.Abs(damageReduction - 1f), 0f, 1f); sendableValue *= convertedDR; } else { sendableValue = value; } targetOfChagnge.stats.ApplyUntrackedMod(stat, sendableValue, modType); statAdjustmentManager.SendStatChangeEvent(causeOfChagne, targetOfChagnge, stat, sendableValue); if (stat == StatCollection.BaseStat.BaseStatType.Health && value < 0f) { VisualEffectManager.MakeFloatingText(Mathf.Abs(sendableValue).ToString(), targetOfChagnge.transform.position); } }
public Renderer(RendererConfiguration rendererConfiguration, DeferredShadingConfiguration deferredShadingConfiguration, IServiceContainer services) : base(services) { if (rendererConfiguration == null) { throw new ArgumentNullException("rendererConfiguration"); } if (deferredShadingConfiguration == null) { throw new ArgumentNullException("deferredShadingConfiguration"); } this.rendererConfiguration = rendererConfiguration; var controlProvider = (WindowsControlProvider)services.GetService(typeof(WindowsControlProvider)); this.control = controlProvider.Control; this.control.Disposed += Control_Disposed; InitializeD3D10(); PrepareWindow(); PrepareDefaultRenderTarget(); CreateDefaultRenderStates(); batchManager = new BatchManager(services); kBufferManager = new DepthPeeledKBufferManager(services, deferredShadingConfiguration); visualEffectManager = new VisualEffectManager(services, deferredShadingConfiguration); }
private void CreateProjectile() { ConfigureProjectile(); CreateFireEffect(); GameObject loadedPrefab = Resources.Load("Projectiles/" + prefabName) as GameObject; if (loadedPrefab == null) { Debug.LogError("Prefab was null"); return; } //Quaternion rot = Quaternion.FromToRotation(effectOrigin, shootDirection);//Quaternion.LookRotation(shootDirection, Vector3.forward); GameObject shot = VisualEffectManager.CreateVisualEffect(loadedPrefab, effectOrigin, shotPos.rotation); Projectile shotScript = shot.GetComponent <Projectile>(); if (error != 0f) { float e = Random.Range(-error, error); shot.transform.rotation = shotPos.rotation * Quaternion.Euler(shotPos.rotation.x, shotPos.rotation.y, e); if (shotScript.ProjectileMovement.lobbed) { shotScript.ProjectileMovement.angle += e; } } shotScript.Initialize(parentEffect, layerMask, 0f, parentEffect.effectDamage); //if (kickBack) { // parentAbility.source.GetComponent<Rigidbody2D>().AddForce(-shotPos.up * kickStrength); //} }
public static void ApplyTrackedStatMod(Entity causeOfChagne, Entity targetOfChange, StatCollection.BaseStat.BaseStatType stat, StatCollection.StatModifer mod) { targetOfChange.stats.ApplyTrackedMod(stat, mod); statAdjustmentManager.SendStatChangeEvent(causeOfChagne, targetOfChange, stat, mod.value); if (stat == StatCollection.BaseStat.BaseStatType.Health && mod.value < 0f) { VisualEffectManager.MakeFloatingText(Mathf.Abs(mod.value).ToString(), targetOfChange.transform.position); } }
private void CreateFireEffect() { ConfigureMeleeAttack(); GameObject effect = VisualEffectManager.CreateVisualEffect(fireEffect, effectOrigin, effectTransform.rotation); if (parentAbility.source.Facing == Constants.EntityFacing.Left) { effect.GetComponentInChildren <ParticleSystem>().transform.localScale = new Vector3(-1, 1, 1); } VisualEffectManager.DestroyVFX(effect, 1f); }
private void CreateFireEffect() { GameObject firePrefab = Resources.Load(((EffectAttack)parentEffect).fireEffectName) as GameObject; if (firePrefab == null) { //Debug.LogError("Fire Prefab Null"); Debug.LogWarning(parentAbility.abilityName + " is firing with no fire prefab"); return; } GameObject fireEffect = VisualEffectManager.CreateVisualEffect(firePrefab, effectOrigin, Quaternion.identity); }
private void CreateHitEffects(RaycastHit2D hit) { Vector2 rayDir = Vector2.Reflect((hit.point - effectOrigin).normalized, hit.normal); Quaternion impactRotation = TargetingUtilities.CalculateImpactRotation(rayDir); GameObject hitPrefab = Resources.Load(((EffectAttack)parentEffect).impactEffectName) as GameObject; GameObject hitEffect = VisualEffectManager.CreateVisualEffect(hitPrefab, hit.point, impactRotation); VisualEffectManager.SetParticleEffectLayer(hitEffect, hit.collider.gameObject); //ParticleSystem[] ps = hitEffect.GetComponentsInChildren<ParticleSystem>(); //SpriteRenderer hitSprite = hit.collider.gameObject.GetComponentInChildren<SpriteRenderer>(); //for (int i = 0; i < ps.Length; i++) { // ps[i].GetComponent<ParticleSystemRenderer>().sortingOrder = hitSprite.sortingOrder; //} }
private void CreateMeleeAttack() { //Grid.EventManager.RemoveListener(Constants.GameEvent.AnimationEvent, OnAnimationEvent); ConfigureMeleeAttack(); GameObject loadedPrefab = Resources.Load("Melee/" + prefabName) as GameObject; if (loadedPrefab == null) { Debug.LogError("Prefab was null : " + prefabName); return; } GameObject hit = VisualEffectManager.CreateVisualEffect(loadedPrefab, effectOrigin, Quaternion.identity); MeleeHit hitScript = hit.GetComponent <MeleeHit>(); hit.transform.SetParent(parentAbility.source.transform, true); hitScript.Initialize(parentEffect, layerMask, 0f, parentEffect.effectDamage); }
private void CreateMeleeAttack() { ConfigureMeleeAttack(); GameObject loadedPrefab = Resources.Load("HitPrefabs/" + prefabName) as GameObject; if (loadedPrefab == null) { Debug.LogError("Prefab was null : " + prefabName); return; } //Debug.Log("Attack Created"); GameObject hit = VisualEffectManager.CreateVisualEffect(loadedPrefab, effectOrigin, Quaternion.identity); MeleeHit hitScript = hit.GetComponent <MeleeHit>(); hit.transform.SetParent(parentAbility.source.transform, true); hitScript.Initialize(parentEffect, layerMask, 0f, parentEffect.effectDamage); }
protected virtual void OnTriggerStay2D(Collider2D other) { if ((LayerMask & 1 << other.gameObject.layer) == 1 << other.gameObject.layer) { //Debug.Log("hit " + other.gameObject.name); Entity hitTarget = other.gameObject.GetComponent <Entity>(); if (!CheckHitList(hitTarget)) { return; } parentEffect.Apply(other.gameObject); GameObject effect = null; if (hitEffect != null) { effect = VisualEffectManager.CreateVisualEffect(hitEffect, other.transform.position, Quaternion.identity); Destroy(effect, 1f); } } }
private void Awake() { Instance = this; }