Commit c31cdab8 by Raphael

Switching

parent f1307d78
igem-quantifly
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ProjectModuleManager">
<modules>
<module fileurl="file://$PROJECT_DIR$/riderModule.iml" filepath="$PROJECT_DIR$/riderModule.iml" />
</modules>
</component>
</project>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="VcsDirectoryMappings">
<mapping directory="$PROJECT_DIR$/../.." vcs="Git" />
</component>
</project>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<module type="RIDER_MODULE" version="4">
<component name="NewModuleRootManager">
<content url="file://$MODULE_DIR$/../..">
<sourceFolder url="file://$MODULE_DIR$/../.." isTestSource="false" />
<excludeFolder url="file://$MODULE_DIR$/../../Temp/bin" />
<excludeFolder url="file://$MODULE_DIR$/../../obj" />
</content>
<orderEntry type="sourceFolder" forTests="false" />
</component>
</module>
\ No newline at end of file
fileFormatVersion: 2
guid: f6cb68588aa5f4d55ad0173e13f27e75
timeCreated: 1470581493
licenseType: Free
NativeFormatImporter:
userData:
assetBundleName:
assetBundleVariant:
using Assets.Scripts.MapGeneration; using Assets.Scripts.MapGeneration;
using Assets.Scripts.Utils; using Assets.Scripts.Utils;
using UnityEngine; using UnityEngine;
using System;
namespace Assets.Scripts namespace Assets.Scripts
{ {
internal class CADelegates
{
static System.Random r = new System.Random();
public static bool CanGrow(Cell cell)
{
if (cell.Position.x == 0)
return true;
if (cell.Position.x % 10 == 0)
return (cell.Position.y < 16 && (cell.Position.y * r.Next(100)) / 100
< 50);
return false;
}
}
public class GameController : MonoBehaviour public class GameController : MonoBehaviour
{ {
public static int PoolSize = 256; public static int PoolSize = 256;
...@@ -25,8 +42,7 @@ namespace Assets.Scripts ...@@ -25,8 +42,7 @@ namespace Assets.Scripts
_pooledWalls = new ObjectPool(PoolSize); _pooledWalls = new ObjectPool(PoolSize);
_ca = new CellularAutomaton(_map, TileType.Wall); _ca = new CellularAutomaton(_map, TileType.Wall);
_ca.CanGrowRule = CADelegates.CanGrow;
} }
void Update() void Update()
......
...@@ -44,9 +44,9 @@ namespace Assets.Scripts.MapGeneration ...@@ -44,9 +44,9 @@ namespace Assets.Scripts.MapGeneration
private Map _map; private Map _map;
private List<Cell> _toProcess; private List<Cell> _toProcess;
private CanGrow _canGrowRule; public CanGrow CanGrowRule;
private WillGrow _willGrowRule; public WillGrow WillGrowRule;
private Picktarget _pickTargetRule; public Picktarget PickTargetRule;
private TileType _targetType; private TileType _targetType;
...@@ -59,9 +59,9 @@ namespace Assets.Scripts.MapGeneration ...@@ -59,9 +59,9 @@ namespace Assets.Scripts.MapGeneration
_map = map; _map = map;
_targetType = targetType; _targetType = targetType;
_canGrowRule = DefaultCellDelegates.DefaultCanGrow; CanGrowRule = DefaultCellDelegates.DefaultCanGrow;
_willGrowRule = DefaultCellDelegates.DefaultWillGrow; WillGrowRule = DefaultCellDelegates.DefaultWillGrow;
_pickTargetRule = DefaultCellDelegates.DefaultPickTarget; PickTargetRule = DefaultCellDelegates.DefaultPickTarget;
_toProcess = new List<Cell> {new Cell(startX, startY, targetType)}; _toProcess = new List<Cell> {new Cell(startX, startY, targetType)};
} }
...@@ -76,10 +76,10 @@ namespace Assets.Scripts.MapGeneration ...@@ -76,10 +76,10 @@ namespace Assets.Scripts.MapGeneration
foreach (var cell in _toProcess) foreach (var cell in _toProcess)
{ {
if (!_canGrowRule(cell) || !_willGrowRule(cell)) if (!CanGrowRule(cell) || !WillGrowRule(cell))
continue; continue;
Grow(_pickTargetRule(_map, cell), _targetType); Grow(PickTargetRule(_map, cell), _targetType);
newCells.Add(cell); newCells.Add(cell);
} }
......
m_EditorVersion: 5.4.0f3 m_EditorVersion: 5.4.1f1
m_StandardAssetsVersion: 0 m_StandardAssetsVersion: 0
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment