当前位置: 首页>>代码示例>>C#>>正文


C# Camera类代码示例

本文整理汇总了C#中Camera的典型用法代码示例。如果您正苦于以下问题:C# Camera类的具体用法?C# Camera怎么用?C# Camera使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


Camera类属于命名空间,在下文中一共展示了Camera类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Start

    // Use this for initialization
    void Start()
    {
        // Script References
        shipGraphics = GetComponent<ShipGraphics>();
        shipPhysicsScript = GetComponent<ShipPhysicsScript>();

        // Component Variables
        cam = GetComponentInChildren<Camera>();
        body = GetComponent<Rigidbody>();
        model = transform.Find("Model").gameObject;
        capsuleCollider = GetComponentInChildren<CapsuleCollider>();
        boxCollider = GetComponentInChildren<BoxCollider>();
        lockSound = GetComponent<AudioSource>();

        // Control Variables
        mouseSensitivity = 8.0f;
        //mouseThreshold = 8.0f;
        //buttonSensitivity = 0.05f;
        //buttonThreshold = 0.05f;

        horTranslation = 0.0f;
        verTranslation = 0.0f;

        enemyNoLock = (Material)Resources.Load("Crosshair");
        enemyLock = (Material)Resources.Load("Crosshair_Enemy");

        trackedObject = null;
        trackingResults = null;
        shootWaitTime = 0.0f;
        targetTime = 0.0f;
        hits = 0;
    }
开发者ID:henryj41043,项目名称:Project_GRAVITY,代码行数:33,代码来源:ShipDataScript.cs

示例2: InternalDraw

 protected override void InternalDraw(GameTime time, Matrix absoluteTransform, PrimitiveBatch primitiveBatch, Camera camera)
 {
     if (_mesh != null)
     {
         primitiveBatch.DrawMesh(_mesh, absoluteTransform, camera);
     }
 }
开发者ID:kekraft,项目名称:XNAProject,代码行数:7,代码来源:MeshNode.cs

示例3: Awake

 void Awake()
 {
     mainCamera = Camera.main;
     if (s_Instance == null)
         s_Instance = this;
     //DontDestroyOnLoad(this);
 }
开发者ID:BaptisteBillet,项目名称:Barababor,代码行数:7,代码来源:ShakeManager.cs

示例4: Start

 protected override void Start()
 {
     base.Start ();
     controller = GetComponent<PlayerController> ();
     gunController = GetComponent<GunController> ();
     viewCamera = Camera.main;
 }
开发者ID:bfata,项目名称:TwinStick,代码行数:7,代码来源:Player.cs

示例5: TileMap3D

            public TileMap3D(GraphicsDevice graphicsDevice, ContentManager contentManager, int width, int height)
            {
                this.GraphicsDevice = graphicsDevice;
                Wall = contentManager.Load<Model>("Models/TileMap3D/Wall");
                FloorTile = contentManager.Load<Model>("Models/TileMap3D/FloorTile");
                Dirt = contentManager.Load<Model>("Models/TileMap3D/Dirt");
                Cleaner = contentManager.Load<Model>("Models/TileMap3D/Cleaner");

                ((BasicEffect)Wall.Meshes[0].Effects[0]).EnableDefaultLighting();
                ((BasicEffect)FloorTile.Meshes[0].Effects[0]).EnableDefaultLighting();
                ((BasicEffect)Dirt.Meshes[0].Effects[0]).EnableDefaultLighting();
                ((BasicEffect)Cleaner.Meshes[0].Effects[0]).EnableDefaultLighting();
                foreach (BasicEffect effect in Cleaner.Meshes[0].Effects)
                    effect.Tag = effect.DiffuseColor;
                foreach (BasicEffect effect in FloorTile.Meshes[0].Effects)
                    effect.Tag = effect.DiffuseColor;

                dss.DepthBufferEnable = true;
                dss.DepthBufferFunction = CompareFunction.LessEqual;
                dss.DepthBufferWriteEnable = true;
                rs.CullMode = CullMode.CullCounterClockwiseFace;
                ss.AddressU = TextureAddressMode.Wrap;
                ss.AddressV = TextureAddressMode.Wrap;
                ss.Filter = TextureFilter.Anisotropic;

                Camera = new Camera(graphicsDevice.Viewport.AspectRatio, graphicsDevice);
            }
开发者ID:Troilk,项目名称:VacuumCleaner,代码行数:27,代码来源:TileMap3D.cs

