protected void AddResizeableCollectible(PlatformTypeChance.PlatformType type, float toPositionY) { if (list == null) { list = new List <CollectibleHolder>(); } bool found = false; foreach (CollectibleHolder ptc in list) { if (ptc.item == type) { if (ptc.toPositionY < Camera.main.transform.position.y + _defaultDuration) { ptc.toPositionY = Camera.main.transform.position.y + _defaultDuration; } if (_platformFactory.maxPlatformWidth != toPositionY || _platformFactory.minPlatformWidth != toPositionY) { _platformFactory.maxPlatformWidth = toPositionY; _platformFactory.minPlatformWidth = toPositionY; } found = true; break; } } if (found) { return; } CollectibleHolder newHolder = new CollectibleHolder(); newHolder.item = type; _platformFactory.maxPlatformWidth = toPositionY; _platformFactory.minPlatformWidth = toPositionY; newHolder.toPositionY = Camera.main.transform.position.y + _defaultDuration; list.Add(newHolder); }
protected void AddDefaultCollectible(PlatformTypeChance.PlatformType type, float toPositionY) { if (list == null) { list = new List <CollectibleHolder>(); } bool found = false; foreach (CollectibleHolder ptc in list) { if (ptc.item == type) { if (ptc.toPositionY < toPositionY) { ptc.toPositionY = toPositionY; } found = true; break; } } if (found) { return; } CollectibleHolder newHolder = new CollectibleHolder(); for (int i = 0; i < _platformFactory.components.Length; i++) { if (_platformFactory.components[i].type == type) { _platformFactory.components[i].chance = 100; _platformFactory.components[i].minimumSameComponentGap = 0; break; } } newHolder.toPositionY = toPositionY; newHolder.item = type; list.Add(newHolder); }