Skip to content

Commit

Permalink
Move achievement handling to elsewhere
Browse files Browse the repository at this point in the history
  • Loading branch information
sp4ce-cowboy committed Apr 3, 2024
1 parent cdeca08 commit eddffd8
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
//
// SampleAchievement.swift
// TotalKillsAchievement.swift
// TowerForge
//
// Created by Rubesh on 27/3/24.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,9 @@ struct KillEvent: TFEvent {
}

removeSystem.handleRemove(for: entityId)
if player != .ownPlayer {
AchievementManager.incrementTotalKillCount()
}

guard let homeSystem = target.system(ofType: HomeSystem.self) else {
return nil
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,6 @@ class RemoveSystem: TFSystem {
/// Removes the provided entity
/// - Parameter entityId: The UUID of the associated TFEntity to be removed
func handleRemove(for entityId: UUID) {
if entityManager.entity(with: entityId)?.component(ofType: PlayerComponent.self)?.player != .ownPlayer {
AchievementManager.incrementTotalKillCount() // Increment if entity does not belong to own player
}
entityManager.removeEntity(with: entityId)
}
}

0 comments on commit eddffd8

Please sign in to comment.