software-projekt-2-gold-wars/GoldWars/GoldWars/Components/TeamComponent.swift
2020-05-02 14:03:14 +02:00

39 lines
867 B
Swift

//
// TeamComponent.swift
// GoldWars
//
// Created by Niko Jochim on 01.05.20.
// Copyright © 2020 SP2. All rights reserved.
//
import SpriteKit
import GameplayKit
class TeamComponent: GKComponent {
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
}
self.team = team
super.init()
}
required init?(coder aDecoder: NSCoder) {
fatalError("init(coder:) has not been implemented")
}
}