Приключение/Приключение Shared/Sprites/EnemyCharacter.swift

/*
  Copyright (C) 2014 Apple Inc. All Rights Reserved.
  See LICENSE.txt for this sample’s licensing information
  
  Abstract:
  
        Defines the class for enemy characters
      
*/
 
import SpriteKit
 
class EnemyCharacter: Character {
    // MARK: Properties
    
    // Subclasses always set the intelligence in their initializers.
    var intelligence: ArtificialIntelligence!
    
    // MARK: Scene Processing Support
 
    override func updateWithTimeSinceLastUpdate(interval: NSTimeInterval) {
        super.updateWithTimeSinceLastUpdate(interval)
 
        intelligence.updateWithTimeSinceLastUpdate(interval)
    }
 
    override func animationDidComplete(animationState: AnimationState) {
        if animationState == AnimationState.Attack {
            intelligence.target?.collidedWith(physicsBody!)
        }
    }
}