From bd5d142a4318a3d74574200996b09bdd86023a38 Mon Sep 17 00:00:00 2001 From: Jakob Haag Date: Mon, 11 May 2020 19:44:31 +0200 Subject: [PATCH] refactor variables --- GoldWars/GoldWars/Entities/Base.swift | 12 ++++++------ GoldWars/GoldWars/Entities/EntityManager.swift | 4 ++-- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/GoldWars/GoldWars/Entities/Base.swift b/GoldWars/GoldWars/Entities/Base.swift index 7fd86b3..f41f483 100644 --- a/GoldWars/GoldWars/Entities/Base.swift +++ b/GoldWars/GoldWars/Entities/Base.swift @@ -14,14 +14,14 @@ class Base: GKEntity { var unitCount: Int var adjacencyList: Array - var changeOwnerShip: Bool - var ownerShipPlayer: GKPlayer? + var changeOwnership: Bool + var ownershipPlayer: GKPlayer? init(position: CGPoint, player: GKPlayer? = nil, team: Team? = nil) { self.unitCount = 0 self.adjacencyList = [Base]() - self.changeOwnerShip = false - self.ownerShipPlayer = player + self.changeOwnership = false + self.ownershipPlayer = player super.init() addComponent(DefaultBaseComponent(texture: SKTexture(imageNamed: "Base"), position: position)) @@ -32,8 +32,8 @@ class Base: GKEntity { } func attackBase(base: Base, units:Int) -> [GKEntity]{ - base.changeOwnerShip = true - base.ownerShipPlayer = self.ownerShipPlayer + base.changeOwnership = true + base.ownershipPlayer = self.ownershipPlayer self.unitCount -= units base.unitCount += units return [self, base] diff --git a/GoldWars/GoldWars/Entities/EntityManager.swift b/GoldWars/GoldWars/Entities/EntityManager.swift index 161d3b4..8cc49f6 100644 --- a/GoldWars/GoldWars/Entities/EntityManager.swift +++ b/GoldWars/GoldWars/Entities/EntityManager.swift @@ -92,13 +92,13 @@ class EntityManager { self.entities.update(with: entity) let base = (entity as! Base) - if base.changeOwnerShip { + if base.changeOwnership { base.addComponent( TeamComponent( team: (entities[0] as! Base).component(ofType: TeamComponent.self)!.team, position: (base.component(ofType: DefaultBaseComponent.self)?.spriteNode.position)!, player: (entities[0] as! Base).component(ofType: TeamComponent.self)!.player)) - base.changeOwnerShip = false + base.changeOwnership = false scene.addChild(base.component(ofType: TeamComponent.self)!.fire) } }