This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Often I need to add multiple triggers to single object that do different things. | |
// This script lets you add a child containing a collider, and assign Events to | |
// happen when the collider is entered or triggered. | |
// | |
// Simply create a child object, add a collider and add this script. Set up events | |
// like you would for any other components. (like Button etc.) | |
using System; | |
using UnityEngine; | |
using UnityEngine.Events; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Foundation | |
/// An action that will get executed after a certain amount of | |
/// time, if the object is still alive. If the object gets | |
/// deinited before the provided time, the action will never | |
/// get executed. | |
class DebouncedAction { | |
private let action: ()-> Void | |
private var onCancel: (()-> Void)? |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Foundation | |
/// Protocols confoming to this protocol will have a mock generated for them. | |
protocol AutoMockable {} | |
protocol DataServiceProtocol: AutoMockable { | |
func fullUrl(forPath path: String)-> String | |
func fetchResource(fromURL url: URL, onComplete: (Result)-> Void) | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
typealias JSON = Any | |
public protocol Decodable { | |
init?(_ json: JSON) | |
} | |
extension Array: Decodable { | |
public init?(_ json: JSON) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//I was really tired when I wrote this: | |
//(I later replaced it with the two lines below) | |
// if let sound = Sound(index: soundData.soundNum, position: soundData.position) { | |
// positions | |
// .filter{$0.index == sound.position} | |
// .last? | |
// .sounds | |
// .append(sound) | |
// } | |