Beispiel #1
0
			/** Applies a value to the node using the specified ChannelUse */
			void ApplyChannel (GridNode node, int x, int z, int value, ChannelUse channelUse, float factor) {
				switch (channelUse) {
				case ChannelUse.Penalty:
					node.Penalty += (uint)Mathf.RoundToInt (value*factor);
					break;
				case ChannelUse.Position:
					node.position = GridNode.GetGridGraph(node.GraphIndex).GetNodePosition (node.NodeInGridIndex, Mathf.RoundToInt (value*factor*Int3.Precision));
					break;
				case ChannelUse.WalkablePenalty:
					if (value == 0) {
						node.Walkable = false;
					} else {
						node.Penalty += (uint)Mathf.RoundToInt ((value-1)*factor);
					}
					break;
				}
			}
Beispiel #2
0
 /** Applies a value to the node using the specified ChannelUse */
 void ApplyChannel(Node node, int x, int z, int value, ChannelUse channelUse, float factor)
 {
     switch (channelUse) {
     case ChannelUse.Penalty:
         node.penalty += (uint)Mathf.RoundToInt (value*factor);
         break;
     case ChannelUse.Position:
         node.position.y = Mathf.RoundToInt (value*factor*Int3.Precision);
         break;
     case ChannelUse.WalkablePenalty:
         if (value == 0) {
             node.walkable = false;
         } else {
             node.penalty += (uint)Mathf.RoundToInt ((value-1)*factor);
         }
         break;
     }
 }