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 UnityEngine; | |
public static class Vector2Extension { | |
/// <summary> | |
/// ベクトルを反時計回りに90度回す | |
/// </summary> | |
/// <param name="vector2">元のベクトル</param> | |
/// <returns>ベクトルを反時計回りに90度回したベクトル</returns> | |
public static Vector2 DEPerpendicular(this Vector2 vector2) { |
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.Linq; | |
using UnityEngine; | |
public static T[] FindObjectsByInterface<T>() where T : class { | |
return Object.FindObjectsByType<Component>(FindObjectsSortMode.None).OfType<T>().ToArray(); | |
} |
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 UnityEngine; | |
#if UNITY_EDITOR | |
using UnityEditor; | |
#endif | |
private static void QuitGame() { | |
#if (UNITY_EDITOR) | |
EditorApplication.isPlaying = false; | |
#elif (UNITY_STANDALONE) |
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 System.Collections.Generic; | |
using System.Linq; | |
public class AliasMethod { | |
//https://en.wikipedia.org/wiki/Alias_method | |
//https://stackoverflow.com/a/39199014 | |
//https://www.keithschwarz.com/darts-dice-coins/ | |
public AliasMethod() { } |
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 UnityEngine; | |
public abstract class SingletonMonoBehaviour<T> : MonoBehaviour where T : SingletonMonoBehaviour<T> { | |
[SerializeField] protected bool DontDestroy = false; | |
private static T _instance; | |
public static bool HasInstance => _instance != null; |