public void SetupTerrainStrip(TerrainInfo terrainInfo, Prop prop = new Prop(), bool movable = false) { _cells = new List <Cell>(20); //All strips contain 20 cells corresponding to their width _testProps = new List <Prop>(20); zPosKey = (int)transform.position.z; SetTerrainInfo(terrainInfo); _movableStripManager = new MovableStripManager(); IsMovable = movable; if (movable) { if (Type == TerrainType.River) { _movableStripManager.SetupManager(Type, zPosKey, _lastLogDirection); _lastLogDirection = _lastLogDirection * -1; } else { _movableStripManager.SetupManager(Type, zPosKey); } } if (prop.propPrefab != null) { CreateCells(prop); return; } CreateCells(); }
// Start is called before the first frame update void Start() { _poolDictionary = new Dictionary <TerrainType, List <GameObject> >(); _lastStripPos = -5; _sameStripCount = 0; CreatePropPools(); MovableStripManager.CreateManagerPools(); _stripPool = new Dictionary <int, TerrainStrip>(NumStrips); for (int i = 0; i < NumStrips; i++) { AddNewStrip(); } _unusedStrips = new Stack <int>(); currentStrip = 0; TerrainStrip.StripInactive += OnStripInactive; }