示例6: FormLoadTexture

        public FormLoadTexture()
        {
            InitializeComponent();

            //if (CameraDictionary.Instance.ContainsKey(this.GetType().Name))
            //{
            //    this.camera = CameraDictionary.Instance[this.GetType().Name];
            //}
            //else
            {
                this.camera = new Camera(CameraType.Ortho, this.glCanvas1.Width, this.glCanvas1.Height);
                //CameraDictionary.Instance.Add(this.GetType().Name, this.camera);
            }

            rotator = new SatelliteRotator(this.camera);
            this.glCanvas1.MouseWheel += glCanvas1_MouseWheel;

            element = new LoadTextureExample();
            element.Initialize();

            IUILayoutParam param = new IUILayoutParam(
                AnchorStyles.Left | AnchorStyles.Bottom,
                new Padding(10, 10, 10, 10), new Size(50, 50));
            uiAxis = new SimpleUIAxis(param);
            uiAxis.Initialize();

            this.glCanvas1.MouseWheel += glCanvas1_MouseWheel;
            this.glCanvas1.KeyPress += glCanvas1_KeyPress;
            this.glCanvas1.MouseDown += glCanvas1_MouseDown;
            this.glCanvas1.MouseMove += glCanvas1_MouseMove;
            this.glCanvas1.MouseUp += glCanvas1_MouseUp;
            this.glCanvas1.OpenGLDraw += glCanvas1_OpenGLDraw;
            this.glCanvas1.Resize += glCanvas1_Resize;
            this.Load += Form_Load;
        }
开发者ID:xinfushe,项目名称:CSharpGL,代码行数:35,代码来源:FormLoadTexture.cs

示例7: renderTargetUserControl1_Render

        void renderTargetUserControl1_Render( RenderTargetUserControl sender, Camera camera )
        {
            //update camera
            if( Map.Instance != null )
            {
                Vec3 position;
                Vec3 forward;
                Degree fov;

                MapCamera mapCamera = Entities.Instance.GetByName( "MapCamera_1" ) as MapCamera;
                if( mapCamera != null )
                {
                    position = mapCamera.Position;
                    forward = mapCamera.Rotation * new Vec3( 1, 0, 0 );
                    fov = mapCamera.Fov;
                }
                else
                {
                    position = Map.Instance.EditorCameraPosition;
                    forward = Map.Instance.EditorCameraDirection.GetVector();
                    fov = Map.Instance.Fov;
                }

                if( fov == 0 )
                    fov = Map.Instance.Fov;

                renderTargetUserControl1.CameraNearFarClipDistance = Map.Instance.NearFarClipDistance;
                renderTargetUserControl1.CameraFixedUp = Vec3.ZAxis;
                renderTargetUserControl1.CameraFov = fov;
                renderTargetUserControl1.CameraPosition = position;
                renderTargetUserControl1.CameraDirection = forward;
            }
        }
开发者ID:whztt07,项目名称:SDK,代码行数:33,代码来源:AdditionalForm.cs

示例8: CalculateDepth

    ///////////////////////////////////////////////////////////////////////////////
    // functions
    ///////////////////////////////////////////////////////////////////////////////

    // ------------------------------------------------------------------ 
    // Desc: 
    // ------------------------------------------------------------------ 

    override protected float CalculateDepth ( Camera _cam ) {
        if ( _cam == null )
            return 0.0f;
        float dist = _cam.farClipPlane - _cam.nearClipPlane;
        float unitLayer = dist/MAX_LAYER;
        return -(((float)layer_ + bias_) * unitLayer - _cam.transform.position.y + _cam.nearClipPlane);
    }
开发者ID:tolian,项目名称:ex2D_Runtime,代码行数:15,代码来源:exLayerXZ.cs

示例9: Awake

    // Use this for initialization
    void Awake()
    {
        GameObject go = new GameObject("depthCamera");
        depthCamera = go.AddComponent<Camera>();
        depthCamera.transform.position = Vector3.zero;
        depthCamera.transform.rotation = transform.rotation;
        depthCamera.transform.localPosition += transform.forward * Near;
        depthCamera.transform.parent = transform;
        depthCamera.isOrthoGraphic = true;

        depthCamera.clearFlags = CameraClearFlags.SolidColor;
        depthCamera.backgroundColor = Color.white;
        depthTexture = new RenderTexture(TextureSize,TextureSize, 16, RenderTextureFormat.ARGB32);
        depthTexture.filterMode = FilterMode.Point;
        depthCamera.targetTexture = depthTexture;
        depthCamera.SetReplacementShader(shader, null);
        depthCamera.enabled = false;
        biasMatrix = Matrix4x4.identity;
        biasMatrix[ 0, 0 ] = 0.5f;
        biasMatrix[ 1, 1 ] = 0.5f;
        biasMatrix[ 2, 2 ] = 0.5f;
        biasMatrix[ 0, 3 ] = 0.5f;
        biasMatrix[ 1, 3 ] = 0.5f;
        biasMatrix[ 2, 3 ] = 0.5f;
    }
开发者ID:kokichi88,项目名称:shadowmapping,代码行数:26,代码来源:GenerateDepthTexture2.cs

