Skip to content

Instantly share code, notes, and snippets.

View Mike-Schvedov's full-sized avatar

Mike Schvedov Mike-Schvedov

View GitHub Profile
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);"
@Mike-Schvedov
Mike-Schvedov / Disable MOTD Deletion
Created December 2, 2024 10:41
Disable Message of the Day Deletion
sudo nano /etc/cloud/cloud.cfg.d/99-disable-motd.cfg
# Disable motd updates
system_info:
motd: []
@Mike-Schvedov
Mike-Schvedov / APIClient.cs
Created December 2, 2024 07:35
New APIClient (Episode 10)
using UnityEngine;
using UnityEngine.Networking;
using System.Collections;
using System;
public class APIClient : MonoBehaviour
{
// Server Base URL
private const string serverBaseUrl = "http://16.171.29.140:5002/";
@Mike-Schvedov
Mike-Schvedov / MySQL Container Configuration
Created December 2, 2024 07:21
MySQL Container Configuration
docker run -d \
--name mysql-container \
--restart unless-stopped \
-e MYSQL_ROOT_PASSWORD=rootpassword \
-e MYSQL_DATABASE=mydatabase \
-e MYSQL_USER=myuser \
-e MYSQL_PASSWORD=mypassword \
-v mysql-data:/var/lib/mysql \
-p 3306:3306 \
mysql:latest