Skip to content

Instantly share code, notes, and snippets.

View alansley's full-sized avatar

Al Lansley alansley

View GitHub Profile
using UnityEngine;
using UnityEngine.SceneManagement;
public class GameController : MonoBehaviour
{
// Note: Assign something like a UI panel to this with your game-is-paused controls (resume game, return to menu button etc.)
[SerializeField] public GameObject PauseMenu;
// ISSUE: The name of this property `ToMainMenu` was clashing with your `ToMainMenu()` method!
//[SerializeField] public GameObject ToMainMenu;
@alansley
alansley / RPGeizer.py
Created November 8, 2023 18:11
Kerim234R Python Code
#импортируем рандом и инструментарий для кнопок
import random
from tkinter import*
import pygame
import time
import sys
pygame.mixer.init()
pygame.init()
#Нужно добавить: магазин, 3 боссов, больше врагов, магию, статистику, 2 локации
@alansley
alansley / InputLengthLimiter.cs
Created June 9, 2023 09:06
Unity C# script to limit the length of input on a TextMeshPro InputField.
using TMPro;
using UnityEngine;
using UnityEngine.Events;
/// <summary>
/// Class to limit the length of input accepted by a TextMeshPro InputField.
/// </summary>
public class InputLengthLimiter : MonoBehaviour
{
/// <summary>
@alansley
alansley / SpecificCameraFogAdder.cs
Created May 23, 2023 11:39
Class to apply fog settings for a specific camera only, using Unity's URP (untested in other pipelines)
using UnityEngine;
using UnityEngine.Rendering;
/// <summary>
/// Class to apply fog settings for a specific camera using the URP. Assign your `_cameraToModify` and change the
/// settings as required.
/// </summary>
public class SpecificCameraFogAdder : MonoBehaviour
{
/// <summary>
@alansley
alansley / gist:bd128301a5fb1316415e74e2ab26585e
Created December 24, 2019 09:41
[OLD!] OpenCV & OpenGL Realtime Webcam Stream Manipulation
#include <iostream>
#include <GL/glew.h> // Include OpenGL headers
#include <GL/glfw.h> // Include OpenGL Framework headers
#include "opencv.hpp"
using namespace std;
// Template function to convert things to strings
@alansley
alansley / MatchUpCalc.py
Created July 3, 2018 12:52
How many match-ups are possible in fighting games with X many characters?
'''
Thought: How many match-ups are there in fighting games for varying numbers of characters?
8 chars - ABCDEFGH
A plays BCDEFGH 7
B plays CDEFGH 6
C plays DEFGH 5
D plays EFGH 4
E plays FGH 3
@alansley
alansley / OpenAL
Created November 22, 2017 14:19
OpenAL-CS Test
using System;
using System.Collections;
using System.Collections.Generic;
using System.Runtime.InteropServices;
using OpenAL;
using static OpenAL.AL10;
using static OpenAL.AL11;
using static OpenAL.ALEXT;
using static OpenAL.ALC10;