Скажите пожалуйста где ошибся , не могу найти ошибку .
код:
using System;//надо
using System.Collections;//надо
using System.Collections.Generic;//надо
using UnityEngine;//надо
public class Shape : MonoBehaviour
{
// снижение фигуры
Coroutine moveCoroutine = null;
bool canLeft = true;
bool canRight = true;
bool isMoving = true;
Transform map;
void Start()
{
map = GameObject.PindGameObjectWithTag("Map").transform; // родитель обЪекта
// снижение фигуры
moveCoroutine = StartCoroutine (MoveDown());
}
void Update()
{
if(isMoving)
{
Move();
}
}
void Move()
{
// оси фигуры
float x = 0;
float y = 0;
// перемешение фигуры
if (Input.GetKeyDown(KeyCode.LeftArrow) && canLeft)
{
x = -0.5f;
}
// перемешение фигуры
else if (Input.GetKeyDown(KeyCode.RightArrow) && canRight)
{
x = 0.5f;
}
// перемешение фигуры
if (Input.GetKeyDown(KeyCode.DownArrow))
{
y = -0.5f;
}
transform.Translate(x,y,0);
}
}
private void LateUpdate()
{ //поворот фигуры
RotateShape();
}
// снижение фигуры
IEnumerator MoveDown()
{
while (true)
{
transform.Translate(0, -0.5f, 0 , Space.World);
yield return new WaitForSeconds(1f);
}
}
void RotateShape()
{ //поворот фигуры
if (Input.GetKeyDown(KeyCode.UpArrow))
{
transform.eulerAngles = transform.eulerAngles + new Vector3(0,0, -90);
}
}
internal void BorderColided(string tag)
{
switch (tag)
{
case "LeftBorlder":
canLeft = false;
break;
case "RightBorlder":
canRight = false;
break;
case "BottomBorder":
StopMovement();
break;
default:
canLeft = true;
canRight = true;
break;
}
}
void StopMovement()
{
isMoving = false;
if (moveCoroutine != null)
{
StopCoroutine(moveCoroutine);
moveCoroutine = null;
}
while(transform.childCount > 0)
{
GameObject g = transform.GetChild(0).gameOdject;
g.GetComponent<Block>().isMoving = false;
g.transform.SetParent(map);
g.transform.eulerAngles = Vector3.zero;
g.tag = "Block";
}
Destroy (gameOdject);
}
}
C#
Скажите пожалуйста где ошибся
using System;//надо
using System.Collections;//надо
using System.Collections.Generic;//надо
using UnityEngine;//надо
public class Shape : MonoBehaviour
{
// снижение фигуры
Coroutine moveCoroutine = null;
bool canLeft = true;
bool canRight = true;
bool isMoving = true;
Transform map;
void Start()
{
map = GameObject.PindGameObjectWithTag("Map").transform; // родитель обЪекта
// снижение фигуры
moveCoroutine = StartCoroutine (MoveDown());
}
void Update()
{
if(isMoving)
{
Move();
}
}
void Move()
{
// оси фигуры
float x = 0;
float y = 0;
// перемешение фигуры
if (Input.GetKeyDown(KeyCode.LeftArrow) && canLeft)
{
x = -0.5f;
}
// перемешение фигуры
else if (Input.GetKeyDown(KeyCode.RightArrow) && canRight)
{
x = 0.5f;
}
// перемешение фигуры
if (Input.GetKeyDown(KeyCode.DownArrow))
{
y = -0.5f;
}
transform.Translate(x,y,0);
}
}
private void LateUpdate()
{ //поворот фигуры
RotateShape();
}
// снижение фигуры
IEnumerator MoveDown()
{
while (true)
{
transform.Translate(0, -0.5f, 0, Space.World);
yield return new WaitForSeconds(1f);
}
}
void RotateShape()
{ //поворот фигуры
if (Input.GetKeyDown(KeyCode.UpArrow))
{
transform.eulerAngles = transform.eulerAngles + new Vector3(0,0, -90);
}
}
internal void BorderColided(string tag)
{
switch (tag)
{
case "LeftBorlder":
canLeft = false;
break;
case "RightBorlder":
canRight = false;
break;
case "BottomBorder":
StopMovement();
break;
default:
canLeft = true;
canRight = true;
break;
}
}
void StopMovement()
{
isMoving = false;
if (moveCoroutine != null)
{
StopCoroutine(moveCoroutine);
moveCoroutine = null;
}
while(transform.childCount > 0)
{
GameObject g = transform.GatChild(0).gameOdject;
g.GetComponent().isMoving = false;
g.transform.SetParent(map);
g.transform.eulerAngles = Vector3.zero;
g.tag = "Block";
}
Destroy (gameOdject);
}
}
я исправил, вставляй
using System.Collections;//надо
using System.Collections.Generic;//надо
using UnityEngine;//надо
public class Shape : MonoBehaviour
{
// снижение фигуры
Coroutine moveCoroutine = null;
bool canLeft = true;
bool canRight = true;
bool isMoving = true;
Transform map;
void Start()
{
map = GameObject.PindGameObjectWithTag("Map").transform; // родитель обЪекта
// снижение фигуры
moveCoroutine = StartCoroutine (MoveDown());
}
void Update()
{
if(isMoving)
{
Move();
}
}
void Move()
{
// оси фигуры
float x = 0;
float y = 0;
// перемешение фигуры
if (Input.GetKeyDown(KeyCode.LeftArrow) && canLeft)
{
x = -0.5f;
}
// перемешение фигуры
else if (Input.GetKeyDown(KeyCode.RightArrow) && canRight)
{
x = 0.5f;
}
// перемешение фигуры
if (Input.GetKeyDown(KeyCode.DownArrow))
{
y = -0.5f;
}
transform.Translate(x,y,0);
}
}
private void LateUpdate()
{ //поворот фигуры
RotateShape();
}
// снижение фигуры
IEnumerator MoveDown()
{
while (true)
{
transform.Translate(0, -0.5f, 0, Space.World);
yield return new WaitForSeconds(1f);
}
}
void RotateShape()
{ //поворот фигуры
if (Input.GetKeyDown(KeyCode.UpArrow))
{
transform.eulerAngles = transform.eulerAngles + new Vector3(0,0, -90);
}
}
internal void BorderColided(string tag)
{
switch (tag)
{
case "LeftBorlder":
canLeft = false;
break;
case "RightBorlder":
canRight = false;
break;
case "BottomBorder":
StopMovement();
break;
default:
canLeft = true;
canRight = true;
break;
}
}
void StopMovement()
{
isMoving = false;
if (moveCoroutine != null)
{
StopCoroutine(moveCoroutine);
moveCoroutine = null;
}
while(transform.childCount > 0)
{
GameObject g = transform.GatChild(0).gameOdject;
g.GetComponent().isMoving = false;
g.transform.SetParent(map);
g.transform.eulerAngles = Vector3.zero;
g.tag = "Block";
}
Destroy (gameOdject);
}
}
я исправил, вставляй
Владислав Андриянов
спасибо, где была ошибка?
Владислав Андриянов
Спасибо
Похожие вопросы
- Посоветуйте пожалуйста книгу, для изучения языка программирования C#, с полного нуля, заранее спасибо!
- Помогите пожалуйста. Написать на C#
- ПОМОГИТЕ ПОЖАЛУЙСТА, ОТДАМ ВСЕ СВОЁ ИМУЩЕСТВО
- Помогите пожалуйста написать две программы и составить к ним алгоритм. Ну никак уже не получается...
- Помогите пожалуйста изменить программу
- Пожалуйста помогите Я написал скрипт и 2 часа не могу найти там ошибку
- Помогите исправить код пожалуйста
- Помогите пожалуйста error CS01002 ; expected (22,36) error CS01002 ; expected (26.36)
- Помогите пожалуйста с решением на C#. Я как начинающий программист не совсем понимаю как сделать. Буду Благодарен
- Ребят, очень нужно, пожалуйста