Добавлен скрипт генерации карты
This commit is contained in:
35
Assets/Crossy Road VR/Scenes/Test/Scripts/SpawnTileScript.cs
Normal file
35
Assets/Crossy Road VR/Scenes/Test/Scripts/SpawnTileScript.cs
Normal file
@ -0,0 +1,35 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.Runtime.CompilerServices;
|
||||
using UnityEngine;
|
||||
|
||||
public class SpawnTileScript : MonoBehaviour
|
||||
{
|
||||
[SerializeField]
|
||||
private List<GameObject> _Tiles = new List<GameObject>();
|
||||
[SerializeField]
|
||||
private GameObject _CurrentTile;
|
||||
|
||||
private bool _Instantiated = false;
|
||||
|
||||
private void Start()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
private void OnTriggerEnter(Collider other)
|
||||
{
|
||||
if (other.gameObject.tag == "Player")
|
||||
{
|
||||
if (_Instantiated)
|
||||
{
|
||||
GenerateTile(_Tiles[0]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void GenerateTile(GameObject tile)
|
||||
{
|
||||
Instantiate(tile, new Vector3(_CurrentTile.transform.position.x, _CurrentTile.transform.position.y, _CurrentTile.transform.position.z+20), _CurrentTile.transform.rotation);
|
||||
}
|
||||
}
|
@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: ca3942fa12d4a6d4697bcdb9318ea7a7
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
Reference in New Issue
Block a user