У меня есть два скрипта для генерации лабиринта
mazespawner
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class mazespawner : MonoBehaviour
{
public GameObject CellPrefab;
void Start()
{
mazegenerator generator = new mazegenerator();
mazegeneratorcell[,] maze = generator.generatemaze();
for (int x = 0; x < maze.GetLength(0); x++)
{
for (int y = 0; y < maze.GetLength(1); y++)
{
Instantiate(CellPrefab, new Vector2(x, y), Quaternion.identity);
}
}
}
}
mazegenerator
using UnityEngine;
public class mazegeneratorcell
{
public int Y;
public int X;
public bool WallLeft = true;
public bool WallBottom = true;
}
public class mazegenerator
{
public int Width = 50;
public int Height = 50;
public mazegeneratorcell[,] generatemaze()
{
mazegeneratorcell[,] maze = new mazegeneratorcell[Width, Height];
for (int x = 0; x < maze.GetLength(0); x++)
{
for (int y = 0; y < maze.GetLength(1); y++)
{
maze[x, y] = new mazegeneratorcell(X = x, Y = y);
}
}
return maze;
}
}
Эти два скрипта выдают ошибку
Assets\Scripts\mazespawner.cs(5,14): error CS0101: The namespace '' already contains a definition for 'mazespawner'
Assets\Scripts\mazespawner.cs(9,10): error CS0111: Type 'mazespawner' already defines a member called 'Start' with the same parameter types
Помогите пожалуйста!
В чём проблема?