Exemple #1
0
        private void PerformDeath()
        {
            TryPlayDeathSound(this);
            CombatTracker.RemoveUnit(this);
            this.SpriteInstance.CurrentChainName = "Death";
            this.SpriteInstance.RelativeY        = this.SpriteInstance.Height / 2.0f;

            this.deathTextureOriginalHeight = this.SpriteInstance.Height;
            this.deathStartTime             = ScreenManager.CurrentScreen.PauseAdjustedCurrentTime;

            this.ShadowSprite.CurrentChainName    = "ShadowSmall";
            this.HealthBarRuntimeInstance.Visible = false;

            this.Velocity = Vector3.Zero;
            if (UnitData.IsEnemy == false)
            {
                var screen = ScreenManager.CurrentScreen as Screens.GameScreen;
                screen.CurrentCapacityUsed -= UnitData.Capacity;
                screen.UpdateResourceDisplay();
            }
            Died?.Invoke(this, null);
            this.Call(Destroy).After(DeathSpriteDuration);
        }