public Hitbox CreateHitbox(HitboxInfo hbi) { Vector2 cOff = (m_physics == null) ? hbi.HitboxOffset : m_physics.OrientVectorToDirection(hbi.HitboxOffset); Vector3 newPos = transform.position + (Vector3)cOff; var go = GameObject.Instantiate(HitboxList.Instance.Hitbox, newPos, Quaternion.identity); Hitbox newBox = go.GetComponent <Hitbox>(); if (hbi.FollowCharacter) { go.transform.SetParent(gameObject.transform); newBox.transform.localScale = m_physics.OrientVectorToDirection(new Vector2(hbi.HitboxScale.x / transform.localScale.x, hbi.HitboxScale.y / transform.localScale.y), false); } else { newBox.SetScale((m_physics == null) ? hbi.HitboxScale : m_physics.OrientVectorToDirection(hbi.HitboxScale, false)); } newBox.Damage = hbi.Damage; newBox.FocusDamage = hbi.FocusDamage; newBox.Penetration = hbi.Penetration; newBox.Duration = hbi.HitboxDuration; newBox.Knockback = (m_physics == null) ? hbi.Knockback : m_physics.OrientVectorToDirection(hbi.Knockback); newBox.IsFixedKnockback = hbi.FixedKnockback; newBox.Stun = hbi.Stun; newBox.FreezeTime = hbi.FreezeTime; newBox.AddElement(hbi.Element); newBox.Creator = gameObject; newBox.Faction = Faction; newBox.IsResetKnockback = hbi.ResetKnockback; if (hbi.FollowCharacter) { newBox.SetFollow(gameObject, hbi.HitboxOffset); } if (hbi.ApplyProps) { ExecuteEvents.Execute <ICustomMessageTarget> (gameObject, null, (x, y) => x.OnHitboxCreate(newBox)); } newBox.Init(); return(newBox); }
public Hitbox CreateHitbox(Vector3 hitboxScale, Vector3 offset, float damage, float stun, float hitboxDuration, Vector3 knockback, bool fixedKnockback = true, bool followObj = true, ElementType element = ElementType.PHYSICAL, bool applyProps = true) { Vector3 cOff = (m_charBase == null) ? offset : m_orient.OrientVectorToDirection(offset); Vector3 newPos = transform.position + (Vector3)cOff; var go = GameObject.Instantiate(ListHitboxes.Instance.Hitbox, newPos, Quaternion.identity); Hitbox newBox = go.GetComponent <Hitbox>(); if (followObj) { go.transform.SetParent(gameObject.transform); newBox.transform.localScale = m_orient.OrientVectorToDirection2D(new Vector3(hitboxScale.x / transform.localScale.x, hitboxScale.y / transform.localScale.y, hitboxScale.z / transform.localScale.z), false); } else { newBox.SetScale((m_charBase == null) ? hitboxScale : m_orient.OrientVectorToDirection2D(hitboxScale, false)); } newBox.Damage = damage; newBox.Duration = hitboxDuration; newBox.Knockback = (m_charBase == null) ? knockback : m_orient.OrientVectorToDirection2D(knockback); newBox.IsFixedKnockback = fixedKnockback; newBox.Stun = stun; newBox.AddElement(element); newBox.Creator = gameObject; if (GetComponent <FactionHolder>() != null) { GetComponent <FactionHolder>().SetFaction(go); } if (followObj) { newBox.SetFollow(gameObject, offset); } //if (applyProps) // ExecuteEvents.Execute<ICustomMessageTarget> (gameObject, null, (x, y) => x.OnHitboxCreate(newBox)); newBox.Init(); return(newBox); }
public override void OnHitboxCreate(Hitbox hitboxCreated) { hitboxCreated.AddElement(ElementType.BIOLOGICAL); }
public override void OnHitboxCreate(Hitbox hitboxCreated) { hitboxCreated.AddElement(ElementType.LIGHTNING); hitboxCreated.Stun = hitboxCreated.Stun * 1.5f; }
public override void OnHitboxCreate(Hitbox hitboxCreated) { hitboxCreated.AddElement(ElementType.FIRE); }