You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
447 lines
17 KiB
447 lines
17 KiB
using System.Collections;
|
|
using System.Collections.Generic;
|
|
using UnityEngine;
|
|
|
|
namespace BuildSystem
|
|
{
|
|
public enum RoadType
|
|
{
|
|
Straight,T,Ten
|
|
}
|
|
public enum DirIsHaveRoad
|
|
{
|
|
Yes,No,None
|
|
}
|
|
|
|
public enum RoadNumberType
|
|
{
|
|
None,Two,Three
|
|
}
|
|
|
|
[CreateAssetMenu(fileName = "New PlaceObj", menuName = "PlaceObject")]
|
|
public class PlaceObject_SO : ScriptableObject
|
|
{
|
|
public string nameString;
|
|
public Transform prefab;
|
|
public int width;
|
|
public int height;
|
|
public RoadType roadType;//道路类型
|
|
public RoadNumberType[] roadNumberType = new RoadNumberType[4];//道路车道类型
|
|
public DirIsHaveRoad[] isHaveRoad = new DirIsHaveRoad[4];//道路是否有通道
|
|
public List<object[]> roadGoInfo;
|
|
|
|
private void OnEnable()
|
|
{
|
|
|
|
roadGoInfo = new List<object[]>();
|
|
|
|
|
|
for (int i = 0; i < 4; i++)
|
|
{
|
|
for (int j = 0; j < 3; j++)
|
|
{
|
|
object[] isCan = new object[4] { null, null, null, null };
|
|
//如果对应方向上有道路 进行特殊设置
|
|
if (isHaveRoad[i] == DirIsHaveRoad.Yes)
|
|
{
|
|
//遍历四个方向 如果方向有道路说明可以设置
|
|
if (roadNumberType[i] == RoadNumberType.Two && j == 2)
|
|
{
|
|
roadGoInfo.Add(isCan);
|
|
break;
|
|
}
|
|
for (int k = 0; k < 4; k++)
|
|
{
|
|
if (isHaveRoad[k] == DirIsHaveRoad.Yes)
|
|
{
|
|
isCan[k] = true;
|
|
}
|
|
}
|
|
//把自己方向的设置制空
|
|
isCan[i] = null;
|
|
}
|
|
roadGoInfo.Add(isCan);
|
|
}
|
|
}
|
|
|
|
if (nameString == "T2Down")
|
|
{
|
|
roadGoInfo = null;
|
|
roadGoInfo = new List<object[]>() {
|
|
new object[4]{null,null,null,null},
|
|
new object[4]{null,null,null,null},
|
|
new object[4]{null,null,null,null},
|
|
|
|
new object[4]{null,null,null,true},
|
|
new object[4]{null,null, true, true},
|
|
new object[4]{null,null,null,null},
|
|
|
|
new object[4]{null,true,null,null},
|
|
new object[4]{null,null,null,true},
|
|
new object[4]{null,null,null,null},
|
|
|
|
new object[4]{null,true,true,null},
|
|
new object[4]{null,true,null,null},
|
|
new object[4]{null,null,null,null},
|
|
};
|
|
} else if (nameString == "T2Left") {
|
|
roadGoInfo = null;
|
|
roadGoInfo = new List<object[]>() {
|
|
new object[4]{null,null,true,true},
|
|
new object[4]{null, null, true, null},
|
|
new object[4]{null,null,null,null},
|
|
|
|
new object[4]{null,null,null,null},
|
|
new object[4]{null,null, null, null},
|
|
new object[4]{null,null,null,null},
|
|
|
|
new object[4]{true,null,null,null},
|
|
new object[4]{ true, null, null,true},
|
|
new object[4]{null,null,null,null},
|
|
|
|
new object[4]{null,null, true, null},
|
|
new object[4]{true, null, null, null},
|
|
new object[4]{null,null,null,null},
|
|
};
|
|
}
|
|
else if (nameString == "T2Right")
|
|
{
|
|
roadGoInfo = null;
|
|
roadGoInfo = new List<object[]>() {
|
|
new object[4]{null,null,true,null},
|
|
new object[4]{null, true, true, null},
|
|
new object[4]{null,null,null,null},
|
|
|
|
new object[4]{true,null,null,null},
|
|
new object[4]{null,null, true, null},
|
|
new object[4]{null,null,null,null},
|
|
|
|
new object[4]{true,true,null,null},
|
|
new object[4]{ true, null, null,null},
|
|
new object[4]{null,null,null,null},
|
|
|
|
new object[4]{null,null, null, null},
|
|
new object[4]{null, null, null, null},
|
|
new object[4]{null,null,null,null},
|
|
};
|
|
}
|
|
else if (nameString == "T2Up")
|
|
{
|
|
roadGoInfo = null;
|
|
roadGoInfo = new List<object[]>() {
|
|
new object[4]{null,null, null, true},
|
|
new object[4]{null, true, null, null},
|
|
new object[4]{null,null,null,null},
|
|
|
|
new object[4]{true,null,null,true},
|
|
new object[4]{ null, null, null, true},
|
|
new object[4]{null,null,null,null},
|
|
|
|
new object[4]{null, null, null,null},
|
|
new object[4]{ null, null, null,null},
|
|
new object[4]{null,null,null,null},
|
|
|
|
new object[4]{null, true, null, null},
|
|
new object[4]{ true, true, null, null},
|
|
new object[4]{null,null,null,null},
|
|
};
|
|
}else if (nameString == "T3Down")
|
|
{
|
|
roadGoInfo = null;
|
|
roadGoInfo = new List<object[]>() {
|
|
new object[4]{null,null,null,null},
|
|
new object[4]{null,null,null,null},
|
|
new object[4]{null,null,null,null},
|
|
|
|
new object[4]{null,null,null,true},
|
|
new object[4]{null,null, null, true},
|
|
new object[4]{null,null, true, true},
|
|
|
|
new object[4]{null,true,null,null},
|
|
new object[4]{null,true,null,true},
|
|
new object[4]{null,null,null,true},
|
|
|
|
new object[4]{null,true,true,null},
|
|
new object[4]{null,true,null,null},
|
|
new object[4]{null, true, null, null},
|
|
};
|
|
}
|
|
else if (nameString == "T3Left")
|
|
{
|
|
roadGoInfo = null;
|
|
roadGoInfo = new List<object[]>() {
|
|
new object[4]{null,null,true,true},
|
|
new object[4]{null, null, true, null},
|
|
new object[4]{null,null, true, null},
|
|
|
|
new object[4]{null,null,null,null},
|
|
new object[4]{null,null, null, null},
|
|
new object[4]{null,null,null,null},
|
|
|
|
new object[4]{true,null,null,null},
|
|
new object[4]{ true, null, null,null},
|
|
new object[4]{ true, null,null,true},
|
|
|
|
new object[4]{null,null, true, null},
|
|
new object[4]{true, null, true, null},
|
|
new object[4]{ true, null,null,null},
|
|
};
|
|
}
|
|
else if (nameString == "T3Right")
|
|
{
|
|
roadGoInfo = null;
|
|
roadGoInfo = new List<object[]>() {
|
|
new object[4]{null,null,true,null},
|
|
new object[4]{null, null, true, null},
|
|
new object[4]{null, true, true, null},
|
|
|
|
new object[4]{true,null,null,null},
|
|
new object[4]{ true, null, true, null},
|
|
new object[4]{null,null, true, null},
|
|
|
|
new object[4]{true,true,null,null},
|
|
new object[4]{ true, null, null,null},
|
|
new object[4]{ true, null, null,null},
|
|
|
|
new object[4]{null,null, null, null},
|
|
new object[4]{null, null, null, null},
|
|
new object[4]{null,null,null,null},
|
|
};
|
|
}
|
|
else if (nameString == "T3Up")
|
|
{
|
|
roadGoInfo = null;
|
|
roadGoInfo = new List<object[]>() {
|
|
new object[4]{null,null, null, true},
|
|
new object[4]{null, true, null, true},
|
|
new object[4]{null, true, null,null},
|
|
|
|
new object[4]{true,null,null,true},
|
|
new object[4]{ null, null, null, true},
|
|
new object[4]{ null, null,null,true},
|
|
|
|
new object[4]{null, null, null,null},
|
|
new object[4]{ null, null, null,null},
|
|
new object[4]{null,null,null,null},
|
|
|
|
new object[4]{null, true, null, null},
|
|
new object[4]{ null, true, null, null},
|
|
new object[4]{ true, true, null,null},
|
|
};
|
|
}
|
|
else if (nameString == "T23Down")
|
|
{
|
|
roadGoInfo = null;
|
|
roadGoInfo = new List<object[]>() {
|
|
new object[4]{null,null,null,null},
|
|
new object[4]{null,null,null,null},
|
|
new object[4]{null,null,null,null},
|
|
|
|
new object[4]{null,null, null, true},
|
|
new object[4]{null,null, true, true},
|
|
new object[4]{null,null,null,null},
|
|
|
|
new object[4]{null,true,null,null},
|
|
new object[4]{null, true, null,true},
|
|
new object[4]{null,null,null,true},
|
|
|
|
new object[4]{null,true, null, null},
|
|
new object[4]{null,true,true,null},
|
|
new object[4]{null,null,null,null},
|
|
};
|
|
}
|
|
else if (nameString == "T23Left")
|
|
{
|
|
roadGoInfo = null;
|
|
roadGoInfo = new List<object[]>() {
|
|
new object[4]{null,null,true,true},
|
|
new object[4]{null, null, true, null},
|
|
new object[4]{null,null,null,null},
|
|
|
|
new object[4]{null,null,null,null},
|
|
new object[4]{null,null, null, null},
|
|
new object[4]{null,null,null,null},
|
|
|
|
new object[4]{true,null,null,null},
|
|
new object[4]{ true, null, null,true},
|
|
new object[4]{null,null,null,null},
|
|
|
|
new object[4]{null,null, true, null},
|
|
new object[4]{true, null, true, null},
|
|
new object[4]{ true, null,null,null},
|
|
};
|
|
}
|
|
else if (nameString == "T23Right")
|
|
{
|
|
roadGoInfo = null;
|
|
roadGoInfo = new List<object[]>() {
|
|
new object[4]{null,null,true,null},
|
|
new object[4]{null, true, true, null},
|
|
new object[4]{null,null,null,null},
|
|
|
|
new object[4]{true,null,null,null},
|
|
new object[4]{ true, null, true, null},
|
|
new object[4]{null,null, true, null},
|
|
|
|
new object[4]{true,true,null,null},
|
|
new object[4]{ true, null, null,null},
|
|
new object[4]{null,null,null,null},
|
|
|
|
new object[4]{null,null, null, null},
|
|
new object[4]{null, null, null, null},
|
|
new object[4]{null,null,null,null},
|
|
};
|
|
}
|
|
else if (nameString == "T23Up")
|
|
{
|
|
roadGoInfo = null;
|
|
roadGoInfo = new List<object[]>() {
|
|
new object[4]{null,null, null, true},
|
|
new object[4]{null, true, null, true},
|
|
new object[4]{null, true, null,null},
|
|
|
|
new object[4]{true,null,null,true},
|
|
new object[4]{ null, null, null, true},
|
|
new object[4]{null,null,null,null},
|
|
|
|
new object[4]{null, null, null,null},
|
|
new object[4]{ null, null, null,null},
|
|
new object[4]{null,null,null,null},
|
|
|
|
new object[4]{null, true, null, null},
|
|
new object[4]{ true, true, null, null},
|
|
new object[4]{null,null,null,null},
|
|
};
|
|
}
|
|
else if (nameString == "T32Down")
|
|
{
|
|
roadGoInfo = null;
|
|
roadGoInfo = new List<object[]>() {
|
|
new object[4]{null,null,null,null},
|
|
new object[4]{null,null,null,null},
|
|
new object[4]{null,null,null,null},
|
|
|
|
new object[4]{null,null,null,true},
|
|
new object[4]{null,null, null, true},
|
|
new object[4]{null,null, true, true},
|
|
|
|
new object[4]{null,true,null,null},
|
|
new object[4]{null,null,null,true},
|
|
new object[4]{null,null,null,null},
|
|
|
|
new object[4]{null,true,true,null},
|
|
new object[4]{null,true,null,null},
|
|
new object[4]{null, true, null, null},
|
|
};
|
|
}
|
|
else if (nameString == "T32Left")
|
|
{
|
|
roadGoInfo = null;
|
|
roadGoInfo = new List<object[]>() {
|
|
new object[4]{null,null,true,true},
|
|
new object[4]{null, null, true, null},
|
|
new object[4]{null,null, true, null},
|
|
|
|
new object[4]{null,null,null,null},
|
|
new object[4]{null,null, null, null},
|
|
new object[4]{null,null,null,null},
|
|
|
|
new object[4]{true,null,null,null},
|
|
new object[4]{ true, null, null,null},
|
|
new object[4]{ true, null,null,true},
|
|
|
|
new object[4]{null,null, true, null},
|
|
new object[4]{true, null, null, null},
|
|
new object[4]{ null, null,null,null},
|
|
};
|
|
}
|
|
else if (nameString == "T32Right")
|
|
{
|
|
roadGoInfo = null;
|
|
roadGoInfo = new List<object[]>() {
|
|
new object[4]{null,null,true,null},
|
|
new object[4]{null, null, true, null},
|
|
new object[4]{null, true, true, null},
|
|
|
|
new object[4]{true,null,null,null},
|
|
new object[4]{ null, null, true, null},
|
|
new object[4]{null,null, null, null},
|
|
|
|
new object[4]{true,true,null,null},
|
|
new object[4]{ true, null, null,null},
|
|
new object[4]{ true, null, null,null},
|
|
|
|
new object[4]{null,null, null, null},
|
|
new object[4]{null, null, null, null},
|
|
new object[4]{null,null,null,null},
|
|
};
|
|
}
|
|
else if (nameString == "T32Up")
|
|
{
|
|
roadGoInfo = null;
|
|
roadGoInfo = new List<object[]>() {
|
|
new object[4]{null,null, null, true},
|
|
new object[4]{null, true, null, null},
|
|
new object[4]{null, null, null,null},
|
|
|
|
new object[4]{true,null,null,true},
|
|
new object[4]{ null, null, null, true},
|
|
new object[4]{ null, null,null,true},
|
|
|
|
new object[4]{null, null, null,null},
|
|
new object[4]{ null, null, null,null},
|
|
new object[4]{null,null,null,null},
|
|
|
|
new object[4]{null, true, null, null},
|
|
new object[4]{ null, true, null, null},
|
|
new object[4]{ true, true, null,null},
|
|
};
|
|
}
|
|
else if (nameString == "TenTwo")
|
|
{
|
|
roadGoInfo = null;
|
|
roadGoInfo = new List<object[]>() {
|
|
new object[4]{null,null, true, true},
|
|
new object[4]{null, true, true, null},
|
|
new object[4]{null, null, null,null},
|
|
|
|
new object[4]{true,null,null,true},
|
|
new object[4]{ null, null, true, true},
|
|
new object[4]{ null, null,null,null},
|
|
|
|
new object[4]{true, true, null,null},
|
|
new object[4]{ true, null, null,true},
|
|
new object[4]{null,null,null,null},
|
|
|
|
new object[4]{ null, true, true, null},
|
|
new object[4]{true, true, null, null},
|
|
new object[4]{ null, null, null,null},
|
|
};
|
|
}
|
|
else if (nameString == "TenThree")
|
|
{
|
|
roadGoInfo = null;
|
|
roadGoInfo = new List<object[]>() {
|
|
new object[4]{null,null, true, true},
|
|
new object[4]{null, null, true, null},
|
|
new object[4]{null, true, true,null},
|
|
|
|
new object[4]{true,null,null,true},
|
|
new object[4]{ null, null, null, true},
|
|
new object[4]{ null, null,true,true},
|
|
|
|
new object[4]{true, true, null,null},
|
|
new object[4]{ true, null, null,null},
|
|
new object[4]{ true, null,null,true},
|
|
|
|
new object[4]{ null, true, true, null},
|
|
new object[4]{ null, true, null, null},
|
|
new object[4]{ true, true, null,null},
|
|
};
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
}
|