Skip to content

Instantly share code, notes, and snippets.

View Nrjwolf's full-sized avatar
🤙
I'm fine

Alexander Nrjwolf

🤙
I'm fine
View GitHub Profile
@Nrjwolf
Nrjwolf / CustomValue.cs
Last active June 12, 2020 07:25
Custom Value to create constant/random value in range/random value in two ranges
using Random = UnityEngine.Random;
using Sirenix.OdinInspector;
[System.Serializable]
[InlineProperty(LabelWidth = 0)]
public class CustomValue
{
[System.Serializable]
[HideLabel, LabelWidth(50)]
[InlineProperty(LabelWidth = 0)]
@Nrjwolf
Nrjwolf / HomingMissile.cs
Last active July 1, 2020 08:32
Homing Missile. The algorithm is taken from http://www.freeactionscript.com/tag/game-examples/
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class HomingMissile : MonoBehaviour
{
[GetComponent] [SerializeField] private Rigidbody2D m_Rigidbody2D;
public Rigidbody2D Rigidbody2D { get => m_Rigidbody2D; }
public Transform Target;
@Nrjwolf
Nrjwolf / AssetsDistributor.cs
Created July 13, 2020 12:37
Move scripts or whatever in new default folders
using System.Collections.Generic;
using System.IO;
using System.Linq;
using UnityEditor;
using UnityEngine;
/// Thanks @JoshuaMcKenzie for idea http://answers.unity.com/answers/1213863/view.html
public class AssetsDistributor : UnityEditor.AssetModificationProcessor
{
//only evaluate files imported into these paths
@Nrjwolf
Nrjwolf / WaveExplo.shader
Last active July 20, 2020 10:35 — forked from jpsarda/WaveExplo.shader
Add WaveExplosionEffect to your camera
// Upgrade NOTE: replaced 'mul(UNITY_MATRIX_MVP,*)' with 'UnityObjectToClipPos(*)'
Shader "Custom/WaveExplo" {
Properties {
_MainTex ("", 2D) = "white" {}
_CenterX ("CenterX", Range(-1,2)) = 0.5
_CenterY ("CenterY", Range(-1,2)) = 0.5
_Radius ("Radius", Range(-1,1)) = 0.2
_WaveSize ("Wave Size", float) = 0.2
_Amplitude ("Amplitude", Range(-10,10)) = 0.05
using System.Collections;
using System.Collections.Generic;
using Nrjwolf.Tools.AttachAttributes; // https://github.com/Nrjwolf/unity-auto-attach-component-attributes
using TMPro;
using UnityEngine;
[RequireComponent(typeof(TextMeshProUGUI))]
public class TextMeshProTeletypeEffect : MonoBehaviour
{
[GetComponent] [SerializeField] private TextMeshProUGUI m_TextMeshProUGUI;
{
"Get/Set": {
"prefix": "Get/Set",
"body": [
"[SerializeField]",
"private $TYPE m_$NAME;",
"public $TYPE $NAME",
"{",
" get => m_$NAME;",
" set",
{
"FindObjectOfType attribute": {
"prefix": "findObjectOfTypeAttribute",
"body": [
"[FindObjectOfType] [SerializeField] private $COMPONENT m_$COMPONENT;",
"public $COMPONENT $COMPONENT { get => m_$COMPONENT; }"
],
"description": "https://github.com/Nrjwolf/unity-auto-attach-component-attributes"
},
"GetComponent ttribute": {
@Nrjwolf
Nrjwolf / NetworkConnectionChecker.cs
Last active August 23, 2020 09:05
Connection checker
using System;
using System.Collections;
using UnityEngine;
using UnityEngine.Networking;
public class NetworkConnectionChecker : MonoBehaviour
{
[Header("Settings")]
public bool RunOnStart = true;
public string DefaultChekingServer = "https://google.com";