public override void OnWaterEnter(WaterHitbox waterCollided) { Vector3 sc = GetComponent <PropertyHolder> ().BodyScale(); sc *= 1.2f; elecBox = GetComponent <HitboxMaker>().CreateHitboxMulti(sc, off, dmg, stun, hd, kb, true, true, ElementType.LIGHTNING, 0.3f); }
public HitboxMulti CreateHitboxMulti(Vector2 hitboxScale, Vector2 offset, float damage, float stun, float hitboxDuration, Vector2 knockback, bool fixedKnockback = true, bool followObj = true, ElementType element = ElementType.PHYSICAL, float refreshTime = 0.2f) { Vector2 cOff = (m_physics == null) ? offset : m_physics.OrientVectorToDirection(offset); Vector3 newPos = transform.position + (Vector3)cOff; var go = GameObject.Instantiate(HitboxList.Instance.HitboxMulti, newPos, Quaternion.identity); HitboxMulti newBox = go.GetComponent <HitboxMulti>(); if (followObj) { go.transform.SetParent(gameObject.transform); Vector2 ls = new Vector2(hitboxScale.x / transform.localScale.x, hitboxScale.y / transform.localScale.y); newBox.transform.localScale = (m_physics == null) ? ls : m_physics.OrientVectorToDirection(ls, false); } else { newBox.SetScale((m_physics == null) ? hitboxScale : m_physics.OrientVectorToDirection(hitboxScale, false)); } newBox.Damage = damage; newBox.Duration = hitboxDuration; newBox.Knockback = (m_physics == null) ? knockback : m_physics.OrientVectorToDirection(knockback); newBox.IsFixedKnockback = fixedKnockback; newBox.Stun = stun; newBox.AddElement(element); newBox.Creator = gameObject; newBox.Faction = Faction; newBox.refreshTime = refreshTime; ExecuteEvents.Execute <ICustomMessageTarget> (gameObject, null, (x, y) => x.OnHitboxCreate(newBox)); newBox.Init(); return(newBox); }
protected override void OnActive() { dotBox = GetComponent <HitboxMaker>().CreateHitboxDoT(scl, off, dmg, stun, hd, kb, true, true, ElementType.PHYSICAL); launchBox = GetComponent <HitboxMaker>().CreateHitboxMulti(scl2, off2, dmg, stun, hd, kb2, true, true, ElementType.PHYSICAL); fx = GetComponent <PropertyHolder> ().AddBodyEffect(FXBody.Instance.FXFan); GetComponent <PropertyHolder> ().AddAmbient(FXBody.Instance.SFXFan); }
public override void OnWaterExit(WaterHitbox waterCollided) { if (elecBox != null) { Destroy(elecBox); } elecBox = null; }
protected override void OnAttack() { HitboxInfo hi = m_HitboxInfo [0]; FollowTime = 0f; if (m_HitboxInfo.Count > 0) { DetectionBox = m_hitboxMaker.CreateHitboxMulti(hi.HitboxScale, hi.HitboxOffset, hi.Damage, hi.Stun, m_AttackAnimInfo.AttackTime, hi.Knockback, hi.FixedKnockback, true, hi.Element, m_autoAttack.RefreshTime); DetectionBox.IsResetKnockback = hi.ResetKnockback; } OldFloating = m_physics.Floating; lastFacingLeft = GetComponent <PhysicsSS> ().FacingLeft; DirectionOrient(); base.OnAttack(); }
public override void OnAddProperty() { Vector3 sc = GetComponent <PropertyHolder> ().BodyScale(); sc *= 1.2f; if (GetComponent <HitboxMaker> () != null) { bioSurround = GetComponent <HitboxMaker> ().CreateHitboxMulti(sc, off, dmg, stun, hd, kb, true, true, ElementType.BIOLOGICAL, 0.5f); bioSurround.GetComponent <Hitbox> ().Faction = FactionType.HOSTILE; //fx = GetComponent<PropertyHolder> ().AddBodyEffect (FXBody.Instance.FXFlame); bioOnly = new List <ElementType> (); bioOnly.Add(ElementType.BIOLOGICAL); eliminatedHealth = GetComponent <Attackable> ().MaxHealth / 2f; squashedHealth = Mathf.Max(0f, GetComponent <Attackable> ().Health - eliminatedHealth); GetComponent <Attackable> ().DamageObj(squashedHealth); } }
public override void OnAddProperty() { launchBox = GetComponent <HitboxMaker>().CreateHitboxMulti(scl, off2, dmg, stun, hd, kb, true, true, ElementType.PHYSICAL, 0.75f); }