Пример #1
0
    public static void GenerateRandomPositions(ref Dictionary <Vector3, Vector3Int> dictionary, float radius, Vector3 rootPosition)
    {
        foreach (var key in dictionary.Keys.ToList())
        {
            var position = rootPosition + Random.insideUnitSphere * radius;

            JoyconDemo.ClampPosition(ref position);

            while (dictionary.ContainsKey(position))
            {
                position = rootPosition + Random.insideUnitSphere * radius;
                JoyconDemo.ClampPosition(ref position);
            }

            Debug.DrawLine(position, position * 1.1f, Color.cyan, 999999f);

            var val = dictionary[key];
            dictionary.Remove(key);
            dictionary.Add(position, val);
        }
    }
Пример #2
0
 // Use this for initialization
 void Start()
 {
     JoyconDemo joycon = this.GetComponent <JoyconDemo>();
 }