public CameraEffects(CameraEffects cloneTarget) { orthographicSize = cloneTarget._orthographicSize; shakeFrequency = cloneTarget._shakeFrequency; BackgroundColor = cloneTarget.backgroundColor; Position = cloneTarget.position; }
// clone effect based on other instance public Effects(Effects cloneTarget) { page = cloneTarget.page; duration = cloneTarget.duration; fadeMode = cloneTarget.fadeMode; cameraEffects = new CameraEffects(cloneTarget.cameraEffects); }
// create new effect woth default value public Effects() { page = 0; duration = 1; fadeMode = fadeMode.none; cameraEffects = new CameraEffects(); }
// parse json using v1 method with specified version jsonkey public static CameraEffects parseJson_1_0(JsonData camFxJsonData, int lineIndex, JsonKey camFxKey) { CameraEffects camFx = new CameraEffects(); Debug.Log(camFxKey.elementsKeys[0]); camFx.position = new Vector3( float.Parse(camFxJsonData[camFxKey.elementsKeys[0]][lineIndex].ToString()), float.Parse(camFxJsonData[camFxKey.elementsKeys[1]][lineIndex].ToString()), -10f ); camFx._orthographicSize = float.Parse(camFxJsonData[camFxKey.elementsKeys[2]][lineIndex].ToString()); camFx._shakeFrequency = float.Parse(camFxJsonData[camFxKey.elementsKeys[3]][lineIndex].ToString()); camFx.backgroundColor = Effects.rgbColorParse(camFxJsonData[camFxKey.elementsKeys[4]][lineIndex].ToString()); return(camFx); }
// set value public bool setValue(int newPage, float newDuration, fadeMode newFadeMode, CameraEffects newCameraEffects) { try { this.page = newPage; this.duration = newDuration; this.fadeMode = newFadeMode; this.cameraEffects = newCameraEffects; return(true); } catch (System.Exception) { return(false); } }