这应该是直截了当的,但我没有得到它,很可能我一直在看东西太长时间没有休息,但我可以用另一套眼睛。我尝试创建一个计数器,用于跟踪拍摄的照片数量GameManager.CurrentStep
,然后在达到所需照片总数GameManager.instance.driftNumSteps
后禁用照片按钮。出于某种原因,最后还有一个例如。如果总步数为6,则相机不会禁用并显示GameManager.instance.driftInstructionText.text = "Drift Completed!!";
直到第七步。
public void CapturePhoto(float latitude, float longitude)
{
// If all photos have been taken
if (GameManager.CurrentStep <= GameManager.instance.driftNumSteps - 1)
{
// When a photo gets taken increment by 1
GameManager.CurrentStep++;
// Get the next drift step
EventManager.GetDriftStep(GameManager.CurrentStep);
// Insert photo data into SQL record
GetComponent<SQLiteActions>().InsertPhotoData(GameManager.CurrentDriftID, "texture path", 78.33f, 87.1765f);
/*if (PhoneCamera.backCam != null)
{
Texture2D photo = new Texture2D(PhoneCamera.backCam.width, PhoneCamera.backCam.height);
photo.SetPixels(PhoneCamera.backCam.GetPixels());
photo.Apply();
SavePhotoToCameraRoll(photo); // Save photo to camera roll gallery
//SavePhotoToLocalStorage(photo); // Save photo to local app storage
Debug.Log("Photo Captured!");
}
else
{
Debug.Log("Phone Camera Not Found!");
}*/
}
else
{
// Tell user their drift is done!
GameManager.instance.driftInstructionText.text = "Drift Completed!!";
// Fade camera button maybe?
Debug.Log("Drift is complete!!");
UIActions.EnableButton(GameManager.instance.newDriftBtn); // Enable create new drift button
UIActions.DisableButton(GameManager.instance.takePhotoBtn); // Disable photo button button
}
Debug.Log(GameManager.CurrentStep + " out of " + GameManager.instance.driftNumSteps + " steps.");
}
答案 0 :(得分:0)
感谢您的反馈!我解决了这个问题。我从列表中检索1而不是零。一旦我调整了我的返回以返回GameManager.Drift [currentStep - 1] .DriftStep;一切正常。