bool TryDmg(BaseNpc npcs) { if (!Tools.InCube(new Rectangle((int)Position.X, (int)Position.Y, BulletSizeX, BulletSizeY), new Rectangle((int)npcs.Position.X, (int)npcs.Position.Y, npcs.Width, 18))) { return(false); } npcs.Hp -= 1; if (Velocity.X >= 0) { npcs.Velocity.X += MASS / 2; } else { npcs.Velocity.X -= MASS / 2; } if ((int)npcs.Hp > 0) { return(true); } if (npcs.Type == 5) { ((Boss)npcs).Kill(); } else { npcs.Kill(); } return(true); }
private void OnDestroy() { InvokeHandler.CancelInvoke(this, CheckLocation); if (npc != null && !npc.IsDestroyed && !naturalDeath) { npc.Kill(); } }
private void OnDestroy() { DropUtil.DropItems(inventory, transform.position); owner.npcAi = null; if (entity.health <= 0) { return; } entity.InitializeHealth(entity.Health() / healthModifier, entity.MaxHealth() / healthModifier); entity.AttackDamage /= attackModifier; entity.Stats.TurnSpeed /= speedModifier; entity.Stats.Speed /= speedModifier; entity.Kill(); }
public void DestroyAndKill() { instance.animalAI.Remove(entity); npc.Kill(); Destroy(); }