GameSignalSender
public class GameSignalSender : GameStructureObject
A base class that determines an input.
-
Whether the input is currently active. Defaults to false.
Declaration
Swift
public var active: Bool
-
The method(s) that this input will activate. Default is only by player intervention.
Declaration
Swift
public var activationMethod: [InputMethod]
-
The kind of sender. Defaults to a trigger.
Declaration
Swift
public var kind: GameSignalKind
-
The input’s associated receiver.
Declaration
Swift
var receivers: [GameSignalReceivable]
-
The name of the base texture for this input.
Declaration
Swift
var baseTexture: String
-
The number of seconds it takes for the input to toggle.
Declaration
Swift
var cooldown: Double
-
The texture for this input, accounting for active states.
Declaration
Swift
var activeTexture: SKTexture { get }
-
The description for this class.
Declaration
Swift
public override var description: String { get }
-
An enumeration that defines the different types of inputs that are used in the game.
See moreDeclaration
Swift
public enum InputMethod
-
Initialize the input.
Declaration
Swift
public init(textureName: String, by inputMethods: [InputMethod], at position: CGPoint)
Parameters
textureName
The name of the texture for this input.
inputMethods
The means of which this input will be activated by.
-
Initialize the input.
Declaration
Swift
public init( textureName: String, by inputMethods: [InputMethod], at position: CGPoint, with timer: Double )
Parameters
textureName
The name of the texture for this input.
inputMethods
The means of which this input will be activated by.
timer
The number of seconds it takes for this input to toggle states.
-
Required initializer for this class. Will result in a fatal error if you initialize the object this way.
Declaration
Swift
required init?(coder aDecoder: NSCoder)
-
Activate the input given an event and player.
Declaration
Swift
public func activate(with event: NSEvent?, player: Player?, objects: [SKSpriteNode?] = [])
Parameters
event
The event handler to listen to and track.
player
The player to watch and track.
-
Whether the input should turn on/off based on player or object intervention.
Important
This method should be implemented on inputs that listen to player intervention. This will default to false otherwise.Declaration
Swift
public func shouldActivateOnIntervention(with player: Player?, objects: [SKSpriteNode?]) -> Bool
Parameters
player
The player to listen to for intervention.
objects
The objects to listen to for intervention.
Return Value
Whether the input should activate given the intervention criteria.
-
Run any post-activation methods.
Declaration
Swift
public func onActivate(with event: NSEvent?, player: Player?)
Parameters
event
The event handler that triggered the activation.
player
The player that triggered the activation.
-
Run any post-deactivation methods.
Declaration
Swift
public func onDeactivate(with event: NSEvent?, player: Player?)
Parameters
event
The event handler that triggered the activation.
player
The player that triggered the activation.