protected float SwitchCamera(string text) { string cameraName = text.ToLower().Trim(); SwitchCameraOptions options = defaultCameraOptions; string[] components = text.Split(','); if (components.Length > 1) { options = GetSwitchCameraOptions(components); } foreach (_Camera camera in cameras) { if (camera.name.ToLower().Trim() == cameraName) { KickStarter.mainCamera.SetGameCamera(camera, options.time, options.method, null, options.smooth); } } if (options.waitFinish && options.time > 0.0f) { return(options.time); } return(actionComplete); }
protected SwitchCameraOptions GetSwitchCameraOptions(string[] components) { SwitchCameraOptions options = defaultCameraOptions; for (int i = 1; i < components.Length; i++) { string option = components[i].ToLower().Trim(); if (option.StartsWith("time")) { string[] t = option.Split('='); if (t.Length == 2) { options.time = (float)Convert.ToDouble(t[1].Trim()); } continue; } if (option.Equals("linear")) { options.method = MoveMethod.Linear; } if (option.Equals("smooth")) { options.method = MoveMethod.Smooth; } if (option.Equals("curved")) { options.method = MoveMethod.Curved; } if (option.Equals("easein")) { options.method = MoveMethod.EaseIn; } if (option.Equals("easeout")) { options.method = MoveMethod.EaseOut; } if (option.EndsWith("retainSpeed")) { options.smooth = TagState(option); } if (option.EndsWith("waitfinish")) { options.waitFinish = TagState(option); } } return(options); }