private void TryDie(object sender, int value) { if (Activated && value <= 0) { Activated = false; //if (animator.IsAnimating && animator.AnimatingTask != null) // await animator.AnimatingTask; //location.Tile.LayoutManager.FreeSpace(this, location.Space); //location.Tile.OnObjectLeft(this); //location.Tile.Level.Updateables.Remove(this); foreach (var item in Possessions) { item.Location = GroupLayout.GetSpaceElement(location.Space, location.Tile); } Location = null; } }
private void Kill() { Activated = false; Died?.Invoke(this, this); location.Tile.LayoutManager.FreeSpace(this, location.Space); foreach (var storage in Body.Storages) { for (int i = 0; i < storage.Storage.Count; i++) { var item = storage.TakeItemFrom(i); if (item != null) { item.Location = GroupLayout.GetSpaceElement(Location.Space, location.Tile); } } } bones.Location = GroupLayout.GetSpaceElement(Location.Space, location.Tile); location = null; }