public PhysicalEffect SpawnAnchoredGroundEffect(int id, Rigidbody anchor, Vector3 direction = new Vector3(), float offset = 0f, float elevation = 0f) { GameObject effectObject = Instantiate(effectPrefab, anchor.position, Quaternion.Euler(Vector3.zero)); PhysicalEffect effect = effectObject.GetComponent <PhysicalEffect>(); effect.SetAnchor(anchor, direction, offset, elevation); effect.SetID(id); return(effect); }
public PhysicalEffect(PhysicalEffect copySource) : base(copySource) { xPos = copySource.xPos; yPos = copySource.yPos; zPos = copySource.zPos; xValue = copySource.xValue; yValue = copySource.yValue; zValue = copySource.zValue; physicalType = copySource.physicalType; }
public override string StartState() { myController.characterAnimator.Play("Stun", -1, 0f); myController.SetSpriteMat("Flash"); flashTime = startFlashTime; PhysicalEffect effect = EffectSpawner.instance.SpawnHitEffect(myController.rigidBody.position, 4f, Color.white); effect.SetAnchor(myController.rigidBody, effect.direction, 0f, 0.5f); return(stateName); }
public PhysicalEffect SpawnGroundEffectDirected(int id, float scale = 4, Vector3 position = new Vector3(), Vector3 direction = new Vector3()) { GameObject effectObject = Instantiate(effectPrefab, position, Quaternion.Euler(Vector3.zero)); PhysicalEffect effect = effectObject.GetComponent <PhysicalEffect>(); effect.SetID(id); effect.ScaleEffect(scale); Animator animator = effectObject.GetComponent <Animator>(); animator.SetFloat("Horizontal", direction.x); animator.SetFloat("Vertical", direction.y); return(effect); }
public PhysicalEffect SpawnFGEffect(int id, Vector3 position, float scale, Vector3 direction, Color fillColor = new Color()) { GameObject effectObject = Instantiate(effectPrefab, position, Quaternion.Euler(Vector3.zero)); PhysicalEffect effect = effectObject.GetComponent <PhysicalEffect>(); effect.ScaleEffect(scale); effect.SetID(id); effect.direction = direction; SpriteRenderer effectSprite = effectObject.GetComponent <SpriteRenderer>(); effectSprite.color = fillColor; return(effect); }
public PhysicalEffect SpawnFGEffect(int id, Vector3 position, float scale, Vector3 direction, Color fillColor = new Color(), Color outlineColor = new Color()) { GameObject effectObject = Instantiate(effectPrefab, position, Quaternion.Euler(Vector3.zero)); PhysicalEffect effect = effectObject.GetComponent <PhysicalEffect>(); effect.ScaleEffect(scale); effect.SetID(id); effect.direction = direction; SpriteRenderer effectSprite = effectObject.GetComponent <SpriteRenderer>(); effectSprite.material = Resources.Load("Materials/OutlineAlways") as Material; effectSprite.material.SetColor("_OutlineColor", outlineColor); effectSprite.color = fillColor; return(effect); }
public PhysicalEffect SpawnHitEffect(Vector3 position, float scale, Color fillColor = new Color()) { GameObject effectObject = Instantiate(effectPrefab, position, Quaternion.Euler(Vector3.zero)); PhysicalEffect effect = effectObject.GetComponent <PhysicalEffect>(); effect.ScaleEffect(scale); effect.orientVertically = true; effect.direction = Random.insideUnitCircle.normalized; effect.SkewEffect(); effect.SetID(4); SpriteRenderer effectSprite = effectObject.GetComponent <SpriteRenderer>(); effectSprite.sortingLayerName = "FG Effects"; effectSprite.sortingOrder = 0; effectSprite.color = fillColor; return(effect); }
void SetPhysicalEffect(PhysicalEffect effect) { switch (effect.physicalEffectType) { case PhysicalEffectType.Bleed: m_bleedEffects += effect.Amount; physicalEffects.Add(effect); effect.owner = this; effect.gameObject.transform.SetParent(this.gameObject.transform); break; case PhysicalEffectType.Infect: m_infectEffects += effect.Amount; physicalEffects.Add(effect); effect.owner = this; effect.gameObject.transform.SetParent(this.gameObject.transform); break; case PhysicalEffectType.Stun: // Stun cannot be dupilicated if (m_stunEffects == 0) { m_stunEffects++; physicalEffects.Add(effect); effect.owner = this; effect.gameObject.transform.SetParent(this.gameObject.transform); } break; case PhysicalEffectType.Buff: m_buffEffects++; physicalEffects.Add(effect); effect.owner = this; effect.gameObject.transform.SetParent(this.gameObject.transform); break; default: break; } UIManager.instance.CreateEffect(effect.Name, this, effect.Amount); }