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 Foundation | |
import AVFoundation | |
import ReplayKit | |
class RPScreenWriter { | |
// Write video | |
var videoOutputURL: URL | |
var videoWriter: AVAssetWriter? | |
var videoInput: AVAssetWriterInput? | |
// Write audio |
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.Collections; | |
using System.Collections.Generic; | |
using UnityEngine; | |
/// <summary> | |
/// Lerpでゲームオブジェクトを移動させる | |
/// | |
/// [参考URL] | |
/// UnityでLerpを使って収縮運動や往復運動をさせる | |
/// https://getabakoclub.com/2020/01/30/lerp%E3%82%92%E4%BD%BF%E3%81%A3%E3%81%A6%E5%8F%8E%E7%B8%AE%E9%81%8B%E5%8B%95%E3%82%84%E5%BE%80%E5%BE%A9%E9%81%8B%E5%8B%95%E3%82%92%E3%81%95%E3%81%9B%E3%82%8B/ |
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
/** | |
* 「解く手順を考えた結果、再帰でできそうだ、という流れ」 の解説図がわかりやすいです。 | |
* https://qiita.com/ting/items/134b37bbeb756655ca6b | |
*/ | |
//ハノイの塔(再帰関数) | |
function hanoi(saucer, from, to, work) { | |
if (saucer == 0) 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
//目標の方を向く例 1 | |
public class Aim : MonoBehaviour | |
{ | |
[SerializeField] | |
private GameObject _target; | |
void Update() | |
{ | |
var directionToFace = this._target.transform.position - this.transform.position; |
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.Collections; | |
using System.Collections.Generic; | |
using UnityEngine; | |
public class RayHit : MonoBehaviour | |
{ | |
[SerializeField] | |
private GameObject _hitObject = null; | |
public GameObject HitObject { | |
get { return this._hitObject; } |
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.Collections; | |
using System.Collections.Generic; | |
using UnityEngine; | |
public class DrawLineManager : MonoBehaviour | |
{ | |
[field: SerializeField] | |
public GameObject prefabDrawLine { get; private set; } | |
[field: SerializeField] |
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.Collections; | |
using System.Collections.Generic; | |
using UnityEngine; | |
/** | |
* https://unitycoder.com/blog/2017/08/27/drawing-lines/ | |
* | |
* Unity ver.2018.3.13f1 で確認 | |
*/ |
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
extension UserDefaults { | |
//Get (デフォルト値あり) | |
internal static func get<T>(key: String, defaultValue: T) -> T { | |
let userdefaults = UserDefaults.standard | |
if userdefaults.object(forKey: key) != nil { | |
//Float |
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.Collections; | |
using System.Collections.Generic; | |
using UnityEngine; | |
public class BallTap : MonoBehaviour, TapBehaviour { | |
/** タッチしたとき */ | |
public void TapDown(ref RaycastHit hit) { | |
Debug.Log("TapDown : " + hit); |
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
override func viewWillDisappear(_ animated: Bool) { | |
/** | |
* UINavigationControllerの戻る[back]処理のイベントを取得する方法 | |
* https://qiita.com/syamaoka/items/509ff50fcab485347600 | |
* ... viewWillDisappearが呼ばれる時に、戻る処理を行っていれば、NavigationControllerのviewControllersの中にselfは存在していない | |
*/ | |
if let viewControllers = self.navigationController?.viewControllers { | |
let existsSelfInViewControllers = viewControllers.filter{$0 == self}.count == 0 | |
if existsSelfInViewControllers { |
NewerOlder