refactoring with master Aldin
This commit is contained in:
parent
d596442015
commit
e91b2c3220
@ -12,12 +12,12 @@ import GameplayKit
|
|||||||
class Base : SKSpriteNode{
|
class Base : SKSpriteNode{
|
||||||
public static let colorSelected = SKColor.yellow
|
public static let colorSelected = SKColor.yellow
|
||||||
var availableBases = [Base]()
|
var availableBases = [Base]()
|
||||||
var standartColor = SKColor.green
|
var defaultColor = SKColor.green
|
||||||
|
|
||||||
init(color: UIColor, position: CGPoint, name: String) {
|
init(color: UIColor, position: CGPoint, name: String) {
|
||||||
super.init(texture: SKTexture(imageNamed: "Base"), color: color, size: CGSize(width: 50.0, height: 50.0))
|
super.init(texture: SKTexture(imageNamed: "Base"), color: color, size: CGSize(width: 50.0, height: 50.0))
|
||||||
|
|
||||||
standartColor = color
|
defaultColor = color
|
||||||
self.colorBlendFactor = 1
|
self.colorBlendFactor = 1
|
||||||
self.name = name
|
self.name = name
|
||||||
self.position = position
|
self.position = position
|
||||||
@ -55,21 +55,11 @@ class Base : SKSpriteNode{
|
|||||||
}
|
}
|
||||||
|
|
||||||
override func touchesEnded(_ touches: Set<UITouch>, with event: UIEvent?) {
|
override func touchesEnded(_ touches: Set<UITouch>, with event: UIEvent?) {
|
||||||
self.color = standartColor
|
self.color = defaultColor
|
||||||
for base in availableBases {
|
for base in availableBases {
|
||||||
base.color = base.standartColor
|
base.color = base.defaultColor
|
||||||
base.size = CGSize(width: 50, height: 50)
|
base.size = CGSize(width: 50, height: 50)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
enum PlayerColors {
|
|
||||||
static let colors = [
|
|
||||||
UIColor(red: 231/255, green: 76/255, blue: 60/255, alpha: 1.0),
|
|
||||||
UIColor(red: 241/255, green: 196/255, blue: 15/255, alpha: 1.0),
|
|
||||||
UIColor(red: 46/255, green: 204/255, blue: 113/255, alpha: 1.0),
|
|
||||||
UIColor(red: 52/255, green: 152/255, blue: 219/255, alpha: 1.0),
|
|
||||||
]
|
|
||||||
}
|
|
||||||
|
@ -173,18 +173,6 @@ class GameScene: SKScene, SKPhysicsContactDelegate {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func touchDown(atPoint pos : CGPoint) {
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
func touchMoved(toPoint pos : CGPoint) {
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
func touchUp(atPoint pos : CGPoint) {
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
override func touchesBegan(_ touches: Set<UITouch>, with event: UIEvent?) {
|
override func touchesBegan(_ touches: Set<UITouch>, with event: UIEvent?) {
|
||||||
for touch in touches {
|
for touch in touches {
|
||||||
let locationUser = touch.location(in: self)
|
let locationUser = touch.location(in: self)
|
||||||
@ -213,12 +201,4 @@ class GameScene: SKScene, SKPhysicsContactDelegate {
|
|||||||
func didBegin(_ contact: SKPhysicsContact) {
|
func didBegin(_ contact: SKPhysicsContact) {
|
||||||
self.addChild(menu)
|
self.addChild(menu)
|
||||||
}
|
}
|
||||||
|
|
||||||
override func touchesCancelled(_ touches: Set<UITouch>, with event: UIEvent?) {
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
override func update(_ currentTime: TimeInterval) {
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user