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.GetChild(0).gameOdject;
g.GetComponent<Block>().isMoving = false;
g.transform.SetParent(map);
g.transform.eulerAngles = Vector3.zero;
g.tag = "Block";

}
Destroy (gameOdject);
}
}
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);
}
}

я исправил, вставляй
ОС
Олег Сенин
545
Лучший ответ
Владислав Андриянов спасибо, где была ошибка?