示例10: Form_Load

 private void Form_Load(object sender, EventArgs e)
 {
     {
         var camera = new Camera(
             new vec3(0, 0, 5), new vec3(0, 0, 0), new vec3(0, 1, 0),
             CameraType.Perspecitive, this.glCanvas1.Width, this.glCanvas1.Height);
         var rotator = new SatelliteManipulater();
         rotator.Bind(camera, this.glCanvas1);
         rotator.BindingMouseButtons = System.Windows.Forms.MouseButtons.Left | System.Windows.Forms.MouseButtons.Right;
         this.rotator = rotator;
         this.scene = new Scene(camera, this.glCanvas1);
         this.glCanvas1.Resize += this.scene.Resize;
     }
     {
         Teapot model = new Teapot();
         OrderDependentTransparencyRenderer renderer = OrderDependentTransparencyRenderer.Create(model, model.Size, Teapot.strPosition, Teapot.strColor);
         SceneObject obj = renderer.WrapToSceneObject();
         this.scene.RootObject.Children.Add(obj);
     }
     {
         var builder = new StringBuilder();
         builder.AppendLine("1: Scene's property grid.");
         builder.AppendLine("2: Canvas' property grid.");
         MessageBox.Show(builder.ToString());
     }
 }
开发者ID:bitzhuwei,项目名称:CSharpGL,代码行数:26,代码来源:Form03OrderDependentTransparency.Load.cs

示例11: Update

        public override void Update(float elapsed, Camera camera, Player player, Map map)
        {
            base.Update (elapsed, camera, player, map);
            if (!dead) {
                tileDirRelSprites = new List<TileDirectionRelSprite> ();
                ApplyCamera (camera);
                x += xDir * MOVE_SPEED * elapsed;
                y += yDir * FALL_SPEED * elapsed;
                if (jumping) {
                    if (yDir >= 0) {
                        jumping = false;
                        falling = true;
                    } else {
                        yDir += FALL_SPEED;
                    }
                } else if (falling) {
                    if (yDir < FALL_CAP)
                        yDir += FALL_SPEED;
                }
                gun.Update (elapsed, camera);
                if (xDir != 0) {
                    gun.left = xDir < 0;

                }
                if (gun.left) {
                    gun.x = x - gun.width;
                } else if (!gun.left) {
                    gun.x = x + width;
                }
                gun.y = y + height / 3;
            }
        }
开发者ID:m0a0t0,项目名称:Extremely-Simple-C--Platformer,代码行数:32,代码来源:Sprites.cs

示例12: Draw

 public void Draw(SpriteBatch spriteBatch, Camera cam, Texture2D texture)
 {
     for (int i = 0; i < MaxParticles; i++)
         {
             sparkParticles[i].Draw(spriteBatch, cam, texture, gameWindow);
         }
 }
开发者ID:ao222qc,项目名称:1DV437_Assignments,代码行数:7,代码来源:SparkSystem.cs

示例13: Init

 public void Init(Transform dependence, string msg, Color textColor, FlyNumerDirection flyDir = FlyNumerDirection.side,int size = 42)
 {
     base.Init();
     cam = MainController.Instance.MainCamera;
     this.dependence = dependence;
     incFlyingNumbers.Init(msg, textColor, flyDir, size, OnDead);
 }
开发者ID:Kinderril,项目名称:p3,代码行数:7,代码来源:FlyNumberWIthDependence.cs

示例14: Load

        public override void Load()
        {
            camera = ((Camera)Container);

            SlimDX.RawInput.Device.RegisterDevice(SlimDX.Multimedia.UsagePage.Generic, SlimDX.Multimedia.UsageId.Mouse, SlimDX.RawInput.DeviceFlags.None);
            SlimDX.RawInput.Device.MouseInput += new EventHandler<MouseInputEventArgs>(MouseEventHandle);
        }
开发者ID:catdawg,项目名称:Ch0nkEngine,代码行数:7,代码来源:MouseComponent.cs

示例15: Curve

  public Curve(Molecule mol, Vector2 pos, Camera VectroCam = null)
  {
    _mol = mol;
    _label = mol.getName();
    _points = new LinkedList<Vector2>();
    //_pts = new Vector2[_maxPoints];
    _pts = new List<Vector2>();
    _minY = 0;
    _maxY = 0;
    _color = new Color(UnityEngine.Random.Range(0f, 1f), UnityEngine.Random.Range(0f, 1f), UnityEngine.Random.Range(0f, 1f));
    //_line = new VectorLine(mol.getName(), _pts, _color, null, 2.0f, LineType.Continuous, Joins.Weld);
    _line = new VectorLine(mol.getName(), _pts, 2.0f, LineType.Continuous, Joins.Weld);
    _line.color = _color;
    _isEnabled = true;
    _vectroCam = VectroCam;
//     _pos = pos;

//     _lines = new VectorLine[_maxPoints];
//     _linesTypes = new _linesTypes[_maxPoints - 1];

    VectorManager.useDraw3D = true;
    if (_vectroCam != null)
      //Vectrosity.VectorLine.SetCamera(_vectroCam);
      Vectrosity.VectorLine.SetCamera3D(_vectroCam);
    else
      Logger.Log("No Camera set for the Graph Window.", Logger.Level.ERROR);
  }
开发者ID:CyberCRI,项目名称:Hero.Coli,代码行数:27,代码来源:Curve.cs


注:本文中的Camera类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。