From 502c609d81f5a3b3432e693e376fb0212e42aebe Mon Sep 17 00:00:00 2001 From: Jakob Haag Date: Wed, 10 Jun 2020 13:11:37 +0200 Subject: [PATCH] remove old unused unnecessary DefaultWayComponent and rename for better understanding --- GoldWars/GoldWars.xcodeproj/project.pbxproj | 4 ---- GoldWars/GoldWars/Entities/Way.swift | 16 ++++++++-------- 2 files changed, 8 insertions(+), 12 deletions(-) diff --git a/GoldWars/GoldWars.xcodeproj/project.pbxproj b/GoldWars/GoldWars.xcodeproj/project.pbxproj index 4982277..2d47daa 100644 --- a/GoldWars/GoldWars.xcodeproj/project.pbxproj +++ b/GoldWars/GoldWars.xcodeproj/project.pbxproj @@ -18,7 +18,6 @@ 116060F7245C57D2004E5A36 /* EntityManager.swift in Sources */ = {isa = PBXBuildFile; fileRef = 116060F6245C57D2004E5A36 /* EntityManager.swift */; }; 3E67854024728368007B9DE4 /* CElements.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3E67853F24728368007B9DE4 /* CElements.swift */; }; 3E6785422472CBEC007B9DE4 /* Way.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3E6785412472CBEC007B9DE4 /* Way.swift */; }; - 3E6785442472CC27007B9DE4 /* DefaultWayComponent.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3E6785432472CC27007B9DE4 /* DefaultWayComponent.swift */; }; 3EAD889524801B6A0048A10A /* RoundTimer.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3EAD889424801B6A0048A10A /* RoundTimer.swift */; }; 3EBD242E245D9332003CECE7 /* Team.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3EBD242D245D9332003CECE7 /* Team.swift */; }; 3F745DF0246F48FC00CE7375 /* PlayerMoveType.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3F745DEF246F48FC00CE7375 /* PlayerMoveType.swift */; }; @@ -82,7 +81,6 @@ 116060F6245C57D2004E5A36 /* EntityManager.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = EntityManager.swift; sourceTree = ""; }; 3E67853F24728368007B9DE4 /* CElements.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CElements.swift; sourceTree = ""; }; 3E6785412472CBEC007B9DE4 /* Way.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Way.swift; sourceTree = ""; }; - 3E6785432472CC27007B9DE4 /* DefaultWayComponent.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DefaultWayComponent.swift; sourceTree = ""; }; 3EAD889424801B6A0048A10A /* RoundTimer.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RoundTimer.swift; sourceTree = ""; }; 3EBD242D245D9332003CECE7 /* Team.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Team.swift; sourceTree = ""; }; 3F745DEF246F48FC00CE7375 /* PlayerMoveType.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PlayerMoveType.swift; sourceTree = ""; }; @@ -203,7 +201,6 @@ 9E174C85245DD91500209FF0 /* ButtonComponent.swift */, 9E174C81245DD81D00209FF0 /* ButtonNode.swift */, 9EA3ABE8245C6DAA006BC61D /* DefaultBaseComponent.swift */, - 3E6785432472CC27007B9DE4 /* DefaultWayComponent.swift */, C064E9A9246C114C0022B228 /* LabelComponent.swift */, C064E9A7246C0EA50022B228 /* LabelNode.swift */, 9EC2FBA62476B1EC00ABF11F /* PlayerInfoComponent.swift */, @@ -424,7 +421,6 @@ 9EEDE02F246FCD800096C735 /* SpinningLogoComponent.swift in Sources */, 9E174C84245DD8CE00209FF0 /* Button.swift in Sources */, 110360DB244B101A008610AF /* GameViewController.swift in Sources */, - 3E6785442472CC27007B9DE4 /* DefaultWayComponent.swift in Sources */, C05BB9C4247D890C00411249 /* SliderComponent.swift in Sources */, 110360D3244B101A008610AF /* AppDelegate.swift in Sources */, 9EC86B9F245C88A300796EF3 /* Modal.swift in Sources */, diff --git a/GoldWars/GoldWars/Entities/Way.swift b/GoldWars/GoldWars/Entities/Way.swift index 19e04df..9ecc667 100644 --- a/GoldWars/GoldWars/Entities/Way.swift +++ b/GoldWars/GoldWars/Entities/Way.swift @@ -16,15 +16,15 @@ class Way: GKEntity { required init(fromBase: Base, toBase: Base) { - let x1 = fromBase.position.x - let y1 = fromBase.position.y - let x2 = toBase.position.x - let y2 = toBase.position.y + let fromBaseX = fromBase.position.x + let fromBaseY = fromBase.position.y + let toBaseX = toBase.position.x + let toBaseY = toBase.position.y - let xControll1 = Way.computeX(x1: x1, x2: x2, y1: y1, y2: y2, factor: 2/5) - let yControll1 = Way.computeY(x1: x1, x2: x2, y1: y1, y2: y2, factor: 2/5) - let xControll2 = Way.computeX(x1: x1, x2: x2, y1: y1, y2: y2, factor: 3/5) - let yControll2 = Way.computeY(x1: x1, x2: x2, y1: y1, y2: y2, factor: 3/5) + let xControll1 = Way.computeX(x1: fromBaseX, x2: toBaseX, y1: fromBaseY, y2: toBaseY, factor: 2/5) + let yControll1 = Way.computeY(x1: fromBaseX, x2: toBaseX, y1: fromBaseY, y2: toBaseY, factor: 2/5) + let xControll2 = Way.computeX(x1: fromBaseX, x2: toBaseX, y1: fromBaseY, y2: toBaseY, factor: 3/5) + let yControll2 = Way.computeY(x1: fromBaseX, x2: toBaseX, y1: fromBaseY, y2: toBaseY, factor: 3/5) let pathToDraw = CGMutablePath() pathToDraw.move(to: fromBase.position)