//public bool IsHit (HipHit hitType, uint back, float strength) public bool IsHit(HipHit hitType, uint back, float strength, Orientation currentOrientation, Orientation lasttOrientation) { //Debug.Log("<color=orange>IS HIT: ORIENT: "+currentOrientation.ToString()+" LAST: "+lasttOrientation.ToString()+"</color>"); #if !UNITY_EDITOR //return _is_hit (hitType, back, strength, currentOrientation, lasttOrientation); #else return(true); /* * switch (hitType) { * case HipHit.HIT12: * return Input.GetKeyDown (KeyCode.UpArrow); * * case HipHit.HIT3: * return Input.GetKeyDown (KeyCode.RightArrow); * * case HipHit.HIT6: * return Input.GetKeyDown (KeyCode.DownArrow); * * case HipHit.HIT9: * return Input.GetKeyDown (KeyCode.LeftArrow); * * case HipHit.HITUP: * return Input.GetKeyDown (KeyCode.W); * * case HipHit.HITDOWN: * return Input.GetKeyDown (KeyCode.S); * } * * return false;*/ #endif }
// // // // // // // // // // // // // Hitting functions // // // // // // // // // // // // // // // //public bool IsHit (int _playerID,HipHit _hitType , uint _back, float _strength, Orientation _currentOrientation, Orientation _lastOrientation) //{ // IsHit ( _playerID, _hitType, null, _back, _strength, _currentOrientation, _lastOrientation) //} public float IsHit(int playerID, HipHit hitType, uint back, float strength, Orientation currentOrientation, Orientation lastOrientation, float score) { Debug.Log("hit type in Native Comm " + hitType); Debug.Log("player in Native Comm " + playerID); Debug.Log("orientation " + currentOrientation); //Debug.Log("hit type in Native Comm " + hitTypePlus ); #if !UNITY_EDITOR return(snsrManager.playersDevices [playerID]._is_hit(hitType, back, strength, currentOrientation, lastOrientation, score)); #else return(5.0f); #endif }
public float _is_hit(HipHit hitType, uint back, float strength, Orientation currentOrientation, Orientation lastOrientation, float score) { if (AccelHistoricalData.Count <= 0) { //Debug.Log("NO HISTORICAL DATA: " + AccelHistoricalData.Count); return(0.0f); } hitCounter++; //Debug.Log("HIT COUNTER : "+ hitCounter); uint start_i = back; bool accTest = false; bool hitTestGyroGO = false; bool hitTestGyroGT = false; string strHitType = null; string strHitTypePlus = null; //************************************************************************************** //HIT CHECKS WITH GYRO DATA. float currentOrientAngle = (float)currentOrientation * 1.5f; currentOrientAngle /= 12; currentOrientAngle *= 360; float lastOrientAngle = (float)lastOrientation * 1.5f; lastOrientAngle /= 12; lastOrientAngle *= 360; MWData gyroDataTemp = new MWData(); gyroDataTemp = GyroHistoricalData[GyroHistoricalData.Count - 1]; //Debug.Log("DATA COUNTER & GYRO DATA COUNTER 1: "+ accelDataCounter+ ", " + gyroDataCounter); double deltaGO = gyroDataTemp.GO_x; double a = currentOrientAngle - 20; double b = currentOrientAngle + 20; //GO Calculations- START********************************************* if (deltaGO > a && deltaGO < b) { hitTestGyroGO = true; } if (lastOrientation == Orientation.ORIENT_12 && currentOrientation == Orientation.ORIENT_12) // do check if there is orientation or not!! { hitTestGyroGO = ((deltaGO >= 0 && deltaGO < 25) || (deltaGO > 335 && deltaGO <= 360)); Debug.Log("Both orients are 12 " + deltaGO + "," + hitTestGyroGO); lastGO = 0; //gyro_x_offset = gyroDataTemp.GTotal_x / gyroDataCounter; } //GO Calculations-END********************************************* //GT Calculations-START ********************************************* MWData gyroData = new MWData(); gyroData = GyroHistoricalData [gyroDataCounter - 1]; //([waxDataManager.historicalGyroTRSData objectAtIndex: waxDataManager.gDataCounter-1]); //NSLog(@"NEW HIT SOT DATA: SOT %f,%f,%f",gyroData.GS_x, gyroData.GO_x,gyroData.GT_x); double gyroGTx = gyroData.GT_x; MWData gyroNewData = new MWData(); gyroNewData = GyroHistoricalData[GyroHistoricalData.Count - 41]; //([waxDataManager.historicalGyroTRSData objectAtIndex:([waxDataManager.historicalGyroTRSData count]-41)]); double deltaGT = gyroGTx - gyroGTxLast; string strGyroData = "" + "" + gx + "" + gy + "" + gz; float deltaAngle = currentOrientAngle - lastOrientAngle; //if( deltaGT < currentOrientAngle+15 && deltaGT > currentOrientAngle-15) if (deltaGT > deltaAngle - 20 && deltaGT < deltaAngle + 20) { hitTestGyroGT = true; Debug.Log("GT Test: " + hitTestGyroGT); } gyroGTxLast = gyroNewData.GT_x; //GT Calculations-END********************************************* //HIT CHECKS WITH ACCELERATION DATA. if (hitType == HipHit.CONT12 || hitType == HipHit.CONT3 || hitType == HipHit.CONT6 || hitType == HipHit.CONT9 || hitType == HipHit.CONTDOWN || hitType == HipHit.CONTUP) { back = (uint)accelDataCounter - start_i + 10; } else //Safe checking back to keep in some specific limit. { if (back > 120) { back = 120; } else if (back < 1) { back = 1; } } if (strength > 20) { strength = 20; } else if (strength < 0.1f) { strength = 0.1f; } switch (hitType) { case HipHit.CONT12: case HipHit.HIT12: { float Accel_z_Speed = 0; float Accel_z_speed8 = 0; for (int i = Mathf.FloorToInt(accelDataCounter - back); i < accelDataCounter; i++) { if (AccelHistoricalData[i - 101].accel_z_15 < Accel_z_Speed) { Accel_z_Speed = AccelHistoricalData[i - 101].accel_z_15; } } if (Accel_z_Speed < 0) { accTest = true; //strHitType = "HIT12 Delayed"; if (hitTestGyroGO || hitTestGyroGT) { //calculate_data_Log(gyroData, currentOrientation, lastOrientation, strGyroData, accTest, strHitType,hitTestGyroGO,gyroGTx,gyroGTxLast,deltaGT,hitTestGyroGT); return(Mathf.Round(-Accel_z_Speed * score * 0.2f)); } //calculate_data_Log(gyroData, currentOrientation, lastOrientation, strGyroData, accTest, strHitType,hitTestGyroGO,gyroGTx,gyroGTxLast,deltaGT,hitTestGyroGT); } break; } case HipHit.CONT3: case HipHit.HIT3: { float Accel_y_Speed = 0; //float Accel_y_speed8 = 0; //Accel_x_DelaySpeed = 0; for (int i = Mathf.FloorToInt(accelDataCounter - back); i < accelDataCounter; i++) { Accel_y_Speed += AccelHistoricalData[i - 101].accel_y; } if (Accel_y_Speed > 0.0f) { accTest = true; //strHitType = "HIT3 success!!"; if (hitTestGyroGO || hitTestGyroGT) { //calculate_data_Log(gyroData, currentOrientation, lastOrientation, strGyroData, accTest, strHitType,hitTestGyroGO,gyroGTx,gyroGTxLast,deltaGT,hitTestGyroGT); //return true; return(Mathf.Round(Accel_y_Speed * score * 6.666f)); } //calculate_data_Log(gyroData, currentOrientation, lastOrientation, strGyroData, accTest, strHitType,hitTestGyroGO,gyroGTx,gyroGTxLast,deltaGT,hitTestGyroGT); } break; } case HipHit.CONT6: case HipHit.HIT6: { float Accel_z_Speed = 0; //float Accel_z_speed8 = 0; //new code 28 Jan 18 for (int i = Mathf.FloorToInt(accelDataCounter - back); i < accelDataCounter; i++) { Accel_z_Speed += AccelHistoricalData[i - 101].accel_z; } if (Accel_z_Speed > 0.0f) { accTest = true; //strHitType = "HIT6 acc success!!!"; if (hitTestGyroGO || hitTestGyroGT) { //calculate_data_Log(gyroData, currentOrientation, lastOrientation, strGyroData, accTest, strHitType,hitTestGyroGO,gyroGTx,gyroGTxLast,deltaGT,hitTestGyroGT); //return true; return(Mathf.Round(Accel_z_Speed * score * 1.333f)); } //calculate_data_Log(gyroData, currentOrientation, lastOrientation, strGyroData, accTest, strHitType,hitTestGyroGO,gyroGTx,gyroGTxLast,deltaGT,hitTestGyroGT); } break; } case HipHit.CONT9: case HipHit.HIT9: { float Accel_y_Speed = 0; //float Accel_y_speed8 = 0; //Accel_x_DelaySpeed = 0; for (int i = Mathf.FloorToInt(accelDataCounter - back); i < accelDataCounter; i++) { // WAXData* data = [waxDataManager.historicalData objectAtIndex:i-101]; Accel_y_Speed += AccelHistoricalData[i - 101].accel_y; } //for(int i = Mathf.FloorToInt(accelDataCounter - 0.8f*back); i < accelDataCounter; i++) { // WAXData* data = [waxDataManager.historicalData objectAtIndex:i-101]; // Accel_y_speed8 += AccelHistoricalData[i-101].accel_y; // //} if (Accel_y_Speed < 0.0f) { accTest = true; //strHitType = "HIT9 Success!!!"; if (hitTestGyroGO || hitTestGyroGT) { //calculate_data_Log(gyroData, currentOrientation, lastOrientation, strGyroData, accTest, strHitType,hitTestGyroGO,gyroGTx,gyroGTxLast,deltaGT,hitTestGyroGT); //return true; return(Mathf.Round(-Accel_y_Speed * score * 6.666f)); } //calculate_data_Log(gyroData, currentOrientation, lastOrientation, strGyroData, accTest, strHitType,hitTestGyroGO,gyroGTx,gyroGTxLast,deltaGT,hitTestGyroGT); } break; } case HipHit.CONTDOWN: case HipHit.HITDOWN: { float Accel_x_Speed = 0; //float Accel_x_speed8 = 0; //Accel_x_DelaySpeed = 0; for (int i = Mathf.FloorToInt(accelDataCounter - back); i < accelDataCounter; i++) { // WAXData* data = [waxDataManager.historicalData objectAtIndex:i-101]; Accel_x_Speed += AccelHistoricalData[i - 101].accel_x; } //for(int i = Mathf.FloorToInt(accelDataCounter - 0.8f*back); i < accelDataCounter; i++) { // WAXData* data = [waxDataManager.historicalData objectAtIndex:i-101]; // Accel_x_speed8 += AccelHistoricalData[i-101].accel_x; //} if (Accel_x_Speed < 0) { accTest = true; //strHitType = "HITDOWN"; if (hitTestGyroGO || hitTestGyroGT) { //calculate_data_Log(gyroData, currentOrientation, lastOrientation, strGyroData, accTest, strHitType,hitTestGyroGO,gyroGTx,gyroGTxLast,deltaGT,hitTestGyroGT); //return true; return(Mathf.Round(-Accel_x_Speed * score * 6.666f)); } //calculate_data_Log(gyroData, currentOrientation, lastOrientation, strGyroData, accTest, strHitType,hitTestGyroGO,gyroGTx,gyroGTxLast,deltaGT,hitTestGyroGT); } break; } case HipHit.CONTUP: case HipHit.HITUP: { float Accel_x_Speed = 0; //float Accel_x_speed8 = 0; //Accel_x_DelaySpeed = 0; for (int i = Mathf.FloorToInt(accelDataCounter - back); i < accelDataCounter; i++) { // WAXData* data = [waxDataManager.historicalData objectAtIndex:i-101]; Accel_x_Speed += AccelHistoricalData[i - 101].accel_x; } //for(int i = Mathf.FloorToInt(accelDataCounter - 0.8f*back); i < accelDataCounter; i++) { // WAXData* data = [waxDataManager.historicalData objectAtIndex:i-101]; // Accel_x_speed8 += AccelHistoricalData[i-101].accel_x; // //} if (Accel_x_Speed > 0.0f) { accTest = true; //strHitType = "HITUP success!!!"; if (hitTestGyroGO || hitTestGyroGT) { //calculate_data_Log(gyroData, currentOrientation, lastOrientation, strGyroData, accTest, strHitType,hitTestGyroGO,gyroGTx,gyroGTxLast,deltaGT,hitTestGyroGT); //return true; return(Mathf.Round(Accel_x_Speed * score * 6.666f)); } //calculate_data_Log(gyroData, currentOrientation, lastOrientation, strGyroData, accTest, strHitType,hitTestGyroGO,gyroGTx,gyroGTxLast,deltaGT,hitTestGyroGT); } break; } case HipHit.STILL: { if (StillCalc < 0.01f) { accTest = true; //strHitType = "Still Correct"; if (hitTestGyroGO || hitTestGyroGT) { //calculate_data_Log(gyroData, currentOrientation, lastOrientation, strGyroData, accTest, strHitType,hitTestGyroGO,gyroGTx,gyroGTxLast,deltaGT,hitTestGyroGT); return(1.0f); } //calculate_data_Log(gyroData, currentOrientation, lastOrientation, strGyroData, accTest, strHitType,hitTestGyroGO,gyroGTx,gyroGTxLast,deltaGT,hitTestGyroGT); } break; } case HipHit.CIRCLE_3: { float Accel_y_Speed20 = 0; for (int i = Mathf.FloorToInt(accelDataCounter - 20); i < accelDataCounter; i++) { Accel_y_Speed20 += AccelHistoricalData[i - 101].accel_y; } if (Accel_y_Speed20 < 0 && StillCalc > 0.00001f) { accTest = true; //strHitType = "Circle_3 success"; if (hitTestGyroGO || hitTestGyroGT) { //calculate_data_Log(gyroData, currentOrientation, lastOrientation, strGyroData, accTest, strHitType,hitTestGyroGO,gyroGTx,gyroGTxLast,deltaGT,hitTestGyroGT); return(5.0f); } //calculate_data_Log(gyroData, currentOrientation, lastOrientation, strGyroData, accTest, strHitType,hitTestGyroGO,gyroGTx,gyroGTxLast,deltaGT,hitTestGyroGT); } break; } case HipHit.CIRCLE_4_5: { float Accel_y_Speed20 = 0; for (int i = Mathf.FloorToInt(accelDataCounter - 20); i < accelDataCounter; i++) { Accel_y_Speed20 += AccelHistoricalData[i - 101].accel_y; } float Accel_z_Speed20 = 0; for (int i = Mathf.FloorToInt(accelDataCounter - 20); i < accelDataCounter; i++) { Accel_z_Speed20 += AccelHistoricalData[i - 101].accel_z; } if (Accel_z_Speed20 > 0.0f && Accel_y_Speed20 < 0.0f && StillCalc > 0.00001f) { accTest = true; //strHitType = "Circle_4_5 success"; if (hitTestGyroGO || hitTestGyroGT) { //calculate_data_Log(gyroData, currentOrientation, lastOrientation, strGyroData, accTest, strHitType,hitTestGyroGO,gyroGTx,gyroGTxLast,deltaGT,hitTestGyroGT); return(5.0f); } //calculate_data_Log(gyroData, currentOrientation, lastOrientation, strGyroData, accTest, strHitType,hitTestGyroGO,gyroGTx,gyroGTxLast,deltaGT,hitTestGyroGT); } break; } case HipHit.CIRCLE_6: { float Accel_z_Speed20 = 0; for (int i = Mathf.FloorToInt(accelDataCounter - 20); i < accelDataCounter; i++) { Accel_z_Speed20 += AccelHistoricalData[i - 101].accel_z; } if (Accel_z_Speed20 > 0.0f && StillCalc > 0.00001f) { accTest = true; //strHitType = "Circle_6"; if (hitTestGyroGO || hitTestGyroGT) { //calculate_data_Log(gyroData, currentOrientation, lastOrientation, strGyroData, accTest, strHitType,hitTestGyroGO,gyroGTx,gyroGTxLast,deltaGT,hitTestGyroGT); return(5.0f); } //calculate_data_Log(gyroData, currentOrientation, lastOrientation, strGyroData, accTest, strHitType,hitTestGyroGO,gyroGTx,gyroGTxLast,deltaGT,hitTestGyroGT); } break; } case HipHit.CIRCLE_7_5: { float Accel_y_Speed20 = 0; for (int i = Mathf.FloorToInt(accelDataCounter - 20); i < accelDataCounter; i++) { Accel_y_Speed20 += AccelHistoricalData[i - 101].accel_y; } float Accel_z_Speed20 = 0; for (int i = Mathf.FloorToInt(accelDataCounter - 20); i < accelDataCounter; i++) { Accel_z_Speed20 += AccelHistoricalData[i - 101].accel_z; } if (Accel_z_Speed20 > 0.0f && Accel_y_Speed20 > 0.0f && StillCalc > 0.00001f) { accTest = true; //strHitType = "Circle_4_5 success"; if (hitTestGyroGO || hitTestGyroGT) { //calculate_data_Log(gyroData, currentOrientation, lastOrientation, strGyroData, accTest, strHitType,hitTestGyroGO,gyroGTx,gyroGTxLast,deltaGT,hitTestGyroGT); return(5.0f); } //calculate_data_Log(gyroData, currentOrientation, lastOrientation, strGyroData, accTest, strHitType,hitTestGyroGO,gyroGTx,gyroGTxLast,deltaGT,hitTestGyroGT); } break; } case HipHit.CIRCLE_9: { float Accel_y_Speed20 = 0; for (int i = Mathf.FloorToInt(accelDataCounter - 20); i < accelDataCounter; i++) { Accel_y_Speed20 += AccelHistoricalData[i - 101].accel_y; } if (Accel_y_Speed20 > 0.0f && StillCalc > 0.00001f) { accTest = true; //strHitType = "Circle_9 success"; if (hitTestGyroGO || hitTestGyroGT) { //calculate_data_Log(gyroData, currentOrientation, lastOrientation, strGyroData, accTest, strHitType,hitTestGyroGO,gyroGTx,gyroGTxLast,deltaGT,hitTestGyroGT); return(5.0f); } //calculate_data_Log(gyroData, currentOrientation, lastOrientation, strGyroData, accTest, strHitType,hitTestGyroGO,gyroGTx,gyroGTxLast,deltaGT,hitTestGyroGT); } break; } case HipHit.CIRCLE_10_5: { float Accel_y_Speed20 = 0; for (int i = Mathf.FloorToInt(accelDataCounter - 20); i < accelDataCounter; i++) { Accel_y_Speed20 += AccelHistoricalData[i - 101].accel_y; } float Accel_z_Speed20 = 0; for (int i = Mathf.FloorToInt(accelDataCounter - 20); i < accelDataCounter; i++) { Accel_z_Speed20 += AccelHistoricalData[i - 101].accel_z; } if (Accel_z_Speed20 < 0.0f && Accel_y_Speed20 > 0.0f && StillCalc > 0.00001f) { accTest = true; //strHitType = "Circle_10_5 success"; if (hitTestGyroGO || hitTestGyroGT) { //calculate_data_Log(gyroData, currentOrientation, lastOrientation, strGyroData, accTest, strHitType,hitTestGyroGO,gyroGTx,gyroGTxLast,deltaGT,hitTestGyroGT); return(5.0f); } //calculate_data_Log(gyroData, currentOrientation, lastOrientation, strGyroData, accTest, strHitType,hitTestGyroGO,gyroGTx,gyroGTxLast,deltaGT,hitTestGyroGT); } break; } case HipHit.CIRCLE_12: { float Accel_z_Speed20 = 0; for (int i = Mathf.FloorToInt(accelDataCounter - 20); i < accelDataCounter; i++) { Accel_z_Speed20 += AccelHistoricalData[i - 101].accel_z; } if (Accel_z_Speed20 < 0.0f && StillCalc > 0.00001f) { accTest = true; //strHitType = "Circle_12 success"; if (hitTestGyroGO || hitTestGyroGT) { //calculate_data_Log(gyroData, currentOrientation, lastOrientation, strGyroData, accTest, strHitType,hitTestGyroGO,gyroGTx,gyroGTxLast,deltaGT,hitTestGyroGT); return(5.0f); } //calculate_data_Log(gyroData, currentOrientation, lastOrientation, strGyroData, accTest, strHitType,hitTestGyroGO,gyroGTx,gyroGTxLast,deltaGT,hitTestGyroGT); } break; } case HipHit.CIRCLE_1_5: { float Accel_y_Speed20 = 0; for (int i = Mathf.FloorToInt(accelDataCounter - 20); i < accelDataCounter; i++) { Accel_y_Speed20 += AccelHistoricalData[i - 101].accel_y; } float Accel_z_Speed20 = 0; for (int i = Mathf.FloorToInt(accelDataCounter - 20); i < accelDataCounter; i++) { Accel_z_Speed20 += AccelHistoricalData[i - 101].accel_z; } if (Accel_z_Speed20 < 0.0f && Accel_y_Speed20 < 0.0f && StillCalc > 0.00001f) { accTest = true; //strHitType = "Circle_4_5 success"; if (hitTestGyroGO || hitTestGyroGT) { //calculate_data_Log(gyroData, currentOrientation, lastOrientation, strGyroData, accTest, strHitType,hitTestGyroGO,gyroGTx,gyroGTxLast,deltaGT,hitTestGyroGT); return(5.0f); } //calculate_data_Log(gyroData, currentOrientation, lastOrientation, strGyroData, accTest, strHitType,hitTestGyroGO,gyroGTx,gyroGTxLast,deltaGT,hitTestGyroGT); } break; } default: { accTest = false; //strHitType = null; //calculate_data_Log(gyroData, currentOrientation, lastOrientation, strGyroData, accTest, strHitType,hitTestGyroGO,gyroGTx,gyroGTxLast,deltaGT,hitTestGyroGT); return(0.0f); } } accTest = false; //strHitType = null; //calculate_data_Log(gyroData, currentOrientation, lastOrientation, strGyroData, accTest, strHitType,hitTestGyroGO,gyroGTx,gyroGTxLast,deltaGT,hitTestGyroGT); return(0.0f); }
void CalculateTouchAndSave(Vector2 end, TouchData touchData) { HipHit type = CalculateHitType(end, touchData); if (type == HipHit.INVALID) { return; } Debug.Log("Detected Type: " + type.ToString()); float strength = 0; ushort back = 20; if (type.ToString().StartsWith("CONT")) { back = 100; } float distance = 0.0f; // Calculate Strength based on Distance. if (type.ToString().StartsWith("CIRC")) // Average for Circle { distance = ((touchData.startPos.magnitude + end.magnitude) / 2); } else { distance = end.magnitude; } strength = 5 * (distance / central.y); Debug.Log("Strength Calculated as: " + strength); RhythmLine newLine = new RhythmLine(); newLine.hitType = type; newLine.back = back; newLine.strength = strength; newLine.timeImpact = touchData.startTime; newLine.timeEndImpact = musicSource.time; newLine.score = 20; newLine.timeTillImpact = 1.5f; //newLine.orientation = Orientation.ORIENT_12; newLine.orientation = (Orientation)tempOrient; //looping orientations for testing. tempOrient++; if (tempOrient > (int)Orientation.ORIENT_10_5) { tempOrient = 0; } //-TESTING -End newLine.players = new Players(); newLine.players.Init(); newLine.players.p1 = true; lines.Add(newLine); }
public override float isHitting() { float result; if (player == 0 || player == 1) { result = orbManager.linkManager.IsHit(player, hitType, back, strength, this.orientation, last_orient, score); } else if (player == 12) { float resultZero = orbManager.linkManager.IsHit(0, hitType, back, strength, this.orientation, last_orient, score); float resultOne = orbManager.linkManager.IsHit(1, hitType, back, strength, this.orientation, last_orient, score); if ((resultOne > 0.0f) && (resultZero > 0.0f)) { result = resultZero + resultOne; } else { result = 0.0f; } } else if (player == 21) { if (this.orientation == Orientation.ORIENT_12) { mirrorOrientation = Orientation.ORIENT_6; } else if (this.orientation == Orientation.ORIENT_1_5) { mirrorOrientation = Orientation.ORIENT_7_5; } else if (this.orientation == Orientation.ORIENT_3) { mirrorOrientation = Orientation.ORIENT_9; } else if (this.orientation == Orientation.ORIENT_4_5) { mirrorOrientation = Orientation.ORIENT_10_5; } else if (this.orientation == Orientation.ORIENT_6) { mirrorOrientation = Orientation.ORIENT_12; } else if (this.orientation == Orientation.ORIENT_7_5) { mirrorOrientation = Orientation.ORIENT_1_5; } else if (this.orientation == Orientation.ORIENT_9) { mirrorOrientation = Orientation.ORIENT_3; } else { mirrorOrientation = Orientation.ORIENT_4_5; } if (hitType == HipHit.CIRCLE_10_5) { mirrorHitTypeCircle = HipHit.CIRCLE_4_5; } else if (hitType == HipHit.CIRCLE_12) { mirrorHitTypeCircle = HipHit.CIRCLE_6; } else if (hitType == HipHit.CIRCLE_1_5) { mirrorHitTypeCircle = HipHit.CIRCLE_7_5; } else if (hitType == HipHit.CIRCLE_3) { mirrorHitTypeCircle = HipHit.CIRCLE_9; } else if (hitType == HipHit.CIRCLE_4_5) { mirrorHitTypeCircle = HipHit.CIRCLE_10_5; } else if (hitType == HipHit.CIRCLE_6) { mirrorHitTypeCircle = HipHit.CIRCLE_12; } else if (hitType == HipHit.CIRCLE_7_5) { mirrorHitTypeCircle = HipHit.CIRCLE_1_5; } else { mirrorHitTypeCircle = HipHit.CIRCLE_3; } //Debug.Log ("mirror orientation = " + mirrorOrientation); float resultZero = orbManager.linkManager.IsHit(0, hitType, back, strength, this.orientation, last_orient, score); float resultOne = orbManager.linkManager.IsHit(1, mirrorHitTypeCircle, back, strength, mirrorOrientation, last_orient, score); if ((resultOne > 0.0f) && (resultZero > 0.0f)) { result = resultZero + resultOne; } else { result = 0.0f; } } else { result = 0.0f; } Debug.Log("printing result " + result); return(result); //Debug.Log("CIRCLE isHitting"); //orbManager.linkManager.UpdateHitLogNotification("UNITY TRIGGERED HIT"+this.hitType); //result = orbManager.linkManager.IsHit (player,hitType, back, strength, this.orientation, last_orient); //Debug.Log("CIRCLE Result: "+result, this); //return result; //return false; }
public virtual float isHitting() { float result; if (player == 0 || player == 1) { result = orbManager.linkManager.IsHit(player, hitType, back, strength, this.orientation, last_orient, score); } else if (player == 12) { float resultZero = orbManager.linkManager.IsHit(0, hitType, back, strength, this.orientation, last_orient, score); float resultOne = orbManager.linkManager.IsHit(1, hitType, back, strength, this.orientation, last_orient, score); if ((resultOne > 0.0f) && (resultZero > 0.0f)) { result = resultZero + resultOne; } else { result = 0.0f; } } else if (player == 21) { if (this.orientation == Orientation.ORIENT_12) { mirrorOrientation = Orientation.ORIENT_6; } else if (this.orientation == Orientation.ORIENT_1_5) { mirrorOrientation = Orientation.ORIENT_7_5; } else if (this.orientation == Orientation.ORIENT_3) { mirrorOrientation = Orientation.ORIENT_9; } else if (this.orientation == Orientation.ORIENT_4_5) { mirrorOrientation = Orientation.ORIENT_10_5; } else if (this.orientation == Orientation.ORIENT_6) { mirrorOrientation = Orientation.ORIENT_12; } else if (this.orientation == Orientation.ORIENT_7_5) { mirrorOrientation = Orientation.ORIENT_1_5; } else if (this.orientation == Orientation.ORIENT_9) { mirrorOrientation = Orientation.ORIENT_3; } else { mirrorOrientation = Orientation.ORIENT_4_5; } if (hitType == HipHit.HIT12) { mirrorHitType = HipHit.HIT6; } else if (hitType == HipHit.HIT6) { mirrorHitType = HipHit.HIT12; } else if (hitType == HipHit.HIT3) { mirrorHitType = HipHit.HIT9; } else if (hitType == HipHit.HIT9) { mirrorHitType = HipHit.HIT3; } else if (hitType == HipHit.HITUP) { mirrorHitType = HipHit.HITUP; } else { mirrorHitType = HipHit.HITDOWN; } float resultZero = orbManager.linkManager.IsHit(0, hitType, back, strength, this.orientation, last_orient, score); float resultOne = orbManager.linkManager.IsHit(1, mirrorHitType, back, strength, mirrorOrientation, last_orient, score); if ((resultOne > 0.0f) && (resultZero > 0.0f)) { result = resultZero + resultOne; } else { result = 0.0f; } } else { result = 0.0f; } Debug.Log("printing result " + result); return(result); }