public SpCameraFollow(Transform targetTransform, Transform cameraRoot, LayerMask collideWith, ref ISpStateView meleeView, ref ISpStateView rangedView, ref IRotateObject objectRotator) { this.cameraRoot = cameraRoot; this.pivotTransform = cameraRoot.GetChild(0); //cameras transform placed as the child of the pivot's position this.cameraTransform = pivotTransform.GetChild(0); this.targetToFollow = targetTransform; this.meleeView = meleeView; this.rangedView = rangedView; this.cameraSettings = rangedView.BasicView.CameraOption; this.cameraSensitivity = new SensitivityCamera(5f, 5f); this.cameraFollow = new CameraFollowObject(150f, targetTransform, cameraRoot); this.localStartPos = this.cameraTransform.localPosition; this.currentLocalPos = rangedView.BasicView.OnePosition.localPosition; this.toCollideWith = collideWith; this.objectRotator = objectRotator; }
// Use this for initialization void Awake() { meleeCamplaces = new SpCamPositions(meleedIdle.localPosition, meleeAim.localPosition, meleeRun.localPosition); rangedCamplaces = new SpCamPositions(rangedIdle.localPosition, rangedAim.localPosition, rangedRun.localPosition); ISpView meleeBasicView = new SpOneView(meleedIdle, transform, 5.0f, -40.0f, 30.0f, 0.1f, 5f); ISpView meleeRunView = new SpOneView(meleeRun, transform, 5.0f, -40.0f, 30.0f, 0.1f, 5f); ISpView meleeAimView = new SpOneView(meleeAim, transform, 5.0f, -40.0f, 30.0f, 0.1f, 5f); ISpView rangedBasicView = new SpOneView(rangedIdle, transform, 5.0f, -40.0f, 30.0f, 0.1f, 5f); ISpView rangedRunView = new SpOneView(rangedRun, transform, 5.0f, -40.0f, 30.0f, 0.1f, 5f); ISpView rangedAimView = new SpOneView(rangedAim, transform, 5.0f, -40.0f, 30.0f, 0.1f, 5f); meleeView = new SpStateView(meleeBasicView, meleeAimView, meleeRunView); rangedView = new SpStateView(rangedBasicView, rangedAimView, rangedRunView); objectRotator = new SpacemarineRotator(objectToRotateTransform, 5f); cameraFollow = new SpCameraFollow(target, transform, collidewith, ref meleeView, ref rangedView, ref objectRotator); }