Skip to content

Instantly share code, notes, and snippets.


Jesús Pérez oultrox

View GitHub Profile
View maskedSurfaceWithEdgeEmission.shader
// threshold for mask can be controlled using vertex color alpha (useful for spriteRenderers or particle systems)
// _MainTex: alpha of this texture is used as a mask
// _EmissionTex: usually rgb noise texture, adjust it's scaling if needed
// color remap and oscilation for each channel of emission can be modified in _EmStrobeBFALR, _EmStrobeBFALG, _EmStrobeBFALB
// Base: base amplitude of brightness oscilation
// Freq: frequency of oscilation
// Ampl: amplitude of oscilation
// L: how much _EmissionTex affects this color
Shader "StandardWMask" {
oultrox / RatioEnforcer.cs
Created Mar 9, 2018
Ratio Enforcer (Letterbox Scale)
View RatioEnforcer.cs
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class RatioEnforcer : MonoBehaviour {
[SerializeField] private float targetWidth = 256;
[SerializeField] private float targetHeight = 240;
// Use this for initialization
View ManagerCamShake.cs
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class ManagerCamShake : MonoBehaviour
public static ManagerCamShake instance;
[SerializeField] private float speed = 20f;
[SerializeField] private AnimationCurve damper = new AnimationCurve(new Keyframe(0f, 1f), new Keyframe(0.9f, .33f, -2f, -2f), new Keyframe(1f, 0f, -5.65f, -5.65f));
View FPSMovement3D.cs
using UnityEngine;
public class FPSMovement3D : MonoBehaviour {
[SerializeField] private float playerWalkingSpeed = 5f;
[SerializeField] private float playerRunningSpeed = 15f;
[SerializeField] private float jumpStrength = 20f;
[SerializeField] private float verticalRotationLimit = 80f;
View SwordSwing.cs
using System;
using System.Collections;
using UnityEngine;
public class SwordSwing : MonoBehaviour
private Transform swordTransform;
private Quaternion qr;
private Vector3 idealEuler;