Skip to content

Instantly share code, notes, and snippets.

View verborghs's full-sized avatar

Steven Verborgh verborghs

View GitHub Profile
using UnityEngine;
public class PlayerBehaviour : MonoBehaviour
{
public float Speed;
public float JumpHeight;
public float MaxSlope;
public float DynamicFriction;
using UnityEngine;
public class EnvironmentQuery
{
private readonly CharacterController _controller;
private readonly float _characterRayCastHeight;
private readonly float _radius;
public EnvironmentQuery(float characterRayCastHeight, float radius)
{
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using UnityEngine;
public class InputHandler : MonoBehaviour
{
public interface IImpulseCommand
{
void Excute();
}
@verborghs
verborghs / Product.cs
Created October 29, 2019 13:20
VendingMachineBehaviour Start
namespace VendingMachines
{
public class Product
{
public Product(string name, int coins, int available)
{
Name = name;
Coins = coins;
Available = available;
}
@verborghs
verborghs / TimedQueue.cs
Created October 29, 2019 13:41
TimedQueue
public class TimedQueue
{
private float _dequeueTimer;
private readonly float _dequeueDelay;
private float _emptyTimer;
private readonly float _emptyDelay;
private readonly Queue<string> _messageQueue = new Queue<string>();
@verborghs
verborghs / TimedQueue.cs
Created October 29, 2019 13:48
Timed Queue with interface as callback
using System.Collections.Generic;
using System.Diagnostics;
namespace Utils
{
public interface TimedQueueCallback
{
void OnMessage(string message);
void OnEmpty();
}
@verborghs
verborghs / ShowMessages.cs
Created October 29, 2019 13:56
Using TimedQueue with interface
public class ShowMessages : MonoBehaviour, TimedQueueCallback
{
[SerializeField]
private Text _message;
private TimedQueue queue;
void Start()
{
queue = new TimedQueue(this);
@verborghs
verborghs / ShowMessages.cs
Created October 29, 2019 14:04
TimedQueue using delegates
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
namespace Utils
{
public class ShowMessages : MonoBehaviour
{
[SerializeField]
namespace Utils
{
public class ShowMessages : MonoBehaviour
{
[SerializeField]
private Text _message;
private TimedQueue<string> queue;