2025-05-12 01:29:30 +03:00
|
|
|
|
/*
|
|
|
|
|
* Author: Nikolay Dvurechensky
|
|
|
|
|
* Site: https://www.dvurechensky.pro/
|
|
|
|
|
* Gmail: dvurechenskysoft@gmail.com
|
2025-05-12 01:31:46 +03:00
|
|
|
|
* Last Updated: 12 мая 2025 01:30:28
|
|
|
|
|
* Version: 1.0.4
|
2025-05-12 01:29:30 +03:00
|
|
|
|
*/
|
|
|
|
|
|
2024-10-05 08:54:55 +03:00
|
|
|
|
using UnityEngine;
|
|
|
|
|
|
|
|
|
|
/*
|
2025-05-12 01:29:30 +03:00
|
|
|
|
* Instantiate(Создание объектов)
|
2024-10-05 08:54:55 +03:00
|
|
|
|
*/
|
|
|
|
|
public class Lesson_5 : MonoBehaviour
|
|
|
|
|
{
|
|
|
|
|
public GameObject[] gameObjects;
|
|
|
|
|
private GameObject inst_Object;
|
|
|
|
|
|
|
|
|
|
private void Start()
|
|
|
|
|
{
|
|
|
|
|
for(uint i = 0; i < gameObjects.Length; i++)
|
|
|
|
|
{
|
|
|
|
|
var clone = Instantiate(gameObjects[(int)Random.Range(0, 2f)],
|
|
|
|
|
gameObjects[(int)Random.Range(0, 2f)].transform.position,
|
|
|
|
|
Quaternion.identity);
|
|
|
|
|
ControllerLessons.Instance.Lesson_3.createObjList.Add(clone);
|
|
|
|
|
}
|
|
|
|
|
|
2025-05-12 01:29:30 +03:00
|
|
|
|
//Создание и взаимодействие с созданным
|
2024-10-05 08:54:55 +03:00
|
|
|
|
inst_Object = Instantiate(gameObjects[2], new Vector3(10,10,10), Quaternion.identity);
|
|
|
|
|
inst_Object.name = "my";
|
|
|
|
|
inst_Object.GetComponent<Renderer>().material.color = Color.red;
|
|
|
|
|
ControllerLessons.Instance.Lesson_3.createObjList.Add(inst_Object);
|
|
|
|
|
}
|
|
|
|
|
}
|