This file contains 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
``` | |
using System; | |
using Framework.DI; | |
using UnityEngine; | |
using UnityEngine.Networking; | |
namespace Game.Gameplay | |
{ | |
public class ShootBehaviour : MonoBehaviour | |
{ |
This file contains 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
var projectileCount = 3; | |
var initialOffset = -30; | |
for(int i = 0; i < projectileCount; i++) { | |
var projectile = Instantiate(projectile, cam.transform.position, cam.transform.rotation * Quaternion.Euler(0,initialOffset,0)); | |
initalOffset += 30; | |
projectile.GetComponent<Rigidbody>().AddForce(projectile.transform.forward * 15, ForceMode.Impulse); | |
} |
This file contains 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
var HID = require('node-hid'); | |
const express = require('express'); | |
// Steam Neptune Controller | |
var device = new HID.HID("/dev/hidraw3"); | |
var port = 8000 | |
var controller = { | |
id: "Steam Controller (Neptune)", | |
index: 0, |
This file contains 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
class ViewController: UIViewController { | |
private var webview: WKWebView! | |
private var controller: WebController = WebController() | |
override func viewDidLoad() { | |
super.viewDidLoad() | |
let configuration = WKWebViewConfiguration() | |
configuration.allowsInlineMediaPlayback = false |
This file contains 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 UIKit | |
import WebKit | |
class ViewController: UIViewController { | |
private var webview: WKWebView! | |
private var controller: WebController = WebController() | |
override func viewDidLoad() { | |
super.viewDidLoad() |
This file contains 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
public class WebController: NSObject | |
{ | |
@File(name: "gamepad", type: "js", decoder: { String(data: $0, encoding: .utf8) }) | |
var gamepadScript: String? | |
public func setup(webview: WKWebView) | |
{ | |
guard let script = gamepadScript else { | |
return | |
} |
This file contains 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
var emulatedGamepad = { | |
id: "Emulated iOS Controller", | |
index: 0, | |
connected: true, | |
timestamp: 0, | |
mapping: "standard", | |
axes: [0, 0, 0, 0], | |
buttons: new Array(17).fill().map(m => ({pressed: false, touched: false, value: 0})) | |
} |
This file contains 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
private var controllerData: String { | |
guard let controller = GCController.controllers().first, | |
let gamepad = controller.extendedGamepad, | |
let buttonOptions = gamepad.buttonOptions, | |
let buttonHome = gamepad.buttonHome, | |
let leftThumbstickButton = gamepad.leftThumbstickButton, | |
let rightThumbstickButton = gamepad.rightThumbstickButton else { | |
return "" |
This file contains 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
public struct Controller: Codable | |
{ | |
let axes: [Double] | |
let buttons: [GamePadButton?] | |
let connected: Bool | |
let id: String | |
let index: Int | |
let mapping: String | |
let timestamp: Double |
This file contains 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
struct ContentView: View { | |
@State private var initialOffset: CGFloat = 350.0 | |
@State private var initialOpacity: Double = 0.0 | |
private let duration = 5.0 | |
@ObservedObject var manager = MotionManager() | |
var body: some View { |
NewerOlder