Skip to content

Instantly share code, notes, and snippets.

View ElKoziRRo's full-sized avatar
🏠
Working from home

Tomasz KOZA Kozanecki ElKoziRRo

🏠
Working from home
View GitHub Profile
using UnityEngine;
/// <summary>
/// Responsive Camera Scaler
/// </summary>
public class CameraAspectRatioScaler : MonoBehaviour {
/// <summary>
/// Reference Resolution like 1920x1080
/// </summary>
@ElKoziRRo
ElKoziRRo / I18n.cs
Created May 3, 2020 18:34 — forked from ditzel/I18n.cs
Internationalization - See code comments for usage
/*
* Internationalization
*
* Author: Daniel Erdmann
*
* 1. Add this File to you Project
*
* 2. Add the language files to the folder Assets/Resources/I18n. (Filesnames: en.txt, es.txt, pt.txt, de.txt, and so on)
* Format: en.txt: es.txt:
* =============== =================
@ElKoziRRo
ElKoziRRo / ClickDetector.cs
Created May 3, 2020 18:34 — forked from ditzel/ClickDetector.cs
Detect a OnClick Event in 3D Space on a GameObject
/*
* Detects clicks on game objects
*
* 1. Attach ClickDetector component to a camera or a "game manager" object
* 2. Attach a collider (e.g. BoxCollider) to all objects that should receive a on click event
* 3. Attach a MonoBehaviour to all objects that should receive a on click event registering to the event.
*
* The MonoBehavior should have at least:
*
* public class ClickableGameObject : MonoBehaviour, ClickDetector.ClickDetectorListener
@ElKoziRRo
ElKoziRRo / CameraBillboard.cs
Created May 3, 2020 18:34 — forked from ditzel/CameraBillboard.cs
Rotates an object (e.g. a canvas) to face it towards the camera
/*
* Rotates an object towards the currently active camera
*
* 1. Attach CameraBillboard component to a canvas or a game object
* 2. Specify the offset and you're done
*
**/
using UnityEngine;
using UnityEngine;
using System.IO;
public class FileManager
{
/// <summary>
/// Load File
/// </summary>
/// <typeparam name="T">Data Model Type</typeparam>
/// <param name="filename">File Name</param>
@ElKoziRRo
ElKoziRRo / Platform.cs
Created May 3, 2020 18:34 — forked from ditzel/Platform.cs
Moving Platform
using UnityEngine;
/*
* Moving Platform
*
* 1. Attach WayPointPath to an empty game object
* 2. Create empty game object children (these will be handled as waypoints)
* 3. Attach Platform component to a game object and assign the WayPointPath
*
*
**/
@ElKoziRRo
ElKoziRRo / Paintable.cs
Created May 3, 2020 18:34 — forked from ditzel/Paintable.cs
Drawing Canvas
using System.Collections;
using System.IO;
using UnityEngine;
public class Paintable : MonoBehaviour {
public GameObject Brush;
public float BrushSize = 0.1f;
public RenderTexture RTexture;
@ElKoziRRo
ElKoziRRo / HappyCube.cs
Created May 3, 2020 18:34 — forked from ditzel/HappyCube.cs
Mesh from Code
using UnityEngine;
public class HappyCube : MonoBehaviour {
MeshFilter mFilter;
Mesh Mesh;
public float UpDownFactor = 0.1f;
public float UpDownSpeed = 6f;
public float LeftFactor = 0.3f;
@ElKoziRRo
ElKoziRRo / KdTree.cs
Created May 3, 2020 18:34 — forked from ditzel/KdTree.cs
k-d Tree
using System;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.Profiling;
public class KdTree<T> : IEnumerable<T>, IEnumerable where T : Component
{
protected KdNode _root;
protected KdNode _last;
@ElKoziRRo
ElKoziRRo / TouchToShoot.cs
Created May 3, 2020 18:33 — forked from ditzel/TouchToShoot.cs
Touch to Shoot
using UnityEngine;
public class TouchToShoot : MonoBehaviour {
public Material hitMaterial;
// Use this for initialization
void Start () {
}