public void AddNewBlock() { levelBlock block = (levelBlock)Instantiate(levelBlock); block.transform.SetParent(this.transform, false); Vector3 blockPosition = Vector3.zero; blockPosition = new Vector3(LastLevelBlock.exitPoint.position.x + block.width / 2, LastLevelBlock.exitPoint.position.y, LastLevelBlock.exitPoint.position.z); block.transform.position = blockPosition; currentLevelBlock = block; }
public void RemoveOldBlock() { Destroy(LastLevelBlock.gameObject); LastLevelBlock = currentLevelBlock; AddNewBlock(); }