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
cardSuit = (CardSuit)Random.Range(0, 3); | |
//cardsuit is enum 0,3 is length |
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.Concurrent; | |
// | |
public static readonly ConcurrentQueue<Action> RunOnMainThread = new ConcurrentQueue<Action>(); | |
// to run it | |
private void Update() | |
{ | |
if (!RunOnMainThread.IsEmpty) | |
{ | |
while (RunOnMainThread.TryDequeue(out var action)) |
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; | |
using Sirenix.OdinInspector; | |
// I used this script to get around Unitys lack of support for long audio clips ~2 hours for feature films | |
//Break the clip up into several pieces- make sure there are no gaps between clips! | |
// Use this wherever you need to play audio on the long clips | |
//If you don't use Odin delete "[Button]" refs and "using Sirenix.OdinInspector;" | |
public class GiantAudioClip : 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
//in Update | |
Vector3 basePoint = (head.position); | |
Plane newPlane = new Plane(Vector3.forward, (basePoint)); | |
Vector3 point1 = basePoint ; | |
Vector3 point2 = basePoint + ((Vector3.up + -transform.right )* 2f); | |
Vector3 point3 = basePoint + ((Vector3.down + transform.right) * 2f); | |
newPlane.Set3Points(point1, point2, point3); | |
float dist = Vector3.Distance(head.position, Camera.transform.position); | |
var v3 = Input.mousePosition; |
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; | |
using SGoap; | |
using System.Linq; | |
using Sirenix.OdinInspector; | |
using UnityEngine.UI; | |
public class GetPlan : 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
using System.Collections; | |
using System.Collections.Generic; | |
using UnityEngine; | |
public class StopFrameAnimator : MonoBehaviour | |
{ | |
public Animator Animator; | |
public int StopFrameInterval; | |
int liveFrameInterval; | |
bool isNormalSpeed; |
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
//call these to open the load image window | |
SetFilters(); | |
StartCoroutine(ShowLoadDialogCoroutine()); |
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
IEnumerator ShowLoadDialogCoroutine() | |
{ | |
// Show a load file dialog and wait for a response from user | |
// Load file/folder: file, Initial path: default (Documents), Title: "Load File", submit button text: "Load" | |
yield return FileBrowser.WaitForLoadDialog(false, null, "Load File", "Load"); | |
// Dialog is closed | |
// Print whether a file is chosen (FileBrowser.Success) | |
// and the path to the selected file (FileBrowser.Result) (null, if FileBrowser.Success is false) | |
// Debug.Log(FileBrowser.Success + " " + FileBrowser.Result); |
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
void SetFilters() | |
{ | |
FileBrowser.SetFilters(true, new FileBrowser.Filter("ImageFiles", ".png", ".jpg"), new FileBrowser.Filter("Image files", ".png", ".jpg")); | |
FileBrowser.SetDefaultFilter(".png"); | |
FileBrowser.SetExcludedExtensions(".lnk", ".tmp", ".zip", ".rar", ".exe"); | |
//if mac or linux just use bool check here and change directory? | |
FileBrowser.AddQuickLink("Users", System.Environment.GetFolderPath(System.Environment.SpecialFolder.Desktop), null); | |
if (FileBrowser.IsOpen) |
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
if (StopFrameIsActive) | |
{ | |
liveFrameInterval++; | |
if (liveFrameInterval >= StopFrameInterval) | |
{ | |
liveFrameInterval = 0; | |
if (isNormalSpeed) | |
{ |
NewerOlder