Skip to content

Instantly share code, notes, and snippets.

View pppoe252110's full-sized avatar

Artem Kuranakov pppoe252110

  • Parity
View GitHub Profile
using UnityEngine;
[System.Serializable]
public class RotationConstraints
{
public Vector2 x = new Vector2(-30, 30);
public Vector2 y = new Vector2(-30, 30);
public Vector2 z = new Vector2(-5, 5);
}
@pppoe252110
pppoe252110 / UIZoomMove.cs
Created July 31, 2024 12:27
Zoom and Move UI Panel Relative to Mouse
using UnityEngine;
public class UIZoomMove : MonoBehaviour
{
[Header("Zoom")]
[SerializeField] private float _zoomSpeed = 0.1f;
[SerializeField] private float _minZoom = 0.1f;
[SerializeField] private float _maxZoom = 5f;
[Header("Properties")]
using UnityEngine;
namespace SFMeshDeformer.Demo
{
public class BallThrow : MonoBehaviour
{
[SerializeField] private Rigidbody _ballPrefab;
[SerializeField] private float _throwSpeed = 30f;
void Update()
@pppoe252110
pppoe252110 / NoisyFog.shadergraph
Last active June 6, 2024 14:45
URP Only Fullscreen Fog Shader
{
"m_SGVersion": 3,
"m_Type": "UnityEditor.ShaderGraph.GraphData",
"m_ObjectId": "5c145d3ada4f40ea93038af752306c50",
"m_Properties": [
{
"m_Id": "729b6309691e494ca5acf0f0c5c34cf6"
},
{
"m_Id": "c993aca6d4e8473eb4d1795495527359"
@pppoe252110
pppoe252110 / RandomExtension.cs
Last active May 17, 2024 13:06
A random function to determine a random item from a collection with a chance, with the chance being cast to a value between 0 and 1. Example: chance - 0.1 chance - 0.1 chance - 0.2 become chance - 0.25 chance 0.25 chance - 0.5. This makes it possible not to count a certain chance for hundreds of items in a collection
using System;
using UnityEngine;
public static class RandomExtension
{
public static int ProceedValue(float random, RandomData[] data)
{
var cumulativeSumArray = new float[data.Length];
cumulativeSumArray[0] = data[0].chance;
for (int i = 1; i < cumulativeSumArray.Length; ++i)
@pppoe252110
pppoe252110 / theme.css
Last active December 17, 2024 05:15
discord theme zero two
root {
--app-background: url("https://wallpapers.com/images/hd/darling-in-the-franxx-pictures-wt4qtisaf6xdk0ah.jpg"); /* main app background image [default: url("https://przemec.github.io/Novum/assets/images/app.png")] */
--main-color: #992727; /* main color (used mostly in buttons) [default: #992727] */
--main-color-selected: #aa2f2f; /* [default: #aa2f2f] */
--main-color-semitransparent: #d4393926; /* [default: #d4393926] */
--main-color-semitransparent-selected: #d336364d; /* [default: #d336364d] */
--accent-color: #fd9fa0; /* accent color (used in links, mentions etc.) [default: #fd9fa0] */
--accent-color-semitransparent: #fca7a918; /* [default: #fca7a918] */
--accent-saturated: #fd7a7c; /* [default: #fd7a7c] */
--accent-desaturated: #b47a7a; /* [default: #b47a7a] */
@pppoe252110
pppoe252110 / DungeonCell.cs
Created January 14, 2024 02:13
Dungeon Rooms Proceed Generator
using System.Collections.Generic;
using UnityEngine;
public class DungeonCell : MonoBehaviour
{
public List<int> connections = new List<int>();
public int roomId = -1;
public Transform leftWall;
public Transform rightWall;
@pppoe252110
pppoe252110 / ItemOverview.cs
Created December 16, 2023 14:03
Simple Item Rotation Relative to Camera Script
using UnityEngine;
public class ItemOverview : MonoBehaviour
{
[SerializeField] private Transform center;
[SerializeField] private Transform viewCamera;
[SerializeField] private Transform overviewItem;
[SerializeField] private float itemRotationSpeed = 10f;
[SerializeField] private float cameraRotationSpeed = 0.5f;
@pppoe252110
pppoe252110 / ImageToModel.cs
Created November 30, 2023 03:50
Pixel Art To Model Unity
using System;
using System.Collections.Generic;
using UnityEngine;
[RequireComponent(typeof(MeshFilter))]
[RequireComponent(typeof(MeshRenderer))]
public class ImageToModel : MonoBehaviour
{
public Sprite sprite;
@pppoe252110
pppoe252110 / ColorPicker.cs
Last active November 16, 2023 01:37
Simple ColorPicker
using UnityEngine;
using UnityEngine.Events;
using UnityEngine.UI;
public class ColorPicker : MonoBehaviour
{
public Slider rainbowSlider;
public Slider saturationSlider;
public Slider luminanceSlider;
public Slider alphaSlider;