// Ninjastar motion control function void ThrowNinjastars() { if (tempStars.Count > 0) { int nsPos; List <int> arrayList = new List <int>(tempStars.Keys); for (int index = 0; index < arrayList.Count; index++) { NinjaStarManage ninjastars = tempStars[arrayList[index]]; switch (ninjastars.movingState) { case NinjastarState.NONE: TestSoundManager.I.PlayStarSound(); ninjastars.movingState = NinjastarState.MOVING; break; case NinjastarState.MOVING: if (ninjastars.ninjaStarSet.ninjastars.Count <= ninjastars.starsCount) { ninjastars.idleTimeCount = 0; ninjastars.movingState = NinjastarState.IDLING; } else { int starIndex = ninjastars.starsCount; NinjaStarDef ninjastarDef = ninjastars.ninjaStarSet.ninjastars[starIndex]; int widthSize = ninjastars.columnNumber; // Setup position through ninja star position if (ninjastars.ninjaStarSet.position == FloorPosition.TOP) { nsPos = 0; } else { nsPos = modelLengthNumOnScreen; } Vector3 position = Floor.instance.GetPosition(nsPos, widthSize, 0); int floorIndex = Floor.instance.GetOriginalName(3, widthSize); position.y += ninjaStarHeight - 30.3463f; position.x -= 8.81896f; Quaternion objRotation = Quaternion.Euler(0, 0, 0); string name = "Ninjastar_" + ninjastars.starsCount; ninjastars.starsCount++; StartCoroutine(ThrowStar(ninjastarDef.time, position, objRotation, ninjastars.starsCount, name, ninjastars.ninjaStarSet.position, ninjastars.ninjaStarSet.type, floorIndex)); } break; case NinjastarState.IDLING: if (ninjastars.idleTimeCount >= ninjastars.ninjaStarSet.idleTime) { ninjastars.starsCount = 0; ninjastars.movingState = NinjastarState.NONE; } else { ninjastars.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++; } } }