virtual protected void FindBug()
    {
        bool hasFoundBug = false;

        foreach (BugableObjectFunctionInfo notEnabledFunctionInfo in info.NotEnabledBugableFunctions)
        {
            System.Type T           = GetType();
            string      checkMethod = "Check_" + notEnabledFunctionInfo.identifier + "_BugTriggered";
            System.Reflection.MethodInfo methodInfo = T.GetMethod(checkMethod);
            if (methodInfo != null)
            {
                bool ret = bool.Parse(methodInfo.Invoke(this, null).ToString());
                if (ret)
                {
                    Debug.Log("check passed " + checkMethod + " " + methodInfo.Invoke(this, null).ToString());
                    hasFoundBug = true;
                    AchievementManager.Instance.FinishAchievement(notEnabledFunctionInfo.achievementToFinish);
                    //put these three line in manager
                    //todo: change to based on observer
                    BugableObjectFunctionManager.Instance.ReadCSV();
                    BugableObjectFunctionManager.Instance.ReadDatabase();
                    //BugableObjectFunctionManager.Instance.enabledBugableObjectFunctionInfoDict[info.identifier].Add(notEnabledFunctionInfo);
                    // BugableObjectFunctionManager.Instance.notEnabledBugableObjectFunctionInfoDict[info.identifier].Remove(notEnabledFunctionInfo);
                    BugableObjectFunctionManager.Instance.UpdateFunctionDelegate();

                    GameModeManager.Instance.GetIntoPlayMode();
                    SFXManager.Instance.PlaySFX(SFXEnum.findBug);
                    PopupViewController.CreateFoundItExplosionViewController();



                    break;
                }
                else
                {
                    Debug.Log("check failed " + checkMethod + " " + methodInfo.Invoke(this, null).ToString());
                }
            }
            else
            {
                Debug.LogError("function not implemented " + checkMethod);
            }
        }
        if (!hasFoundBug)
        {
            NarrationManager.Instance.ShowNarrationWithIdentifier("nothingSpecial");
            SFXManager.Instance.PlaySFX(SFXEnum.failFindBug);
        }
    }
Beispiel #2
0
 public override void OnClick()
 {
     PopupViewController.Open <GameSettingsPopup>();
 }
Beispiel #3
0
 public void OnClick_DebugMenu()
 {
     PopupViewController.Open <LevelDebugPopup>();
 }