public override void OnEnter() { HitInstance hit = new HitInstance { Source = base.Owner, AttackType = (AttackTypes)this.AttackType.Value, CircleDirection = this.CircleDirection.Value, DamageDealt = this.DamageDealt.Value, Direction = this.Direction.Value, IgnoreInvulnerable = this.IgnoreInvulnerable.Value, MagnitudeMultiplier = this.MagnitudeMultiplier.Value, MoveAngle = this.MoveAngle.Value, MoveDirection = this.MoveDirection.Value, Multiplier = ((!this.Multiplier.IsNone) ? this.Multiplier.Value : 1f), SpecialType = (SpecialTypes)this.SpecialType.Value, IsExtraDamage = false }; hit = ModHooks.Instance.OnHitInstanceBeforeHit(this.Fsm, hit); HitTaker.Hit(this.Target.Value, hit, 3); base.Finish(); }
//Handles the colliders void OnTriggerEnter2D(Collider2D col) { hm = col.GetComponentInChildren <HealthManager>(); bulletDummyHitInstance.Source = gameObject; //Log("[BulletBehaviour] Name" + hm.gameObject.name); //Array.ForEach<Component>(col.gameObject.GetComponents<Component>(), x => Log(x)); if (col.gameObject.name.Contains("Idle") || hm != null) { HeroController.instance.ResetAirMoves(); HitTaker.Hit(col.gameObject, bulletDummyHitInstance); if (!piercesEnemy) { Destroy(gameObject, 0.03f); } return; } else if (hm == null && col.gameObject.layer.Equals(8)) { StartCoroutine(WallHitDust()); if (col.gameObject.GetComponent <Breakable>() != null) { Breakable br = col.gameObject.GetComponent <Breakable>(); bulletDummyHitInstance.Direction = 270f; br.Hit(bulletDummyHitInstance); } if (playSoundOnSurfaceHit) { AudioHandler.instance.PlayMiscSoundEffect(AudioHandler.HollowPointSoundType.TerrainHitSFXGO); } if (!piercesWalls) { Destroy(gameObject, 0.04f); } } }
//Handles the colliders void OnTriggerEnter2D(Collider2D col) { hm = col.GetComponentInChildren <HealthManager>(); bulletDummyHitInstance.Source = gameObject; // Log("[BulletBehaviour] Col Name" + col.name); if (col.gameObject.name.Contains("Idle") || hm != null) { HeroController.instance.ResetAirMoves(); HitTaker.Hit(col.gameObject, bulletDummyHitInstance); Destroy(gameObject); return; } else if (hm == null && col.gameObject.layer.Equals(8)) { StartCoroutine(WallHitDust()); if (col.gameObject.GetComponent <Breakable>() != null) { Breakable br = col.gameObject.GetComponent <Breakable>(); bulletDummyHitInstance.Direction = 270f; br.Hit(bulletDummyHitInstance); } //TODO: change this audio source location LoadAssets.sfxDictionary.TryGetValue("impact_0" + rand.Next(1, 6) + ".wav", out AudioClip ac); //if (gameObject.GetComponent<AudioSource>() == null) Modding.Logger.Log("No Audio Source"); HeroController.instance.GetComponent <AudioSource>().PlayOneShot(ac); //Mark target for fire support Destroy(gameObject); } return; if (col.gameObject.name.Contains("Idle")) { //Modding.Logger.Log("PV IS HIT"); HitTaker.Hit(col.gameObject, bulletDummyHitInstance); if (pureVesselHM != null) { hm = pureVesselHM; } Component[] pvc = col.gameObject.GetComponents <Component>(); Log("Components" + pvc); foreach (Component c in pvc) { Type type = c.GetType(); //Transform BoxCollider2D DamageHero if (type.Name.Contains("Transform")) { Transform pvt = (Transform)c; Component[] parent_pvt = pvt.GetComponentsInParent(typeof(Component)); foreach (Component cp in parent_pvt) { Type type_2 = cp.GetType(); if (type_2.Name.Contains("HealthManager")) { hm = (HealthManager)cp; pureVesselHM = hm; break; } } } break; } } if (hm == null && col.gameObject.layer.Equals(8)) { StartCoroutine(WallHitDust()); if (col.gameObject.GetComponent <Breakable>() != null) { Breakable br = col.gameObject.GetComponent <Breakable>(); bulletDummyHitInstance.Direction = 270f; br.Hit(bulletDummyHitInstance); } //TODO: change this audio source location LoadAssets.sfxDictionary.TryGetValue("impact_0" + rand.Next(1, 6) + ".wav", out AudioClip ac); //if (gameObject.GetComponent<AudioSource>() == null) Modding.Logger.Log("No Audio Source"); HeroController.instance.GetComponent <AudioSource>().PlayOneShot(ac); //Mark target for fire support if (flareRound) { OffensiveFireSupport_Target(gameObject, null, false); return; } Destroy(gameObject); } //Damages the enemy and destroys the bullet else if (hm != null) { HitTaker.Hit(col.gameObject, bulletDummyHitInstance); HeroController.instance.ResetAirMoves(); if (flareRound) { OffensiveFireSupport_Target(gameObject, col.gameObject, true); hm.Hit(bulletDummyHitInstance); return; } if (!pierce) { Destroy(gameObject); } //hm.Hit(bulletDummyHitInstance); } }