public override void OnEnter() { base.OnEnter(); CCSize windowSize = Layer.VisibleBoundsWorldspace.Size; CCRect visibleBounds = Layer.VisibleBoundsWorldspace; CCCamera contentCamera = contentLayer.Camera; contentCamera.Projection = CCCameraProjection.Projection3D; contentCamera.PerspectiveAspectRatio = 3.0f; CCPoint3 cameraCenter = contentCamera.CenterInWorldspace; CCPoint3 cameraTarget = contentCamera.TargetInWorldspace; float targeCenterLength = (cameraTarget - cameraCenter).Length; contentCamera.NearAndFarPerspectiveClipping = new CCPoint(0.15f, 100.0f); contentCamera.PerspectiveFieldOfView = (float)Math.Atan(visibleBounds.Size.Height / (2.0f * targeCenterLength)); Schedule(checkAnim); BaseNode.Position = windowSize.Center; var size = BaseNode.ContentSize; BaseNode[EffectTestScene.kTagKathia].Position = new CCPoint(size.Width / 3, size.Center.Y); BaseNode[EffectTestScene.kTagTamara].Position = new CCPoint(2 * size.Width / 3, size.Center.Y); BaseNode.RunAction(CurrentAction); }
public TextLayer() : base() { contentLayer = new CCLayer(); CCCamera contentCamera = new CCCamera(Camera.OrthographicViewSizeWorldspace, Camera.CenterInWorldspace, Camera.TargetInWorldspace); contentLayer.Camera = contentCamera; var bg = new CCSprite(TestResource.s_back3); BaseNode = bg; contentLayer.AddChild(bg, 0, EffectTestScene.kTagBackground); var Kathia = new CCSprite(TestResource.s_pPathSister2); BaseNode.AddChild(Kathia, 1, EffectTestScene.kTagKathia); var sc = new CCScaleBy(2, 5); var sc_back = sc.Reverse(); Kathia.RunAction(new CCRepeatForever(sc, sc_back)); var Tamara = new CCSprite(TestResource.s_pPathSister1); BaseNode.AddChild(Tamara, 1, EffectTestScene.kTagTamara); var sc2 = new CCScaleBy(2, 5); var sc2_back = sc2.Reverse(); Tamara.RunAction(new CCRepeatForever(sc2, sc2_back)); var colorBackground = new CCLayerColor(new CCColor4B(32, 128, 32, 255)); contentLayer.AddChild(colorBackground, -1); }
public override void OnEnter() { base.OnEnter(); CCRect visibleBounds = VisibleBoundsWorldspace; CCCamera contentCamera = contentLayer.Camera; contentCamera.Projection = CCCameraProjection.Projection3D; contentCamera.PerspectiveAspectRatio = 1.0f; CCPoint3 cameraCenter = contentCamera.CenterInWorldspace; CCPoint3 cameraTarget = contentCamera.TargetInWorldspace; float targeCenterLength = (cameraTarget - cameraCenter).Length; contentCamera.NearAndFarPerspectiveClipping = new CCPoint(0.15f, 100.0f); contentCamera.PerspectiveFieldOfView = (float)Math.Atan(visibleBounds.Size.Height / (2.0f * targeCenterLength)); var lens = new CCLens3D(10, new CCGridSize(64, 48), new CCPoint(100, 180), 80); var move = new CCJumpBy(5, new CCPoint(600, 0), 100, 5); var move_back = move.Reverse(); CCLens3DState lensState = bgNode.RunAction(lens) as CCLens3DState; var target = new Lens3DTarget(lensState); // Please make sure the target has been added to its parent. AddChild(target); target.AddActions(false, move, move_back); }
public override void StartWithTarget(Node target) { base.StartWithTarget(target); CCCamera camera = target.Camera; camera.getCenterXYZ(out this._centerXOrig, out this._centerYOrig, out this._centerZOrig); camera.getEyeXYZ(out this._eyeXOrig, out this._eyeYOrig, out this._eyeZOrig); camera.getUpXYZ(out this._upXOrig, out this._upYOrig, out this._upZOrig); }
protected internal override void StartWithTarget(CCNode target) { base.StartWithTarget(target); CCCamera camera = target.Camera; camera.GetCenterXyz(out m_fCenterXOrig, out m_fCenterYOrig, out m_fCenterZOrig); camera.GetEyeXyz(out m_fEyeXOrig, out m_fEyeYOrig, out m_fEyeZOrig); camera.GetUpXyz(out m_fUpXOrig, out m_fUpYOrig, out m_fUpZOrig); }
public override void OnEnter() { base.OnEnter(); CCRect visibleBounds = VisibleBoundsWorldspace; // To reuse a grid the grid size and the grid type must be the same. // in this case: // Lens3D is Grid3D and it's size is (15,10) // Waves3D is Grid3D and it's size is (15,10) CCCamera contentCamera = contentLayer.Camera; contentCamera.Projection = CCCameraProjection.Projection3D; contentCamera.PerspectiveAspectRatio = 1.0f; CCPoint3 cameraCenter = contentCamera.CenterInWorldspace; CCPoint3 cameraTarget = contentCamera.TargetInWorldspace; float targeCenterLength = (cameraTarget - cameraCenter).Length; contentCamera.NearAndFarPerspectiveClipping = new CCPoint(0.1f, 100.0f); contentCamera.PerspectiveFieldOfView = (float)Math.PI / 3.0f; //(float)Math.Atan(visibleBounds.Size.Height / (2.0f * targeCenterLength)); var lens = new CCLens3D(0.0f, new CCGridSize(15, 10), bgNode.ContentSize.Center, 90); var waves = new CCWaves3D(10, new CCGridSize(15, 10), 18, 15); var reuse = new CCReuseGrid(1); var delay = new CCDelayTime(8); bgNode.AnchorPoint = CCPoint.AnchorMiddle; var orbit = new CCOrbitCamera(5, 30.0f, 2, 20, 180, 0, -90); var orbit_back = orbit.Reverse(); bgNode.RepeatForever(orbit, orbit_back); bgNode.RunActions(lens, delay, reuse, waves); }
internal virtual void UpdateCamera() { Camera = new CCCamera(new CCRect(cameraPosition.X + ScreenShakeVec.X, cameraPosition.Y + ScreenShakeVec.Y, CameraSize.Width, CameraSize.Height)); Camera.NearAndFarPerspectiveClipping = new CCNearAndFarClipping(1f, 1000000f); }