Skip to content

Instantly share code, notes, and snippets.

View CptAsgard's full-sized avatar

Homsin CptAsgard

View GitHub Profile
@CptAsgard
CptAsgard / GameTime.cs
Last active May 18, 2022 18:02
DarkRift 2 / .NET 6 - fixed update tick/loop for standalone plugin
public class GameTime
{
private readonly Stopwatch stopwatch = new();
public const float TicksPerSecond = 4f;
public float FixedDeltaTime => 1f / TicksPerSecond;
public long FixedDeltaTimeMiliseconds => (long)(FixedDeltaTime * 1000f);
public long ElapsedMiliseconds => stopwatch.ElapsedMilliseconds;
public long ElapsedTimeSeconds => stopwatch.ElapsedMilliseconds / 1000L;
@CptAsgard
CptAsgard / ForwardConeEditor.cs
Last active July 17, 2021 09:23
Field of View indicator mesh generator tool for Unity
using UnityEditor;
using UnityEngine;
// Like https://gamedev.stackexchange.com/questions/31170/drawing-a-dynamic-indicator-for-a-field-of-view
// "Drawing a dynamic indicator for a field of view"
// But adjusted for my needs: 1) project time mesh generation and 2) consistent vertex density w/ varying angles
public class ForwardConeEditor : EditorWindow
{
private float angleDegrees;
// ==UserScript==
// @name Robin Time Left Printer
// @description Violently Butchered Robin Assistant
// @namespace com.github.cptasgard
// @include https://www.reddit.com/robin/
// @include https://www.reddit.com/robin
// @version 1.0
// @author LeoVerto, Wiiplay123, Getnamo, CptAsgard
// @match https://www.reddit.com/robin
// @grant none
// ==UserScript==
// @name Robin Time Left Printer
// @description Violently Butchered Robin Assistant
// @namespace com.github.cptasgard
// @include https://www.reddit.com/robin/
// @include https://www.reddit.com/robin
// @version 1.9
// @author LeoVerto, Wiiplay123, Getnamo, CptAsgard
// @grant none
// ==/UserScript==
@CptAsgard
CptAsgard / Greyscale.cs
Created May 15, 2014 11:24
Unity Greyscale image effect
using UnityEngine;
using System.Collections;
public class Greyscale : MonoBehaviour {
public Material mat;
void Start() {
mat.SetFloat( "_Power", 0.0f );
}