SetCosts
Last updated
Was this helpful?
Last updated
Was this helpful?
Was this helpful?
// let's make a wall of lava
for (int i = 3; i < 8; i++)
{
float xCoord = i;
float yCoord = 3;
PositionedNode node = tileNodeNetwork.GetClosestNodeTo(xCoord, yCoord);
// The PropertyField is a bitfield so we need to
// shift over the number 1 by the tile type.
// Because of this we're limited to values between 0 and 31 (inclusive)
node.PropertyField = (1 << (int)(TileType.Lava));
}
// Now let's set the costs of different terrain:
float[] costs = new float[32];
costs[(int)TileType.Lava] = 100;
costs[(int)TileType.Mud] = 3;
costs[(int)TileType.Quicksand] = 6;
costs[(int)TileType.Spikes] = 50;
costs[(int)TileType.Water] = 1.5f;
tileNodeNetwork.SetCosts(costs);