Skip to content

Instantly share code, notes, and snippets.

View yUtopist's full-sized avatar
😶‍🌫️
Developing

Aleksei Stukalov yUtopist

😶‍🌫️
Developing
  • Christchurch, New Zealand
View GitHub Profile
@yUtopist
yUtopist / largestRemainderRound.js
Last active March 27, 2021 12:40 — forked from scwood/largestRemainderRound.js
Largest remainder round
/**
* largestRemainderRound will round each number in an array to the nearest
* integer but make sure that the the sum of all the numbers still equals
* desiredTotal. Uses Largest Remainder Method. Returns numbers in order they
* came.
*
* @param {number[]} numbers - array of numbers
* @param {number} desiredTotal - denominator: 100 for %, 360 for deg
* @return {number[]} the list of rounded numbers
* @example
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEditor;
public class groundGeneration : MonoBehaviour {
public GameObject objectGround;
public Transform objectGroundPosition;
// THIS IS EXAMPLE 3
// Resize with MenuSizeChangerCoroutine() coroutine, using Time.deltaTime
// create UI Panel in Unity Editor with size 2200, 1100, call it "menuInventoryPanel".
// creat script for this UI Panel called "inventoryMenuScript" and copy this code there.
// create Button in Unity Editor, in "On Click()" editor add new element and atache "menuInventoryPanel" and choose "inventoryMenuScript > InventoryInteraction0" as function.
using System.Collections;
using UnityEngine;
using UnityEngine.UI;
// THIS IS EXAMPLE 2
// Resize with MenuSizeChangerCoroutine() coroutine, using Animation Curve Editor
// create UI Panel in Unity Editor with size 2200, 1100, call it "menuInventoryPanel".
// creat script for this UI Panel called "inventoryMenuScript" and copy this code there.
// in Inspector for UI Panel change "Animation Curve" AnimationCurve to 5ft from left, which looks like letter "S", this cuurve called logistic curve.
// create Button in Unity Editor, in "On Click()" editor add new element and atache "menuInventoryPanel" and choose "inventoryMenuScript > InventoryInteraction0" as function.
using System.Collections;
using UnityEngine;
// THIS IS EXAMPLE 1
// Resize with MenuSizeChangerFunction() function in Update();
// create UI Panel in Unity Editor with size 2200, 1100, call it "menuInventoryPanel".
// creat script for this UI Panel called "inventoryMenuScript" and copy this code there.
// create Button in Unity Editor, in "On Click()" editor add new element and atache "menuInventoryPanel" and choose "inventoryMenuScript > InventoryInteraction0" as function.
using UnityEngine;
using UnityEngine.UI;