Skip to content

Instantly share code, notes, and snippets.

View oultrox's full-sized avatar

Jesús Pérez oultrox

View GitHub Profile
using System;
using System.Collections;
using UnityEngine;
public class SwordSwing : MonoBehaviour
{
private Transform swordTransform;
private Quaternion qr;
private Vector3 idealEuler;
@oultrox
oultrox / FPSMovement3D.cs
Last active December 12, 2017 15:07
FPSMovement3D
using UnityEngine;
[RequireComponent(typeof(CharacterController))]
public class FPSMovement3D : MonoBehaviour {
[SerializeField] private float playerWalkingSpeed = 5f;
[SerializeField] private float playerRunningSpeed = 15f;
[SerializeField] private float jumpStrength = 20f;
[SerializeField] private float verticalRotationLimit = 80f;
@oultrox
oultrox / ManagerCamShake.cs
Created January 19, 2018 14:27
ManagerCamShake
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));
@oultrox
oultrox / RatioEnforcer.cs
Created March 9, 2018 21:11
Ratio Enforcer (Letterbox Scale)
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
// 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" {