Merge branch '23-arc-architektur-des-projektes' into 'development'
Resolve "[ARC] Architektur des Projektes" Closes #23 See merge request marcel.schwarz/software-projekt-2!28
This commit is contained in:
commit
473bf86c92
@ -22,6 +22,10 @@
|
||||
11738A3B24508F68004426F1 /* Unit.swift in Sources */ = {isa = PBXBuildFile; fileRef = 11738A3A24508F68004426F1 /* Unit.swift */; };
|
||||
9E78ACB6245C9A5300526FF7 /* GameKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 9E78ACB5245C9A5300526FF7 /* GameKit.framework */; };
|
||||
9E78ACB8245CB75B00526FF7 /* TeamComponent.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9E78ACB7245CB75B00526FF7 /* TeamComponent.swift */; };
|
||||
9E78ACBA245CBDAF00526FF7 /* HUD.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9E78ACB9245CBDAF00526FF7 /* HUD.swift */; };
|
||||
9E78ACBE245CC9C000526FF7 /* AtkBoostSkillComponent.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9E78ACBD245CC9C000526FF7 /* AtkBoostSkillComponent.swift */; };
|
||||
9E78ACC2245CC9EE00526FF7 /* DefBoostSkillComponent.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9E78ACC1245CC9EE00526FF7 /* DefBoostSkillComponent.swift */; };
|
||||
9E78ACC4245CCA3600526FF7 /* SpySkillComponent.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9E78ACC3245CCA3600526FF7 /* SpySkillComponent.swift */; };
|
||||
9EA3ABE9245C6DAA006BC61D /* DefaultBaseComponent.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9EA3ABE8245C6DAA006BC61D /* DefaultBaseComponent.swift */; };
|
||||
9EA3ABEB245C6DFA006BC61D /* BaseNode.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9EA3ABEA245C6DFA006BC61D /* BaseNode.swift */; };
|
||||
9EA3ABED245C8143006BC61D /* ModalBackgroundComponent.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9EA3ABEC245C8143006BC61D /* ModalBackgroundComponent.swift */; };
|
||||
@ -70,6 +74,10 @@
|
||||
11738A3A24508F68004426F1 /* Unit.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Unit.swift; sourceTree = "<group>"; };
|
||||
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>"; };
|
||||
9E78ACB9245CBDAF00526FF7 /* HUD.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = HUD.swift; sourceTree = "<group>"; };
|
||||
9E78ACBD245CC9C000526FF7 /* AtkBoostSkillComponent.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AtkBoostSkillComponent.swift; sourceTree = "<group>"; };
|
||||
9E78ACC1245CC9EE00526FF7 /* DefBoostSkillComponent.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DefBoostSkillComponent.swift; sourceTree = "<group>"; };
|
||||
9E78ACC3245CCA3600526FF7 /* SpySkillComponent.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SpySkillComponent.swift; sourceTree = "<group>"; };
|
||||
9EA3ABE8245C6DAA006BC61D /* DefaultBaseComponent.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DefaultBaseComponent.swift; sourceTree = "<group>"; };
|
||||
9EA3ABEA245C6DFA006BC61D /* BaseNode.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = BaseNode.swift; sourceTree = "<group>"; };
|
||||
9EA3ABEC245C8143006BC61D /* ModalBackgroundComponent.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ModalBackgroundComponent.swift; sourceTree = "<group>"; };
|
||||
@ -170,6 +178,9 @@
|
||||
9EA3ABEE245C834B006BC61D /* ModalContentComponent.swift */,
|
||||
9EA3ABEA245C6DFA006BC61D /* BaseNode.swift */,
|
||||
9E78ACB7245CB75B00526FF7 /* TeamComponent.swift */,
|
||||
9E78ACBD245CC9C000526FF7 /* AtkBoostSkillComponent.swift */,
|
||||
9E78ACC3245CCA3600526FF7 /* SpySkillComponent.swift */,
|
||||
9E78ACC1245CC9EE00526FF7 /* DefBoostSkillComponent.swift */,
|
||||
);
|
||||
path = Components;
|
||||
sourceTree = "<group>";
|
||||
@ -180,6 +191,7 @@
|
||||
ABA03D9F244BD54F00A66916 /* Base.swift */,
|
||||
9EC86B9E245C88A300796EF3 /* Modal.swift */,
|
||||
116060F6245C57D2004E5A36 /* EntityManager.swift */,
|
||||
9E78ACB9245CBDAF00526FF7 /* HUD.swift */,
|
||||
);
|
||||
path = Entities;
|
||||
sourceTree = "<group>";
|
||||
@ -357,9 +369,12 @@
|
||||
9E78ACB8245CB75B00526FF7 /* TeamComponent.swift in Sources */,
|
||||
9EA3ABEF245C834B006BC61D /* ModalContentComponent.swift in Sources */,
|
||||
9EC86BA6245C8AD000796EF3 /* ModalType.swift in Sources */,
|
||||
9E78ACBE245CC9C000526FF7 /* AtkBoostSkillComponent.swift in Sources */,
|
||||
9E78ACC4245CCA3600526FF7 /* SpySkillComponent.swift in Sources */,
|
||||
9EA3ABEB245C6DFA006BC61D /* BaseNode.swift in Sources */,
|
||||
110360D9244B101A008610AF /* GameScene.swift in Sources */,
|
||||
116060F7245C57D2004E5A36 /* EntityManager.swift in Sources */,
|
||||
9E78ACBA245CBDAF00526FF7 /* HUD.swift in Sources */,
|
||||
11738A3B24508F68004426F1 /* Unit.swift in Sources */,
|
||||
11036113244B3E30008610AF /* MenuScene.swift in Sources */,
|
||||
9EA3ABE9245C6DAA006BC61D /* DefaultBaseComponent.swift in Sources */,
|
||||
@ -368,6 +383,7 @@
|
||||
110360DB244B101A008610AF /* GameViewController.swift in Sources */,
|
||||
110360D3244B101A008610AF /* AppDelegate.swift in Sources */,
|
||||
9EC86B9F245C88A300796EF3 /* Modal.swift in Sources */,
|
||||
9E78ACC2245CC9EE00526FF7 /* DefBoostSkillComponent.swift in Sources */,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
|
34
GoldWars/GoldWars/Components/AtkBoostSkillComponent.swift
Normal file
34
GoldWars/GoldWars/Components/AtkBoostSkillComponent.swift
Normal file
@ -0,0 +1,34 @@
|
||||
//
|
||||
// AtkBoostSkillComponent.swift
|
||||
// GoldWars
|
||||
//
|
||||
// Created by Niko Jochim on 01.05.20.
|
||||
// Copyright © 2020 SP2. All rights reserved.
|
||||
//
|
||||
|
||||
import GameplayKit
|
||||
|
||||
class AtkBoostSkillComponent: GKComponent{
|
||||
|
||||
let shapeNode :SKShapeNode
|
||||
let labelNode :SKLabelNode
|
||||
|
||||
init(text: String, texture: SKTexture?, anchorPoint: CGPoint) {
|
||||
self.labelNode = SKLabelNode(text: text)
|
||||
self.shapeNode = SKShapeNode(circleOfRadius: 30)
|
||||
self.shapeNode.position = anchorPoint
|
||||
self.labelNode.position = CGPoint(x: anchorPoint.x, y: anchorPoint.y - 15)
|
||||
if texture != nil {
|
||||
shapeNode.fillTexture = texture
|
||||
}else {
|
||||
shapeNode.fillColor = SKColor.gray
|
||||
}
|
||||
super.init()
|
||||
|
||||
}
|
||||
|
||||
required init?(coder: NSCoder) {
|
||||
fatalError("init(coder:) has not been implemented")
|
||||
}
|
||||
|
||||
}
|
34
GoldWars/GoldWars/Components/DefBoostSkillComponent.swift
Normal file
34
GoldWars/GoldWars/Components/DefBoostSkillComponent.swift
Normal file
@ -0,0 +1,34 @@
|
||||
//
|
||||
// DefBoostSkillComponent.swift
|
||||
// GoldWars
|
||||
//
|
||||
// Created by Niko Jochim on 01.05.20.
|
||||
// Copyright © 2020 SP2. All rights reserved.
|
||||
//
|
||||
|
||||
import GameplayKit
|
||||
|
||||
class DefBoostSkillComponent: GKComponent{
|
||||
|
||||
let shapeNode :SKShapeNode
|
||||
let labelNode :SKLabelNode
|
||||
|
||||
init(text: String, texture: SKTexture?, anchorPoint: CGPoint) {
|
||||
self.labelNode = SKLabelNode(text: text)
|
||||
self.shapeNode = SKShapeNode(circleOfRadius: 30)
|
||||
self.shapeNode.position = anchorPoint
|
||||
self.labelNode.position = CGPoint(x: anchorPoint.x, y: anchorPoint.y - 15)
|
||||
if texture != nil {
|
||||
shapeNode.fillTexture = texture
|
||||
}else {
|
||||
shapeNode.fillColor = SKColor.gray
|
||||
}
|
||||
super.init()
|
||||
|
||||
}
|
||||
|
||||
required init?(coder: NSCoder) {
|
||||
fatalError("init(coder:) has not been implemented")
|
||||
}
|
||||
|
||||
}
|
35
GoldWars/GoldWars/Components/SpySkillComponent.swift
Normal file
35
GoldWars/GoldWars/Components/SpySkillComponent.swift
Normal file
@ -0,0 +1,35 @@
|
||||
//
|
||||
// SpySkillComponent.swift
|
||||
// GoldWars
|
||||
//
|
||||
// Created by Niko Jochim on 01.05.20.
|
||||
// Copyright © 2020 SP2. All rights reserved.
|
||||
//
|
||||
|
||||
import GameplayKit
|
||||
|
||||
class SpySkillComponent: GKComponent{
|
||||
|
||||
let shapeNode :SKShapeNode
|
||||
let labelNode :SKLabelNode
|
||||
|
||||
init(text: String, texture: SKTexture?, anchorPoint: CGPoint) {
|
||||
self.labelNode = SKLabelNode(text: text)
|
||||
self.shapeNode = SKShapeNode(circleOfRadius: 30)
|
||||
self.shapeNode.position = anchorPoint
|
||||
self.labelNode.position = CGPoint(x: anchorPoint.x, y: anchorPoint.y - 15)
|
||||
if texture != nil {
|
||||
shapeNode.fillTexture = texture
|
||||
}else {
|
||||
shapeNode.fillColor = SKColor.gray
|
||||
}
|
||||
super.init()
|
||||
|
||||
}
|
||||
|
||||
required init?(coder: NSCoder) {
|
||||
fatalError("init(coder:) has not been implemented")
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -35,6 +35,18 @@ class EntityManager {
|
||||
scene.addChild(modal.body)
|
||||
scene.addChild(modal.footer)
|
||||
}
|
||||
if let skill = entity.component(ofType: AtkBoostSkillComponent.self) {
|
||||
scene.addChild(skill.shapeNode)
|
||||
scene.addChild(skill.labelNode)
|
||||
}
|
||||
if let skill = entity.component(ofType: DefBoostSkillComponent.self) {
|
||||
scene.addChild(skill.shapeNode)
|
||||
scene.addChild(skill.labelNode)
|
||||
}
|
||||
if let skill = entity.component(ofType: SpySkillComponent.self) {
|
||||
scene.addChild(skill.shapeNode)
|
||||
scene.addChild(skill.labelNode)
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
35
GoldWars/GoldWars/Entities/HUD.swift
Normal file
35
GoldWars/GoldWars/Entities/HUD.swift
Normal file
@ -0,0 +1,35 @@
|
||||
//
|
||||
// HUD.swift
|
||||
// GoldWars
|
||||
//
|
||||
// Created by Niko Jochim on 01.05.20.
|
||||
// Copyright © 2020 SP2. All rights reserved.
|
||||
//
|
||||
|
||||
import GameplayKit
|
||||
|
||||
class HUD: GKEntity {
|
||||
|
||||
init(size: CGSize) {
|
||||
super.init()
|
||||
addComponent(SpySkillComponent(text: "Spy",
|
||||
texture: nil,
|
||||
anchorPoint: CGPoint(x: size.width * 0.75, y: size.height * 0.1)))
|
||||
|
||||
|
||||
addComponent(AtkBoostSkillComponent(text: "Atk",
|
||||
texture: nil,
|
||||
anchorPoint: CGPoint(x: size.width * 0.85, y: size.height * 0.1)))
|
||||
|
||||
|
||||
addComponent(DefBoostSkillComponent(text: "Def",
|
||||
texture: nil,
|
||||
anchorPoint: CGPoint(x: size.width * 0.95, y: size.height * 0.1)))
|
||||
|
||||
}
|
||||
|
||||
required init?(coder: NSCoder) {
|
||||
fatalError("init(coder:) has not been implemented")
|
||||
}
|
||||
|
||||
}
|
@ -19,10 +19,11 @@ class Modal:GKEntity{
|
||||
case .BaseDetails:
|
||||
addComponent(ModalBackgroundComponent(anchorPoint: anchorPoint))
|
||||
addComponent(ModalContentComponent(header: "Basis Information",
|
||||
body: "Diese Basis enthält \(base.unitCount) Einheiten",
|
||||
footer: "",anchorPoint: anchorPoint))
|
||||
body: "Diese Basis enthält \(base.unitCount) Einheiten",
|
||||
footer: "",
|
||||
anchorPoint: anchorPoint))
|
||||
default:
|
||||
print("Bisch du dumm")
|
||||
break
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -17,7 +17,7 @@ class GameScene: SKScene{
|
||||
entityManager = EntityManager(scene: self)
|
||||
entityManager.add(Base(textureName: "Base", team: .team1))
|
||||
entityManager.add(Base(textureName: "Base", team: .team2))
|
||||
|
||||
entityManager.add(HUD(size: self.size))
|
||||
|
||||
initMap()
|
||||
}
|
||||
@ -83,7 +83,6 @@ class GameScene: SKScene{
|
||||
|
||||
}
|
||||
|
||||
|
||||
override func touchesBegan(_ touches: Set<UITouch>, with event: UIEvent?) {
|
||||
guard let touch = touches.first else {
|
||||
return
|
||||
@ -112,15 +111,9 @@ class GameScene: SKScene{
|
||||
entityManager.add(Modal(modaltype: .BaseDetails,
|
||||
base: entity as! Base,
|
||||
anchorPoint: CGPoint(x: self.size.width / 2 , y: self.size.height / 2)))
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user