From 631b184564eba97001b2b31018f3b9268854b8a3 Mon Sep 17 00:00:00 2001 From: Aldin Duraki Date: Tue, 2 Jun 2020 23:10:55 +0200 Subject: [PATCH] Implemented Explosion Animation --- GoldWars/GoldWars.xcodeproj/project.pbxproj | 4 ++++ GoldWars/GoldWars/Entities/EntityManager.swift | 16 ++++++++++++++++ GoldWars/GoldWars/Partikels/Explosion.sks | Bin 0 -> 7562 bytes 3 files changed, 20 insertions(+) create mode 100644 GoldWars/GoldWars/Partikels/Explosion.sks diff --git a/GoldWars/GoldWars.xcodeproj/project.pbxproj b/GoldWars/GoldWars.xcodeproj/project.pbxproj index 38ce07b..1213bce 100644 --- a/GoldWars/GoldWars.xcodeproj/project.pbxproj +++ b/GoldWars/GoldWars.xcodeproj/project.pbxproj @@ -22,6 +22,7 @@ 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 */; }; + 3F79FFE02486F7CD003F79C3 /* Explosion.sks in Resources */ = {isa = PBXBuildFile; fileRef = 3F79FFDF2486F7CD003F79C3 /* Explosion.sks */; }; 3FE19DB5246C7A22004827AB /* RoundCalculatorService.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3FE19DB4246C7A22004827AB /* RoundCalculatorService.swift */; }; 8BB6FF402472B8F000162BBD /* SingeClickButtonNode.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8BB6FF3F2472B8F000162BBD /* SingeClickButtonNode.swift */; }; 9E0E459724796262009817A6 /* GameCenterManager.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9E0E459624796262009817A6 /* GameCenterManager.swift */; }; @@ -85,6 +86,7 @@ 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 = ""; }; + 3F79FFDF2486F7CD003F79C3 /* Explosion.sks */ = {isa = PBXFileReference; lastKnownFileType = file.sks; path = Explosion.sks; sourceTree = ""; }; 3FE19DB4246C7A22004827AB /* RoundCalculatorService.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RoundCalculatorService.swift; sourceTree = ""; }; 8BB6FF3F2472B8F000162BBD /* SingeClickButtonNode.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SingeClickButtonNode.swift; sourceTree = ""; }; 9E0E459624796262009817A6 /* GameCenterManager.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = GameCenterManager.swift; sourceTree = ""; }; @@ -233,6 +235,7 @@ 9E11FF74245CD79100EED3BE /* Partikels */ = { isa = PBXGroup; children = ( + 3F79FFDF2486F7CD003F79C3 /* Explosion.sks */, 9E11FF77245CD81100EED3BE /* Fire.sks */, ); path = Partikels; @@ -369,6 +372,7 @@ 110360E0244B101B008610AF /* Assets.xcassets in Resources */, 110360E3244B101B008610AF /* LaunchScreen.storyboard in Resources */, C04783EE2468583F004961FB /* intro-music.mp3 in Resources */, + 3F79FFE02486F7CD003F79C3 /* Explosion.sks in Resources */, ); runOnlyForDeploymentPostprocessing = 0; }; diff --git a/GoldWars/GoldWars/Entities/EntityManager.swift b/GoldWars/GoldWars/Entities/EntityManager.swift index 2b2580d..78e63bf 100644 --- a/GoldWars/GoldWars/Entities/EntityManager.swift +++ b/GoldWars/GoldWars/Entities/EntityManager.swift @@ -143,6 +143,22 @@ class EntityManager { base.ownershipPlayer = nil } if getOwnerBySnapBase != nil { + if base.ownershipPlayer != getOwnerBySnapBase { + //TODO: Outsource following with a AnimationManager + let explosion = SKEmitterNode(fileNamed: "Explosion")! + scene.addChild(explosion) + explosion.zPosition = 2 + explosion.position = base.position + explosion.name = "explosion" + explosion.particleColorSequence = nil + explosion.particleColorBlendFactor = 1.0 + let wait = SKAction.wait(forDuration: 1) + let removeParticle = SKAction.removeFromParent() + let sequence = SKAction.sequence([wait, removeParticle]) + explosion.run(sequence) + } + + if getOwnerBySnapBase == GKLocalPlayer.local { base.component(ofType: DefaultBaseComponent.self)?.labelNode.text = "\(base.unitCount)" } else { diff --git a/GoldWars/GoldWars/Partikels/Explosion.sks b/GoldWars/GoldWars/Partikels/Explosion.sks new file mode 100644 index 0000000000000000000000000000000000000000..179dbe7ede4fc7eac78bafa8573da530d69eaa93 GIT binary patch literal 7562 zcmbU`30M=?*5_uMWD+1OB0-QKs|Xl&aAQXh1!M<>F(d;-LK3s6xYW_QYwJ?$hIK*f z+G<-X?$)(x-S?&1V*Rb!+SayiRa^f%6NB`9eeeIjm+#A+Gxwf*?zv~V_nb2|CcVyL zRjDol0v_-|074J}0kZPIk+j*OGa4!a)n-k-4!;!#T8*aiKx55tT4S}i0h+p!lDp&; z<GHuW{qc@TpHNRXCLIzz3o*laXf85M)J$a{ekIK%s}5SGCQPzw~ShE4DhY=O_9 z6?VcN*bDpNFdT!g-~{{tKf*)!6&}H3cn&Y%FN6>e36Tg9NQ~sD6Y@sBC=i9A9;hdZ zMR6zzC8Jz45Dh|kC?6G|!KfIOlmr@Vdi}TZd~g9dxPlwFg9mg1Pv{I@pa5^^0zTji zUBM5O;1As(00JQhf*}M#p*w^@4+w_{h=iV?f+&cF7>I>9h=&A7ge2$%y`c~Eg?^9> zDUb?jkPaD;30cq|vLOcsKrRe~L68UePymCW5Q?A}N}v?Vpd2co5{AG~sDf%Nj$xq2 zZ4GE}s|6a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