Skip to content

Instantly share code, notes, and snippets.

View pppoe252110's full-sized avatar

Artem Kuranakov pppoe252110

  • Parity
View GitHub Profile
@pppoe252110
pppoe252110 / DTO.cs
Last active December 22, 2023 09:58
DTO Clone
public static class DTO
{
public static T GetClone<T>(this object donor)
{
var type = typeof(T);
var target = Activator.CreateInstance(type);
var typeDonor = donor.GetType();
var props = type.GetProperties();
foreach (var prop in props)
@pppoe252110
pppoe252110 / MoveInSquareShape.cs
Created October 2, 2023 12:29
Move Object In Square Shape Formula
using UnityEngine;
public class MoveInSquareShape: MonoBehaviour
{
public float size = 1f;
public float rotation = 0f;
private void Update()
{
transform.localPosition = Quaternion.Euler(0, 0, rotation) *
@pppoe252110
pppoe252110 / SimpleChat.cs
Created September 18, 2023 01:00
Simple TCP Chat
using System.Net.Sockets;
using System.Net;
using System.Text;
using System;
namespace WebTestServer
{
public static class Program
{
private static TcpClient client = new TcpClient();
@pppoe252110
pppoe252110 / ThirdPersonCameraController.cs
Last active June 28, 2023 05:20
Third Person Camera Controller
using System.Collections.Generic;
using System.Linq;
using UnityEngine;
using UnityEngine.Serialization;
public class ThirdPersonCameraController : MonoBehaviour
{
[SerializeField, FormerlySerializedAs("Camera Target")] private Transform target;
[Header("View")]
@pppoe252110
pppoe252110 / WeaponSway.cs
Last active April 28, 2025 13:29
Correct Weapon Sway implementation which does not depend on fps
using UnityEngine;
public class WeaponSway : MonoBehaviour
{
[SerializeField] private Transform weaponTransform;
[Header("Sway Properties")]
[SerializeField] private float swaySmooth = 8f;
[SerializeField] private float swayDamp = 2f;
[SerializeField] private float posToRotAmount = 1f;
@pppoe252110
pppoe252110 / CameraController.cs
Last active September 5, 2024 03:30
Unity First Person Camera Controller
using UnityEngine;
public class CameraController : MonoBehaviour
{
[SerializeField] private float _sensitivity = 3;
[SerializeField] private float _maxAngle = 80;
[SerializeField] private float _minAngle = -80;
[SerializeField] private Transform _horizontalRotation;
[SerializeField] private Transform _verticalRotation;
@pppoe252110
pppoe252110 / Multilerp.cs
Last active May 16, 2023 04:19
Multiple Lerp(Multilerp) Function Unity C#
using UnityEngine;
public static class Multilerp
{
public static Vector3 MultilerpFunction(Vector3[] points, float t)
{
if (t >= 1)
{
return points[points.Length - 1];
}