Ejemplo n.º 1
0
        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);
        }
Ejemplo n.º 2
0
            private void OnDestroy()
            {
                InvokeHandler.CancelInvoke(this, CheckLocation);

                if (npc != null && !npc.IsDestroyed && !naturalDeath)
                {
                    npc.Kill();
                }
            }
Ejemplo n.º 3
0
            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();
            }
Ejemplo n.º 4
0
 public void DestroyAndKill()
 {
     instance.animalAI.Remove(entity);
     npc.Kill();
     Destroy();
 }