add fire to homebase
This commit is contained in:
parent
cda2e08624
commit
aae0a49da0
@ -20,6 +20,7 @@
|
|||||||
11036113244B3E30008610AF /* MenuScene.swift in Sources */ = {isa = PBXBuildFile; fileRef = 11036112244B3E30008610AF /* MenuScene.swift */; };
|
11036113244B3E30008610AF /* MenuScene.swift in Sources */ = {isa = PBXBuildFile; fileRef = 11036112244B3E30008610AF /* MenuScene.swift */; };
|
||||||
116060F7245C57D2004E5A36 /* EntityManager.swift in Sources */ = {isa = PBXBuildFile; fileRef = 116060F6245C57D2004E5A36 /* EntityManager.swift */; };
|
116060F7245C57D2004E5A36 /* EntityManager.swift in Sources */ = {isa = PBXBuildFile; fileRef = 116060F6245C57D2004E5A36 /* EntityManager.swift */; };
|
||||||
11738A3B24508F68004426F1 /* Unit.swift in Sources */ = {isa = PBXBuildFile; fileRef = 11738A3A24508F68004426F1 /* Unit.swift */; };
|
11738A3B24508F68004426F1 /* Unit.swift in Sources */ = {isa = PBXBuildFile; fileRef = 11738A3A24508F68004426F1 /* Unit.swift */; };
|
||||||
|
9E11FF79245CD81100EED3BE /* Fire.sks in Resources */ = {isa = PBXBuildFile; fileRef = 9E11FF77245CD81100EED3BE /* Fire.sks */; };
|
||||||
9E78ACB6245C9A5300526FF7 /* GameKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 9E78ACB5245C9A5300526FF7 /* GameKit.framework */; };
|
9E78ACB6245C9A5300526FF7 /* GameKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 9E78ACB5245C9A5300526FF7 /* GameKit.framework */; };
|
||||||
9E78ACB8245CB75B00526FF7 /* TeamComponent.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9E78ACB7245CB75B00526FF7 /* TeamComponent.swift */; };
|
9E78ACB8245CB75B00526FF7 /* TeamComponent.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9E78ACB7245CB75B00526FF7 /* TeamComponent.swift */; };
|
||||||
9E78ACBA245CBDAF00526FF7 /* HUD.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9E78ACB9245CBDAF00526FF7 /* HUD.swift */; };
|
9E78ACBA245CBDAF00526FF7 /* HUD.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9E78ACB9245CBDAF00526FF7 /* HUD.swift */; };
|
||||||
@ -72,6 +73,7 @@
|
|||||||
11036112244B3E30008610AF /* MenuScene.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MenuScene.swift; sourceTree = "<group>"; };
|
11036112244B3E30008610AF /* MenuScene.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MenuScene.swift; sourceTree = "<group>"; };
|
||||||
116060F6245C57D2004E5A36 /* EntityManager.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = EntityManager.swift; sourceTree = "<group>"; };
|
116060F6245C57D2004E5A36 /* EntityManager.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = EntityManager.swift; sourceTree = "<group>"; };
|
||||||
11738A3A24508F68004426F1 /* Unit.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Unit.swift; sourceTree = "<group>"; };
|
11738A3A24508F68004426F1 /* Unit.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Unit.swift; sourceTree = "<group>"; };
|
||||||
|
9E11FF77245CD81100EED3BE /* Fire.sks */ = {isa = PBXFileReference; lastKnownFileType = file.sks; path = Fire.sks; sourceTree = "<group>"; };
|
||||||
9E78ACB5245C9A5300526FF7 /* GameKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = GameKit.framework; path = System/Library/Frameworks/GameKit.framework; sourceTree = SDKROOT; };
|
9E78ACB5245C9A5300526FF7 /* GameKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = GameKit.framework; path = System/Library/Frameworks/GameKit.framework; sourceTree = SDKROOT; };
|
||||||
9E78ACB7245CB75B00526FF7 /* TeamComponent.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TeamComponent.swift; sourceTree = "<group>"; };
|
9E78ACB7245CB75B00526FF7 /* TeamComponent.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TeamComponent.swift; sourceTree = "<group>"; };
|
||||||
9E78ACB9245CBDAF00526FF7 /* HUD.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = HUD.swift; sourceTree = "<group>"; };
|
9E78ACB9245CBDAF00526FF7 /* HUD.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = HUD.swift; sourceTree = "<group>"; };
|
||||||
@ -139,6 +141,7 @@
|
|||||||
isa = PBXGroup;
|
isa = PBXGroup;
|
||||||
children = (
|
children = (
|
||||||
9ECD3699245C91F7008DEEBD /* GoldWars.entitlements */,
|
9ECD3699245C91F7008DEEBD /* GoldWars.entitlements */,
|
||||||
|
9E11FF74245CD79100EED3BE /* Partikels */,
|
||||||
116060F5245C5709004E5A36 /* Entities */,
|
116060F5245C5709004E5A36 /* Entities */,
|
||||||
116060F4245C56EA004E5A36 /* Components */,
|
116060F4245C56EA004E5A36 /* Components */,
|
||||||
9EC86BA2245C89B200796EF3 /* Enums */,
|
9EC86BA2245C89B200796EF3 /* Enums */,
|
||||||
@ -196,6 +199,14 @@
|
|||||||
path = Entities;
|
path = Entities;
|
||||||
sourceTree = "<group>";
|
sourceTree = "<group>";
|
||||||
};
|
};
|
||||||
|
9E11FF74245CD79100EED3BE /* Partikels */ = {
|
||||||
|
isa = PBXGroup;
|
||||||
|
children = (
|
||||||
|
9E11FF77245CD81100EED3BE /* Fire.sks */,
|
||||||
|
);
|
||||||
|
path = Partikels;
|
||||||
|
sourceTree = "<group>";
|
||||||
|
};
|
||||||
9E78ACB4245C9A5300526FF7 /* Frameworks */ = {
|
9E78ACB4245C9A5300526FF7 /* Frameworks */ = {
|
||||||
isa = PBXGroup;
|
isa = PBXGroup;
|
||||||
children = (
|
children = (
|
||||||
@ -340,6 +351,7 @@
|
|||||||
110360DE244B101A008610AF /* Main.storyboard in Resources */,
|
110360DE244B101A008610AF /* Main.storyboard in Resources */,
|
||||||
11036111244B3D6A008610AF /* MenuScene.sks in Resources */,
|
11036111244B3D6A008610AF /* MenuScene.sks in Resources */,
|
||||||
110360D5244B101A008610AF /* GameScene.sks in Resources */,
|
110360D5244B101A008610AF /* GameScene.sks in Resources */,
|
||||||
|
9E11FF79245CD81100EED3BE /* Fire.sks in Resources */,
|
||||||
110360E0244B101B008610AF /* Assets.xcassets in Resources */,
|
110360E0244B101B008610AF /* Assets.xcassets in Resources */,
|
||||||
110360E3244B101B008610AF /* LaunchScreen.storyboard in Resources */,
|
110360E3244B101B008610AF /* LaunchScreen.storyboard in Resources */,
|
||||||
);
|
);
|
||||||
@ -599,7 +611,9 @@
|
|||||||
buildSettings = {
|
buildSettings = {
|
||||||
ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES;
|
ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES;
|
||||||
BUNDLE_LOADER = "$(TEST_HOST)";
|
BUNDLE_LOADER = "$(TEST_HOST)";
|
||||||
|
"CODE_SIGN_IDENTITY[sdk=macosx*]" = "Apple Development";
|
||||||
CODE_SIGN_STYLE = Automatic;
|
CODE_SIGN_STYLE = Automatic;
|
||||||
|
DEVELOPMENT_TEAM = DDKFQG46BQ;
|
||||||
INFOPLIST_FILE = GoldWarsTests/Info.plist;
|
INFOPLIST_FILE = GoldWarsTests/Info.plist;
|
||||||
IPHONEOS_DEPLOYMENT_TARGET = 13.2;
|
IPHONEOS_DEPLOYMENT_TARGET = 13.2;
|
||||||
LD_RUNPATH_SEARCH_PATHS = (
|
LD_RUNPATH_SEARCH_PATHS = (
|
||||||
@ -620,7 +634,9 @@
|
|||||||
buildSettings = {
|
buildSettings = {
|
||||||
ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES;
|
ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES;
|
||||||
BUNDLE_LOADER = "$(TEST_HOST)";
|
BUNDLE_LOADER = "$(TEST_HOST)";
|
||||||
|
"CODE_SIGN_IDENTITY[sdk=macosx*]" = "Apple Development";
|
||||||
CODE_SIGN_STYLE = Automatic;
|
CODE_SIGN_STYLE = Automatic;
|
||||||
|
DEVELOPMENT_TEAM = DDKFQG46BQ;
|
||||||
INFOPLIST_FILE = GoldWarsTests/Info.plist;
|
INFOPLIST_FILE = GoldWarsTests/Info.plist;
|
||||||
IPHONEOS_DEPLOYMENT_TARGET = 13.2;
|
IPHONEOS_DEPLOYMENT_TARGET = 13.2;
|
||||||
LD_RUNPATH_SEARCH_PATHS = (
|
LD_RUNPATH_SEARCH_PATHS = (
|
||||||
|
21
GoldWars/GoldWars/Assets.xcassets/spark.imageset/Contents.json
vendored
Normal file
21
GoldWars/GoldWars/Assets.xcassets/spark.imageset/Contents.json
vendored
Normal file
@ -0,0 +1,21 @@
|
|||||||
|
{
|
||||||
|
"images" : [
|
||||||
|
{
|
||||||
|
"filename" : "spark.png",
|
||||||
|
"idiom" : "universal",
|
||||||
|
"scale" : "1x"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"idiom" : "universal",
|
||||||
|
"scale" : "2x"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"idiom" : "universal",
|
||||||
|
"scale" : "3x"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"info" : {
|
||||||
|
"author" : "xcode",
|
||||||
|
"version" : 1
|
||||||
|
}
|
||||||
|
}
|
BIN
GoldWars/GoldWars/Assets.xcassets/spark.imageset/spark.png
vendored
Normal file
BIN
GoldWars/GoldWars/Assets.xcassets/spark.imageset/spark.png
vendored
Normal file
Binary file not shown.
After Width: | Height: | Size: 5.1 KiB |
@ -13,8 +13,9 @@ import SpriteKit
|
|||||||
class DefaultBaseComponent: GKComponent {
|
class DefaultBaseComponent: GKComponent {
|
||||||
var spriteNode: BaseNode
|
var spriteNode: BaseNode
|
||||||
|
|
||||||
init(texture: SKTexture) {
|
init(texture: SKTexture,position: CGPoint) {
|
||||||
spriteNode = BaseNode(texture: texture, size: CGSize(width: 80, height: 80))
|
spriteNode = BaseNode(texture: texture, size: CGSize(width: 80, height: 80))
|
||||||
|
spriteNode.position = position
|
||||||
super.init()
|
super.init()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -21,8 +21,22 @@ enum Team: Int {
|
|||||||
|
|
||||||
class TeamComponent: GKComponent {
|
class TeamComponent: GKComponent {
|
||||||
let team: Team
|
let team: Team
|
||||||
|
let fire:SKEmitterNode
|
||||||
|
|
||||||
|
init(team: Team, position: CGPoint) {
|
||||||
|
fire = SKEmitterNode(fileNamed: "Fire")!
|
||||||
|
fire.zPosition = -1
|
||||||
|
fire.position = position
|
||||||
|
fire.name = "fire"
|
||||||
|
fire.particleColorSequence = nil
|
||||||
|
fire.particleColorBlendFactor = 1.0
|
||||||
|
switch team {
|
||||||
|
case .team1: fire.particleColor = SKColor.red
|
||||||
|
case .team2: fire.particleColor = SKColor.purple
|
||||||
|
case .team3: fire.particleColor = SKColor.green
|
||||||
|
case .team4: fire.particleColor = SKColor.gray
|
||||||
|
}
|
||||||
|
|
||||||
init(team: Team) {
|
|
||||||
self.team = team
|
self.team = team
|
||||||
super.init()
|
super.init()
|
||||||
}
|
}
|
||||||
|
@ -12,12 +12,13 @@ import GameplayKit
|
|||||||
class Base : GKEntity{
|
class Base : GKEntity{
|
||||||
var unitCount:Int
|
var unitCount:Int
|
||||||
|
|
||||||
init(textureName:String, team: Team? ) {
|
init(textureName:String, team: Team?,position: CGPoint ) {
|
||||||
self.unitCount = 0
|
self.unitCount = 0
|
||||||
super.init()
|
super.init()
|
||||||
addComponent(DefaultBaseComponent(texture: SKTexture(imageNamed: textureName)))
|
addComponent(DefaultBaseComponent(texture: SKTexture(imageNamed: textureName), position: position))
|
||||||
if(team != nil){
|
if(team != nil){
|
||||||
addComponent(TeamComponent(team: team!))
|
addComponent(TeamComponent(team: team!, position: position))
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -26,6 +26,9 @@ class EntityManager {
|
|||||||
if let spriteNode = entity.component(ofType: DefaultBaseComponent.self)?.spriteNode {
|
if let spriteNode = entity.component(ofType: DefaultBaseComponent.self)?.spriteNode {
|
||||||
scene.addChild(spriteNode)
|
scene.addChild(spriteNode)
|
||||||
}
|
}
|
||||||
|
if let fire = entity.component(ofType: TeamComponent.self)?.fire{
|
||||||
|
scene.addChild(fire)
|
||||||
|
}
|
||||||
if let spriteNode = entity.component(ofType: ModalBackgroundComponent.self)?.spriteNode {
|
if let spriteNode = entity.component(ofType: ModalBackgroundComponent.self)?.spriteNode {
|
||||||
scene.addChild(spriteNode)
|
scene.addChild(spriteNode)
|
||||||
isModal = true
|
isModal = true
|
||||||
|
BIN
GoldWars/GoldWars/Partikels/Fire.sks
Normal file
BIN
GoldWars/GoldWars/Partikels/Fire.sks
Normal file
Binary file not shown.
@ -15,8 +15,13 @@ class GameScene: SKScene{
|
|||||||
|
|
||||||
override func sceneDidLoad() {
|
override func sceneDidLoad() {
|
||||||
entityManager = EntityManager(scene: self)
|
entityManager = EntityManager(scene: self)
|
||||||
entityManager.add(Base(textureName: "Base", team: .team1))
|
entityManager.add(Base(textureName: "Base",
|
||||||
entityManager.add(Base(textureName: "Base", team: .team2))
|
team: .team1 ,
|
||||||
|
position: CGPoint(x: self.size.width * 0.1, y: self.size.height / 2)))
|
||||||
|
|
||||||
|
entityManager.add(Base(textureName: "Base",
|
||||||
|
team: .team2 ,
|
||||||
|
position: CGPoint(x: self.size.width * 0.9, y: self.size.height / 2)))
|
||||||
entityManager.add(HUD(size: self.size))
|
entityManager.add(HUD(size: self.size))
|
||||||
initMap()
|
initMap()
|
||||||
createBackground()
|
createBackground()
|
||||||
@ -38,9 +43,6 @@ class GameScene: SKScene{
|
|||||||
// TODO: Issue #24 create Map generation Service
|
// TODO: Issue #24 create Map generation Service
|
||||||
func initMap() {
|
func initMap() {
|
||||||
|
|
||||||
entityManager.baseNode(for: .team1)?.position = CGPoint(x: self.size.width * 0.1, y: self.size.height / 2)
|
|
||||||
entityManager.baseNode(for: .team2)?.position = CGPoint(x: self.size.width * 0.9, y: self.size.height / 2)
|
|
||||||
(entityManager.base(for: .team2) as! Base).unitCount = 3
|
|
||||||
createVirginBases()
|
createVirginBases()
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -88,8 +90,7 @@ class GameScene: SKScene{
|
|||||||
default:
|
default:
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
base = Base(textureName: "Base", team: nil)
|
base = Base(textureName: "Base", team: nil, position: position)
|
||||||
base.component(ofType: DefaultBaseComponent.self)?.spriteNode.position = position
|
|
||||||
entityManager.add(base)
|
entityManager.add(base)
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -110,7 +111,9 @@ class GameScene: SKScene{
|
|||||||
if entityManager.isModal && entity.isMember(of: Modal.self) {
|
if entityManager.isModal && entity.isMember(of: Modal.self) {
|
||||||
entityManager.remove(entity)
|
entityManager.remove(entity)
|
||||||
for child in self.children {
|
for child in self.children {
|
||||||
child.alpha = 1
|
if(child.name != "fire"){
|
||||||
|
child.alpha = 1
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -119,7 +122,10 @@ class GameScene: SKScene{
|
|||||||
spriteNode?.touchesBegan(touches, with: event)
|
spriteNode?.touchesBegan(touches, with: event)
|
||||||
if !entityManager.isModal {
|
if !entityManager.isModal {
|
||||||
for child in self.children {
|
for child in self.children {
|
||||||
child.alpha = 0.3
|
if(child.name != "fire"){
|
||||||
|
child.alpha = 0.3
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
entityManager.add(Modal(modaltype: .BaseDetails,
|
entityManager.add(Modal(modaltype: .BaseDetails,
|
||||||
base: entity as! Base,
|
base: entity as! Base,
|
||||||
@ -129,6 +135,8 @@ class GameScene: SKScene{
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
override func update(_ currentTime: TimeInterval) {
|
override func update(_ currentTime: TimeInterval) {
|
||||||
self.enumerateChildNodes(withName: "clouds", using: ({
|
self.enumerateChildNodes(withName: "clouds", using: ({
|
||||||
(node, error) in
|
(node, error) in
|
||||||
|
Binary file not shown.
Loading…
Reference in New Issue
Block a user