This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| using System.Collections; | |
| using System.Collections.Generic; | |
| using UnityEngine; | |
| using UnityEngine.UI; // Добавляем класс с элементами UI | |
| public class body : MonoBehaviour | |
| { | |
| int loot = 0; | |
| public Text text; // Добавляем поле с текстом | |
| void Update() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| IEnumerator Start() | |
| { | |
| while(true)//Бесконечный цикл | |
| { | |
| Collider[] hitColliders = Physics.OverlapSphere(transform.position, 10); //Создаём массив и добавляем туда все объекты в радиусе 10 | |
| for(int i = 0; i<hitColliders.Length; i++) //Проверяем все объекты в массиве | |
| { | |
| if(hitColliders[i].gameObject.tag == "loot")//Если у объекта есть данный тег | |
| { | |
| var rb = hitColliders[i].GetComponent<Rigidbody>();// Создаём переменную rb и пемещаем туда Rigidbody |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| using System.Collections; | |
| using System.Collections.Generic; | |
| using UnityEngine; | |
| public class player2 : MonoBehaviour | |
| { | |
| public int speed = 5; | |
| public float rotationSpeed = 100.0F; | |
| public Rigidbody rb; | |
| public GameObject body; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| using System.Collections; | |
| using System.Collections.Generic; | |
| using UnityEngine; | |
| public class ShowFPS : MonoBehaviour { | |
| public static float fps; | |
| void OnGUI() | |
| { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| using System.Collections; | |
| using System.Collections.Generic; | |
| using UnityEngine; | |
| public class LootGravity : MonoBehaviour | |
| { | |
| void Update() | |
| { | |
| var number=0; | |
| Collider[] hitColliders = Physics.OverlapSphere(transform.position, transform.lossyScale.y*0.5f); |
NewerOlder