Skip to content

Instantly share code, notes, and snippets.

View daniele-quero's full-sized avatar

Daniele Quero daniele-quero

View GitHub Profile
private string TranslateByProficiency(string s, float p)
{
if (p == 1) return s;
if (p == 0) return CoverText.CoverTextWith(s, "x");
var words = s.Split(" ");
for (int i = 0; i < words.Length; i++)
{
if (Random.value > p)
{
public class Durstenfeld<T>
{
public static void shuffle(T[] array)
{
int l = array.Length;
for (int i = l - 1; i >= 0; i--)
{
int j = Random.Range(0, i);
swap(array, i, j);
}
public static string CoverTextWith(string text, string x)
{
return Regex.Replace(text, "([A-Za-z0-9])", x);
}
public class SliderToText : MonoBehaviour
{
private Slider _slider;
public TextMeshProUGUI label;
void Start()
{
_slider = GetComponent<Slider>();
_slider.value = 69;
}
public class ToggleCallback : MonoBehaviour
{
public TextMeshProUGUI label;
public List<Toggle> toggles;
void Start()
{
string s = toggles
.Select(t => t)
.Where(t => t.isOn == true)
private Image _mapImage;
private Vector3 _mapPos = Vector3.zero;
private Vector3 _elemPos = Vector3.zero;
void Update()
{
_mapPos.x = _player.transform.position.x;
_mapPos.y = _player.transform.position.z;
_mapImage.rectTransform.localPosition = -_mapPos;
private Mapper _player;
private Dictionary<Transform, RectTransform> _images = new Dictionary<Transform, RectTransform>();
[SerializeField]
private GameObject _elemTemplate;
public void PaintNewElement(Mapper m)
{
var o = Instantiate(_elemTemplate);
o.GetComponent<Image>().color = m.color;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
public class Mapper : MonoBehaviour
{
public bool isPlayer;
public Color color;
public class LabelActivator : MonoBehaviour
{
public void LabelMuscle()
{
UIManager.Instance.UpdateLabel(1);
}
public void LabelBone()
{
UIManager.Instance.UpdateLabel(2);
public void Play(int id)
{
_animator.SetInteger("stateId", id);
UIManager.Instance.UpdateLabel(id);
}