// Ninjastar motion control function void RollingRocks() { if (tempRollingRocks.Count > 0) { int rrPos; List <int> arrayList = new List <int>(tempRollingRocks.Keys); for (int index = 0; index < arrayList.Count; index++) { RollingRockManage rollingRocks = tempRollingRocks[arrayList[index]]; switch (rollingRocks.movingState) { case RollingRockState.NONE: TestSoundManager.I.PlayCarSound(); rollingRocks.movingState = RollingRockState.MOVING; break; case RollingRockState.MOVING: if (rollingRocks.rollingRockSet.rollingRocks.Count <= rollingRocks.rollingRockCount) { rollingRocks.idleTimeCount = 0; rollingRocks.movingState = RollingRockState.IDLING; } else { int rollingRockIndex = rollingRocks.rollingRockCount; RollingRockDef rollingRockDef = rollingRocks.rollingRockSet.rollingRocks[rollingRockIndex]; int widthSize = rollingRocks.columnNumber; // Setup position through ninja star position if (rollingRocks.rollingRockSet.position == FloorPosition.TOP) { rrPos = 0; } else { rrPos = modelLengthNumOnScreen; } Vector3 position = Floor.instance.GetPosition(rrPos, widthSize, 0); position.y += rollingRockHeight; Quaternion objRotation = Quaternion.Euler(0, 0, 0); string name = "RollingStone_" + rollingRocks.rollingRockCount; rollingRocks.rollingRockCount++; StartCoroutine(RollRock(rollingRockDef.time, position, objRotation, rollingRocks.rollingRockCount, name, rollingRocks.rollingRockSet.position, rollingRocks.rollingRockSet.type, rollingRocks.rollingRockStartState)); if (rollingRocks.rollingRockStartState == true) { rollingRocks.rollingRockStartState = false; } } break; case RollingRockState.IDLING: if (rollingRocks.idleTimeCount >= rollingRocks.rollingRockSet.idleTime) { rollingRocks.rollingRockCount = 0; rollingRocks.movingState = RollingRockState.NONE; rollingRocks.rollingRockStartState = true; } else { rollingRocks.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++; } } }