Skip to content

Instantly share code, notes, and snippets.

View Mike-Schvedov's full-sized avatar

Mike Schvedov Mike-Schvedov

View GitHub Profile
@Mike-Schvedov
Mike-Schvedov / MinimapClickHandler.cs
Created November 30, 2025 08:49
MinimapClickHandler
using UnityEngine;
using UnityEngine.EventSystems;
public class MinimapClickHandler : MonoBehaviour, IPointerClickHandler
{
public Camera minimapCamera;
[Header("Fine-tune offsets")]
public float offsetX = -12f; // Use your own values
public float offsetZ = -15f; // Use your own values
@Mike-Schvedov
Mike-Schvedov / FogOfWarManager.cs
Created July 23, 2025 07:49
Fog of War Manager
using UnityEngine;
using System.Collections.Generic;
public class FogOfWarManager : MonoBehaviour
{
public static FogOfWarManager Instance;
public int textureResolution = 250; // Higher will impact game performance
public float worldSize = 100f;
public float visionRadius = 5f;
Shader "Custom/URP/SimpleFogOfWar_SmoothEdges"
{
Properties
{
_MainTex ("Fog Texture", 2D) = "white" {}
_TexelSize ("Texel Size", Vector) = (1,1,0,0)
}
SubShader
{
using UnityEngine;
public class ProceduralGenerator : MonoBehaviour
{
public GameObject prefab;
public int numberOfPrefabInstances = 200;
public Vector3 generationAreaSize = new Vector3(100f, 1f, 100f);
public float yAxisOffset = 0.07f;
using System;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
[RequireComponent(typeof(Animator))]
public class HorseController : MonoBehaviour
{
public Transform saddlePoint;
@Mike-Schvedov
Mike-Schvedov / removeitem
Created April 23, 2025 10:23
RemoveItem Method
public void RemoveItem(string itemName, int amountToRemove)
{
int remainingAmountToRemove = amountToRemove;
foreach (InventorySlot slot in slotList)
{
if (slot.itemInSlot != null && slot.itemInSlot.thisName == itemName)
{
int amountInSlot = slot.itemInSlot.amountInInventory;
@Mike-Schvedov
Mike-Schvedov / Harvester.cs
Created January 23, 2025 10:48
Harvester
using UnityEngine;
using UnityEngine.AI;
public class Harvester : MonoBehaviour
{
public Transform assignedNode; // Assigned resource node
public Transform supplyCenter; // Supply center for depositing resources
public float harvestAmountPerSecond = 1f; // Harvest rate
public float maxCapacity = 10f; // Max carrying capacity
@Mike-Schvedov
Mike-Schvedov / Projectile.cs
Created January 22, 2025 08:43
Projectile (Survival 61 Episode)
using System.Collections;
using UnityEngine;
public class Projectile : MonoBehaviour
{
private Rigidbody rb;
private int arrowDamage = 25;
private bool isStuck = false; // Flag to track if the arrow is stuck
private void Start()
@Mike-Schvedov
Mike-Schvedov / BowController.cs
Created January 22, 2025 08:32
BowController (Survival Episode 61)
using System.Collections;
using UnityEngine;
public class BowController : MonoBehaviour
{
private Animator bowAnimator; // Reference to the Animator
public InventorySystem inventory; // Reference to your inventory system
public string arrowItemName = "Arrow"; // Name of the arrow item in the inventory
private bool isDrawing = false;
@Mike-Schvedov
Mike-Schvedov / Drop Old Table Command
Created December 3, 2024 07:08
Drop Old Table, Create New One
docker exec -i mysql-container mysql -u mike -pmike1234 mydatabase -e "
DROP TABLE IF EXISTS users;
CREATE TABLE users (id VARCHAR(255) PRIMARY KEY, score INT);"