// Flowfloor control function void Flowfloors() { if (tempFlowingfloors.Count > 0) { int sfPos; List <int> arrayList = new List <int>(tempFlowingfloors.Keys); for (int index = 0; index < arrayList.Count; index++) { FlowingfloorManage flowingfloors = tempFlowingfloors[arrayList[index]]; switch (flowingfloors.movingState) { case FlowingfloorState.NONE: flowingfloors.movingState = FlowingfloorState.MOVING; break; case FlowingfloorState.MOVING: int ffPos; int widthSize = flowingfloors.columnNumber; if (flowingfloors.flowingfloorSet.position == FloorPosition.TOP) { ffPos = 0; } else { ffPos = modelLengthNumOnScreen; } int originalName = Floor.instance.GetOriginalName(ffPos, flowingfloors.columnNumber); Vector3 position = Floor.instance.GetPosition(ffPos, widthSize, 0); position.x -= 2.2f; Quaternion objRotation = Quaternion.Euler(0, 0, 0); string name = "Flowingfloor_" + flowingFloorCount; flowingFloorCount++; flowingfloors.count++; GameObject floor = this.GetGameObject(flowingfloorObject[(int)flowingfloors.flowingfloorSet.flowingfloorSizeType], position, objRotation, flowingfloors.count, name); Flowingfloor tempFlowingfloor = floor.GetComponent <Flowingfloor>(); tempFlowingfloor.ResetParameter(); tempFlowingfloor.floorPosition = flowingfloors.flowingfloorSet.position; tempFlowingfloor.floorType = flowingfloors.flowingfloorSet.type; tempFlowingfloor.width = flowingfloors.columnNumber; tempFlowingfloor.index = originalName; tempFlowingfloor.ChangeSpeed = (int)flowingfloors.flowingfloorSet.type; tempFlowingfloor.flowingfloorSizeType = flowingfloors.flowingfloorSet.flowingfloorSizeType; flowingfloors.idleTimeCount = 0; flowingfloors.movingState = FlowingfloorState.IDLING; break; case FlowingfloorState.IDLING: if (flowingfloors.idleTimeCount >= flowingfloors.flowingfloorSet.idleTime) { flowingfloors.movingState = FlowingfloorState.NONE; } else { flowingfloors.idleTimeCount += Time.deltaTime; } break; } } } }
void SetNewDataToCell(int setCount, bool startState) { int collectionId = GetCollectionId(); if (startState == true) { collectionId = defaultFloor.defaultFloorCollection; } int columnNo; int columnCount; for (int width = 0; width < setCount; width++) { columnCount = floorSetup.floorSetCollection[collectionId].floorSetConf.Count; columnNo = GetColumnId(columnCount); if (columnNo == 1) { collectionId = GetCollectionId(); } FloorColumnDef floorColumnDef = floorSetup.floorSetCollection[collectionId].floorSetConf[columnNo]; FloorColumnSet floorList = floorSetup.floorColumnSetList[floorColumnDef.columnIndex]; int floorSetupListCount = floorList.floorSetList.Count; int floorObjectIndex = 0; int obstacleObjectIndex = 0; int index; for (int length = 0; length < modelLengthNumOnScreen; length++) { bool listDataMatchState = false; int name = GetName(length, presentBlockNum); FloorSet tempFloorSet = new FloorSet(); ObstacleTypes obstacleType = ObstacleTypes.NONE; FloorAttributes tempFloorAtt = FloorAttributes.FLOOR; if (floorObjectIndex < floorSetupListCount) { tempFloorSet = floorList.floorSetList[floorObjectIndex]; if (tempFloorSet.index == length) { tempFloorAtt = tempFloorSet.floorAttribute; if (tempFloorSet.obstacleType != ObstacleTypes.NONE && tempFloorSet.obstacleType != null) { obstacleType = tempFloorSet.obstacleType; } listDataMatchState = true; Floor.instance.SetToCell(tempFloorSet.floorType, name, obstacleType, tempFloorAtt); floorObjectIndex++; } } if (listDataMatchState == false) { tempFloorSet = defaultFloor.initFloor; Floor.instance.SetToCell(tempFloorSet.floorType, name, obstacleType, tempFloorAtt); listDataMatchState = true; } } int widthSize = GetWidthSize(presentBlockNum); // If ninjastar has existing if (floorColumnDef.ninjastarIndex != null && floorColumnDef.ninjastarIndex > 0) { if (tempStars.ContainsKey(widthSize) == false) { index = floorColumnDef.ninjastarIndex; NinjaStarManage tempNinjastar = new NinjaStarManage(); tempNinjastar.columnNumber = widthSize; tempNinjastar.ninjaStarSet = ninjastarSetup.ninjaStarSetList[index]; tempNinjastar.movingState = NinjastarState.NONE; tempNinjastar.starsCount = 0; tempStars.Add(widthSize, tempNinjastar); if (ninjastarSetup.ninjaStarSetList[index].position == FloorPosition.TOP) { int enemyLocation = GetName(3, presentBlockNum); Floor.instance.SetObstacleType(ObstacleTypes.SOLDIER, enemyLocation); } } } if (floorColumnDef.stickfloorIndex != null && floorColumnDef.stickfloorIndex > 0) { if (tempStickfloors.ContainsKey(widthSize) == false) { index = floorColumnDef.stickfloorIndex; StickfloorManage tempStickfloor = new StickfloorManage(); tempStickfloor.columnNumber = widthSize; tempStickfloor.idleTimeCount = 0f; tempStickfloor.stickfloorSet = stickfloorSetup.stickfloorSetList[index]; tempStickfloor.movingState = StickfloorState.NONE; tempStickfloor.leftStickfloor = 0; tempStickfloor.speedTimeCount = 0; tempStickfloors.Add(widthSize, tempStickfloor); } } if (floorColumnDef.flowingfloorId != null && floorColumnDef.flowingfloorId > 0) { if (tempFlowingfloors.ContainsKey(widthSize) == false) { index = floorColumnDef.flowingfloorId; FlowingfloorManage tempFlowingfloor = new FlowingfloorManage(); tempFlowingfloor.columnNumber = widthSize; tempFlowingfloor.flowingfloorSet = flowingfloorSetup.flowingfloorSetList[index]; tempFlowingfloor.movingState = FlowingfloorState.NONE; tempFlowingfloor.count = 0; tempFlowingfloors.Add(widthSize, tempFlowingfloor); } } if (floorColumnDef.rollingRockId != null && floorColumnDef.rollingRockId > 0) { if (tempRollingRocks.ContainsKey(widthSize) == false) { index = floorColumnDef.rollingRockId; RollingRockManage tempRollingRock = new RollingRockManage(); tempRollingRock.columnNumber = widthSize; tempRollingRock.rollingRockSet = rollingRockSetup.rollingRockSetList[index]; tempRollingRock.movingState = RollingRockState.NONE; tempRollingRock.rollingRockCount = 0; tempRollingRock.rollingRockStartState = true; tempRollingRocks.Add(widthSize, tempRollingRock); } } // Floor local position increase if (presentBlockNum < modelWidthNumOnScreen) { presentBlockNum++; } } }