/// <summary> /// Checks if the Entity is within the System. If it is, its loot component is extracted /// and its contents sent to the fetched Player Gold System. /// </summary> /// <param name="entID">The Entity to remove.</param> public override void Remove(ulong entID) { if (HasEntity(entID)) { CLoot lootToGive = World.GetComponent <CLoot>(entID); PlayerSystem playerSystem = World.GetSystem <PlayerSystem>(); playerSystem.GiveLoot(lootToGive); } base.Remove(entID); }
/// <summary> /// Takes a Loot Component; extracts its contents and gives it to the Player /// </summary> /// <param name="loot">The Loot to be given to the Player.</param> public void GiveLoot(CLoot loot) { CPlayer player = World.GetComponent <CPlayer>(PLAYER_ENTITY_ID); player.Gold += loot.Value; }