本文整理汇总了C#中TileType.ToString方法的典型用法代码示例。如果您正苦于以下问题:C# TileType.ToString方法的具体用法?C# TileType.ToString怎么用?C# TileType.ToString使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TileType
的用法示例。
在下文中一共展示了TileType.ToString方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: GetTileType
public GameObject GetTileType (TileType type)
{
if (!_tiles.ContainsKey(type) || _tiles[type].Count < 1)
{
throw new TileNotFoundException("Cannot find tile of type " + type.ToString());
}
List<GameObject> possible = _tiles[type];
return possible[rand.Next(possible.Count)];
}
示例2: GetOpposite
public static TileDetail GetOpposite(TileType type)
{
switch (type) {
case TileType.Freedom: return Law;
case TileType.Human: return Robot;
case TileType.Law: return Freedom;
case TileType.Religion: return Science;
case TileType.Robot: return Human;
case TileType.Science: return Freedom;
case TileType.Score: return null;
case TileType.Time: return null;
default: throw new System.ArgumentException(type.ToString());
}
}
示例3: ToDescriptionString
/// <summary>
/// Gets the path of the type, with its description.
/// </summary>
/// <param name="val">The value.</param>
/// <returns></returns>
public static string ToDescriptionString(TileType val)
{
DescriptionAttribute[] attributes = (DescriptionAttribute[])val.GetType().GetField(val.ToString()).GetCustomAttributes(typeof(DescriptionAttribute), false);
return attributes.Length > 0 ? attributes[0].Description : string.Empty;
}
示例4: IsBonusActive
private bool IsBonusActive(TileType type)
{
switch (type) {
case TileType.Freedom:
return levelLaw < bonusThreshold;
case TileType.Human:
return levelRobot < bonusThreshold;
case TileType.Law:
return levelLaw > (100 - bonusThreshold);
case TileType.Religion:
return levelReligion > (100 - bonusThreshold);
case TileType.Robot:
return levelRobot > (100 - bonusThreshold);
case TileType.Science:
return levelReligion < bonusThreshold;
case TileType.Score:
return false;
case TileType.Time:
return false;
default:
throw new System.ArgumentException(type.ToString());
}
}
示例5: createTileAt
//.........这里部分代码省略.........
curSprite = pathTopLeftBottomRightTiles[Random.Range(0, pathTopLeftBottomRightTiles.Length-1)];
passability = pathPassability;
break;
case TileType.PathTopLeftTopRight:
curSprite = pathTopLeftTopRightTiles[Random.Range(0, pathTopLeftTopRightTiles.Length-1)];
passability = pathPassability;
break;
case TileType.PathBottomLeftBottomRight:
curSprite = pathBottomLeftBottomRightTiles[Random.Range(0, pathBottomLeftBottomRightTiles.Length-1)];
passability = pathPassability;
break;
case TileType.Tree:
curSprite = treeTiles[Random.Range(0, treeTiles.Length-1)];
passability = treePassability;
break;
case TileType.Water:
curSprite = waterTiles[Random.Range (0, waterTiles.Length - 1)];
passability = waterPassability;
break;
case TileType.WaterDeep:
curSprite = deepWaterTiles[Random.Range (0, deepWaterTiles.Length - 1)];
passability = deepWaterPassability;
break;
case TileType.Bank_TL:
curSprite = bankTopLeftTiles[Random.Range (0, bankTopLeftTiles.Length - 1)];
passability = bankPassability;
break;
case TileType.Bank_TR:
curSprite = bankTopRightTiles[Random.Range (0, bankTopRightTiles.Length - 1)];
passability = bankPassability;
break;
case TileType.Bank_BL:
curSprite = bankBottomLeftTiles[Random.Range (0, bankBottomLeftTiles.Length - 1)];
passability = bankPassability;
break;
case TileType.Bank_BR:
curSprite = bankBottomRightTiles[Random.Range (0, bankBottomRightTiles.Length - 1)];
passability = bankPassability;
break;
case TileType.Bank_Top:
curSprite = bankTopTiles[Random.Range (0, bankTopTiles.Length - 1)];
passability = bankPassability;
break;
case TileType.Bank_Bottom:
curSprite = bankBottomTiles[Random.Range (0, bankBottomTiles.Length - 1)];
passability = bankPassability;
break;
case TileType.Bank_Left:
curSprite = bankLeftTiles[Random.Range (0, bankLeftTiles.Length - 1)];
passability = bankPassability;
break;
case TileType.Bank_Right:
curSprite = bankRightTiles[Random.Range (0, bankRightTiles.Length - 1)];
passability = bankPassability;
break;
case TileType.Bank_BottomLeftRight:
curSprite = bankBottomLeftRightTiles[Random.Range (0, bankBottomLeftRightTiles.Length - 1)];
passability = bankPassability;
break;
case TileType.Bank_TopLeftRight:
curSprite = bankBottomLeftRightTiles[Random.Range (0, bankRightTiles.Length - 1)];
passability = bankPassability;
break;
case TileType.Bank_TopLeftBottomLeft:
curSprite = bankTopRightBottomRightTiles[Random.Range (0, bankTopRightBottomRightTiles.Length - 1)];
passability = bankPassability;
break;
case TileType.Bank_TopRightBottomRight:
curSprite = bankTopRightBottomRightTiles[Random.Range (0, bankTopRightBottomRightTiles.Length - 1)];
passability = bankPassability;
break;
case TileType.Stone:
curSprite = stoneTiles[Random.Range(0, stoneTiles.Length-1)];
passability = stonePassability;
break;
default:
curSprite = grassTiles[Random.Range(0, grassTiles.Length-1)];
passability = grassPassability;
break;
}
Vector2 screenPos = m_tileMap.map2Screen(x, y);
screenPos.y += (curSprite.rect.height - m_tileMap.m_tileHeight) / m_tileMap.m_tileHeight * 0.25f;
GameObject cur = Instantiate(tilePrefab, new Vector3(screenPos.x, screenPos.y, -z), Quaternion.identity) as GameObject;
cur.transform.parent = targetFolder;
cur.name = "Tile-" + x + "x" + y + "x" + z + "_" + type.ToString();
cur.SetActive(true);
cur.GetComponent<SpriteRenderer>().sprite = curSprite;
cur.GetComponent<SpriteRenderer>().sortingOrder = (int)(m_tileMap.getHeight() * z - y);
// Need to flip?
if (type == TileType.Bank_TopLeftRight)
cur.GetComponent<Transform>().localScale = new Vector3(1, -1, 1);
if (type == TileType.Bank_TopLeftBottomLeft)
cur.GetComponent<Transform>().localScale = new Vector3(-1, 1, 1);
m_tileMap.setTile(x, y, z, cur);
m_tileMap.setPassability (x, y, passability);
}
示例6: DefineAll
TileType DefineAll(TileType neighborOne, TileType neighborTwo, int myX, int myY, int firstPosX, int firstPosY, int secondPosX, int secondPosY, bool isCorner = false)
{
TileType myTileType = TileType.UNDEFINED;
if (neighborOne != TileType.UNDEFINED || neighborTwo != TileType.UNDEFINED)
{
// Both are DEFINED, so select based on the first and second neighbor
myTileType = GetMyTileTypeFromNeighbors(neighborOne, neighborTwo, isCorner);
print("One neighbor is defined. Neighbors of : " + myX + " " + myY + " are: " + neighborOne.ToString() + " and " + neighborTwo.ToString() + ", isCorner = " + isCorner.ToString());
}
else
{
myTileType = DefineTypeFromUndefinedNeighbors(isCorner);
}
// if (neighborOne == TileType.UNDEFINED && neighborTwo == TileType.UNDEFINED) {
// myTileType = DefineTypeFromUndefinedNeighbors (isCorner);
// } else {
// myTileType = GetMyTileTypeFromNeighbors (neighborOne, neighborTwo, isCorner);
//
// }
/*
if (neighborOne != TileType.UNDEFINED && neighborTwo != TileType.UNDEFINED) {
// BOTH neighbors are defined
myTileType = GetMyTileTypeFromNeighbors (neighborOne, neighborTwo);
Debug.Log ("Both neighbors defined");
} else if (neighborOne != TileType.UNDEFINED && neighborTwo == TileType.UNDEFINED) {
// ONLY NEIGHBOR ONE is defined
myTileType = GetMyTileTypeFromNeighbors(neighborOne, TileType.UNDEFINED);
}
if (neighborOne == TileType.UNDEFINED){
// First neighbor is undefined so select from no defined tiles
myTileType = DefineTypeFromUndefinedNeighbors();
// Now define both neighbors based on my tile type
neighborOne = DefineNeighborTypes(myTileType, true);
neighborTwo = DefineNeighborTypes(myTileType, false);
}else if (neighborOne != TileType.UNDEFINED && neighborTwo != TileType.UNDEFINED){
// Both are DEFINED, so select based on the first and second neighbor
myTileType = GetMyTileTypeFromNeighbors(neighborOne, neighborTwo);
}else if (neighborOne != TileType.UNDEFINED){
// Only first neighbor is Defined, FIRST define the SECOND NEIGHBOR
neighborTwo = DefineTypeFromUndefinedNeighbors();
// Now determine my tile type using my two neighbors
myTileType = GetMyTileTypeFromNeighbors(neighborOne, neighborTwo);
}
*/
// define this tile on the types array
tileTypes[myX, myY] = myTileType;
// define neighbors on the array as well if at least ONE of them was undefined
// if (tileTypes[firstPosX, firstPosY] == TileType.UNDEFINED || tileTypes[secondPosX, secondPosY] == TileType.UNDEFINED){
// tileTypes[firstPosX, firstPosY] = neighborOne;
// tileTypes[secondPosX,secondPosY] = neighborTwo;
// }
print ("Tile at: " + myX + " " + myY + " is of type: " + myTileType.ToString ());
return myTileType;
}
示例7: toolManager_CurrentTileTypeChanged
void toolManager_CurrentTileTypeChanged(TileType type)
{
SetMouseTile(type.ToString());
}
示例8: StoreMap
/// <summary>
/// Stores the newly created map in the database, assuming a connection could be established
/// </summary>
private void StoreMap(TileType[,] mapTiles)
{
int stored = 0;
try
{
stored = mapDBController.StoreMap(mapTiles.ToString(), difficulty, startingResources, startingLives);
if (!Convert.ToBoolean(stored))
throw new Exception("Could not store map. Please check your internet connection");
}
catch (Exception except)
{
GeneralLogger.GetInstance().AddError(except.Message);
}
mapID = stored;
}
示例9: SwitchTileType
public void SwitchTileType(TileType x)
{
tt = x;
gameObject.layer = LayerMask.NameToLayer(tt.ToString());
}