public void PlayRage() { EffectZone newRageEffectZone = Instantiate(rageEffectZonePrefab); newRageEffectZone.StartZone(transform.position + Vector3.up * rageEffectZoneVerticalOffset); FxManager.Instance.CreateFx(FxType.playerShockwave, gameObject.transform.position); }
public void DiscOverload(DiscType overloadType) { switch (overloadType) { case DiscType.Piercing: PlayerExperienceManager.Instance.GainGold(discOverloadPiercingGainedExperience); break; case DiscType.Ghost: GameManager.Instance.GainActionPoints(discOverloadGhostGainedActionPoints); break; case DiscType.Explosive: EffectZone explosiveEffectZone = EffectZonesManager.Instance.GetEffectZoneFromPool(discOverloadExplosiveEffectZoneType); if (explosiveEffectZone != null) { explosiveEffectZone.StartZone(player.transform.position); } break; case DiscType.Heavy: GameManager.Instance.GetPlayer.damageReceiptionSystem.RegainLife(discOverloadHeavyGainedHP); break; case DiscType.Shockwave: EffectZone shockwaveEffectZone = EffectZonesManager.Instance.GetEffectZoneFromPool(discOverloadShockwaveEffectZoneType); if (shockwaveEffectZone != null) { shockwaveEffectZone.StartZone(player.transform.position); } break; } }
public virtual void BeginDelivery() { switch (deliveryMethod) { case EffectDeliveryMethod.Instant: activeZone = EffectZoneFactory.CreateEffect(effectZoneInfo, effectOrigin, ParentAbility.Source); if (activeZone != null) { activeZone.Initialize(this, layerMask); } break; case EffectDeliveryMethod.Projectile: DeliverProjectiles(); break; case EffectDeliveryMethod.SelfTargeting: Apply(Source); break; case EffectDeliveryMethod.ExistingTargets: break; case EffectDeliveryMethod.Rider: break; } }
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); } result = ConfigureZone(zoneInfo, ref zoneObject, ref result); return(result); }
public void OnTriggerEnter(Collider other) { EffectZone otherZone = other.gameObject.GetComponent <EffectZone>(); Rule r = Rules.GetIntersect(this, otherZone); if (r != null) { ActorEvent ae = new ActorEvent(owner, otherZone.owner, ActorEventType.INTERSECT); r.Invoke(ref ae); } }
public void HandleCollision(RaycastHit hit, Vector3 initialMovementDirection) { InterruptTrajectory(); DemandeFx(hit.point); if (hit.collider.gameObject.layer == 12) { SoundManager.Instance.PlaySound(Sound.ShieldGetHit, hit.transform.position); FxManager.Instance.CreateFx(FxType.genericImpact, hit.point); } else if (hit.collider.gameObject.layer == 14) { SoundManager.Instance.PlaySound(Sound.WallGetHit, hit.transform.position); FxManager.Instance.CreateFx(FxType.genericImpact, hit.point); } Vector3 horizontalNormal = hit.normal; horizontalNormal.y = 0; horizontalNormal.Normalize(); // Place disc as close from the hit point as possible Vector3 newPos = hit.point + horizontalNormal * (myCollider.radius + 0.01f); newPos.y = 0; transform.position = newPos; // Gives the disc a knockback to simulate a rebound Vector3 reflectedDirection = Vector3.Reflect(initialMovementDirection, horizontalNormal); knockbackSystem.ReceiveKnockback(DamageTag.Environment, GetReboundOnObjectKnockback(), reflectedDirection); DamageableEntity hitDamageableEntity = hit.collider.GetComponent <DamageableEntity>(); if (hitDamageableEntity != null) { hitDamageableEntity.ReceiveDamage(damageTag, new DamagesParameters(currentDamagesAmount, numberOfStunedTurns)); lastObjTouch = hitDamageableEntity.gameObject; SoundManager.Instance.PlaySound(Sound.EnemyDamaged, hitDamageableEntity.transform.position); } if (effectZoneToInstantiateOnHit != EffectZoneType.None) { EffectZone newEffectZone = EffectZonesManager.Instance.GetEffectZoneFromPool(effectZoneToInstantiateOnHit); newEffectZone.StartZone(GetColliderCenter); if (destroyOnHit) { DiscManager.Instance.DestroyDisc(this); } } }
public virtual void BeginDelivery(bool weapon = false) { if (weapon == true) { //Debug.Log("Begining delivery with weapon"); CreateWeapon(); return; } //Debug.Log("begining delivery for " + effectName + " on " + parentAbility.abilityName); switch (deliveryMethod) { case EffectDeliveryMethod.Instant: activeZone = EffectZoneFactory.CreateEffect(effectZoneInfo, effectOrigin, ParentAbility.Source); if (activeZone != null) { Transform originPoint = null; if (effectZoneInfo.parentEffectToOrigin == true) { originPoint = Source.Entity().EffectDelivery.GetOriginPoint(effectOrigin); } //Debug.Log(originPoint + " is the state transform"); activeZone.Initialize(this, layerMask, originPoint); } break; case EffectDeliveryMethod.Projectile: DeliverProjectiles(); break; case EffectDeliveryMethod.SelfTargeting: Apply(Source); break; case EffectDeliveryMethod.ExistingTargets: //foreach (GameObject g in parentAbility.targets) //{ // Apply(g); //} break; case EffectDeliveryMethod.Rider: break; } }
private void DeployEffectZone() { activeZone = EffectZoneFactory.CreateEffect(payloadZoneInfo, transform.position, Quaternion.identity); Transform originPoint = null; if (payloadZoneInfo.parentEffectToOrigin == true) { originPoint = transform; } activeZone.Initialize(parentEffect, Mask, originPoint); }
public void OnEffectZoneExit(Collider2D collision, EffectZone zone) { Player other = collision.GetComponent <Player>(); if (other == null) { return; } if (triggeredPlayers.Contains(other)) { triggeredPlayers.Remove(other); other.gameObject.GetComponent <SpriteRenderer>().color = Color.white; } }
public static EffectZone CreateEffect(ZoneInfo zoneInfo, Vector3 spawnPoint, Quaternion spawnRotation) { EffectZone result = null; GameObject zoneObject = LoadAndSpawnZonePrefab(zoneInfo, spawnPoint, spawnRotation); if (zoneObject == null) { return(null); } result = ConfigureZone(zoneInfo, ref zoneObject, ref result); return(result); }
public void ReturnEffectZoneInPool(EffectZone effectZone) { EffectZoneType effectZoneType = effectZone.GetEffectZoneType; effectZone.gameObject.SetActive(false); if (allEffectZonePools.ContainsKey(effectZoneType)) { allEffectZonePools[effectZoneType].Enqueue(effectZone); } else { Destroy(effectZone.gameObject); } }
public void OnEffectZoneEnter(Collider2D collision, EffectZone zone) { Player other = collision.GetComponent <Player>(); if (other == null) { return; } if ((zone.target == EffectZone.Target.All) ||//If zone trigger all (((int)zone.target & (int)EffectZone.Target.Self) != 0 && _player.gameObject == collision.gameObject) ||//Or Self triggered (((int)zone.target & (int)EffectZone.Target.Ally) != 0 && _player.gameObject != collision.gameObject && other.team == _player.team) ||//Or Ally triggered (((int)zone.target & (int)EffectZone.Target.Enemy) != 0 && other.team != _player.team))//Or Enemy Triggered { triggeredPlayers.Add(other); other.gameObject.GetComponent <SpriteRenderer>().color = new Color(0.8f, 0.5f, 0); } }
public void CreateEffectZone() { Vector3 pos = Camera.main.ScreenToWorldPoint(Input.mousePosition); pos.z = _player.transform.position.z; foreach (EffectZone ez in _selectedSpell.zones) { GameObject newZone = Instantiate(effectZonePrefab[(int)ez.type], _effectZone.transform); newZone.transform.localScale = ez.scale; newZone.transform.localPosition = ez.offset; newZone.transform.localEulerAngles = ez.rotation; EffectZone zone = newZone.GetComponent <EffectZone>(); zone.target = ez.target; } _effectZone.transform.rotation = LookAtCursor(pos); }
public static Rule GetIntersect(EffectZone source, EffectZone victim) { if (source.eztype == EffectZoneType.ATTACHER && victim.eztype == EffectZoneType.SURFACE) { int sourceKey = (int)source.OwnerActorType; int targetKey = (int)victim.OwnerActorType; if (intersectMap.ContainsKey(sourceKey)) { var ruleRow = intersectMap[sourceKey]; if (ruleRow.ContainsKey(targetKey)) { return(ruleRow[targetKey]); } } } return(null); }
public EffectZone GetEffectZoneFromPool(EffectZoneType effectZoneType) { if (allEffectZonePools.ContainsKey(effectZoneType)) { EffectZone newEffectZone = null; if (allEffectZonePools[effectZoneType].Count > 0) { newEffectZone = allEffectZonePools[effectZoneType].Dequeue(); newEffectZone.gameObject.SetActive(true); } else { newEffectZone = Instantiate(effectZoneTypeToPrefab[effectZoneType], effectZoneTypeToPoolParent[effectZoneType]); newEffectZone.gameObject.SetActive(true); } return(newEffectZone); } return(null); }
public void SetUpPools() { allEffectZonePools = new Dictionary <EffectZoneType, Queue <EffectZone> >(); effectZoneTypeToPrefab = new Dictionary <EffectZoneType, EffectZone>(); effectZoneTypeToPoolParent = new Dictionary <EffectZoneType, Transform>(); EffectZone newEffectZone = null; Queue <EffectZone> newEffectZoneQueue = new Queue <EffectZone>(); Transform newPoolParent = null; foreach (EffectZonePoolParameters effectZonePoolParameters in allEffectZonePoolParameters) { if (!allEffectZonePools.ContainsKey(effectZonePoolParameters.effectZoneType)) { newPoolParent = new GameObject().transform; newPoolParent.SetParent(poolsParent); newPoolParent.name = effectZonePoolParameters.effectZoneType + "Pool"; newPoolParent.transform.localPosition = new Vector3(); effectZoneTypeToPrefab.Add(effectZonePoolParameters.effectZoneType, effectZonePoolParameters.effectZonePrefab); effectZoneTypeToPoolParent.Add(effectZonePoolParameters.effectZoneType, newPoolParent); newEffectZoneQueue = new Queue <EffectZone>(); for (int i = 0; i < effectZonePoolParameters.baseNumberOfElements; i++) { newEffectZone = Instantiate(effectZonePoolParameters.effectZonePrefab, poolsParent); newEffectZone.gameObject.SetActive(false); newEffectZone.transform.SetParent(newPoolParent); newEffectZone.SetEffectZoneType(effectZonePoolParameters.effectZoneType); newEffectZoneQueue.Enqueue(newEffectZone); } allEffectZonePools.Add(effectZonePoolParameters.effectZoneType, newEffectZoneQueue); } } }
private static EffectZone ConfigureZone(ZoneInfo zoneInfo, ref GameObject zoneObject, ref EffectZone result) { switch (zoneInfo.durationType) { case EffectZone.EffectZoneDuration.Instant: result = zoneObject.AddComponent <EffectZoneInstant>(); break; case EffectZone.EffectZoneDuration.Persistant: result = zoneObject.AddComponent <EffectZonePersistant>(); ((EffectZonePersistant)result).InitializePersistantZone(zoneInfo.duration, zoneInfo.interval, zoneInfo.removeEffectOnExit); break; } return(result); }
public void RefreshZone() { AffectedCells = EffectZone.GetCells(TargetedCell, Map).ToList(); }
public void GenerateKnockbackZoneOnEndTrajectory() { EffectZone newZone = EffectZonesManager.Instance.GetEffectZoneFromPool(zoneType); newZone.StartZone(GetColliderCenter); }
private void DeployEffectZone() { activeZone = EffectZoneFactory.CreateEffect(payloadZoneInfo, transform.position, Quaternion.identity); activeZone.Initialize(parentEffect, Mask); }