• 大小: 41.05MB
    文件类型: .rar
    金币: 1
    下载: 0 次
    发布日期: 2023-07-02
  • 语言: 其他
  • 标签: Unity3d  

资源简介

用Unity3d做的一个魔方demo,算是自己初学练手的作业吧。

资源截图

代码片段和文件信息

using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class CameraRotate : MonoBehaviour
{
    //private float x;
   // private float y;
    private float speed = 300;
    //private Vector3 center = new Vector3(0 0 0);

    // Use this for initialization
    void Start()
    {

    }

    // Update is called once per frame
    void Update()
    {
        if (Input.GetMouseButtonDown(1))
        {
        }
        if (Input.GetMouseButton(1))
        {
            gameobject.GetComponent().RotateAround(new Vector3(0 0 0) Vector3.up -Input.GetAxis(“Mouse X“) * Time.deltaTime * speed);
            gameobject.GetComponent().RotateAround(new Vector3(0 0 0) Vector3.right Input.GetAxis(“Mouse Y“) * Time.deltaTime * speed);
        }

       
        //if (Input.GetMouseButton(1))
        //{
        //    float rotationx = Input.GetAxis(“mouse x“) * 5;
        //    float rotationy = Input.GetAxis(“mouse y“) * 5;
        //    transform.Rotate(-rotationy rotationx 0);
        //}

        //if (Input.GetMouseButton(1))
        //{
        //    x += Input.GetAxis(“Mouse X“) * speed * Time.deltaTime;
        //    y += Input.GetAxis(“Mouse Y“) * speed * Time.deltaTime;
        //    Quaternion q = Quaternion.Euler(y x 0);
        //    Vector3 direction = q * Vector3.forward;
        //    this.transform.position = center - direction *;
        //    this.transform.LookAt(center);
        //}

        //通过鼠标滚轮控制镜头缩小和放大
        if (Input.GetAxis(“Mouse ScrollWheel“) != 0)
        {
            this.gameobject.transform.Translate(new Vector3(0 0 Input.GetAxis(“Mouse ScrollWheel“) * Time.deltaTime * 500));
        }
    }
}

 属性            大小     日期    时间   名称
----------- ---------  ---------- -----  ----

    ..A..H.    192512  2018-04-14 16:51  RubicCube\.vs\RubicCube\v15\.suo

     文件          0  2018-04-12 15:48  RubicCube\.vs\RubicCube\v15\Server\sqlite3\db.lock

     文件     790528  2018-04-14 16:51  RubicCube\.vs\RubicCube\v15\Server\sqlite3\storage.ide

     文件      10422  2018-04-14 12:06  RubicCube\Assembly-CSharp-Editor-firstpass.csproj

     文件      14482  2018-04-14 12:06  RubicCube\Assembly-CSharp-firstpass.csproj

     文件      10475  2018-04-14 12:12  RubicCube\Assembly-CSharp.csproj

    I.A....      2050  2018-04-12 15:44  RubicCube\Assets\Assets\Materials\example.mat

    ..A..H.       230  2018-04-12 15:44  RubicCube\Assets\Assets\Materials\example.mat.meta

    I.A....      2052  2018-04-14 16:45  RubicCube\Assets\Assets\Materials\m_example.mat

    ..A..H.       230  2018-04-14 16:45  RubicCube\Assets\Assets\Materials\m_example.mat.meta

    ..A..H.       214  2018-04-12 15:42  RubicCube\Assets\Assets\Materials.meta

    I.A....      3504  2018-04-14 16:49  RubicCube\Assets\Assets\Prefabs\Cube.prefab

    ..A..H.       232  2018-04-12 15:45  RubicCube\Assets\Assets\Prefabs\Cube.prefab.meta

    ..A..H.       214  2018-04-12 15:42  RubicCube\Assets\Assets\Prefabs.meta

    I.A....     67666  2018-04-14 15:46  RubicCube\Assets\Assets\Scenes\Main.unity

    ..A..H.       197  2018-04-12 15:43  RubicCube\Assets\Assets\Scenes\Main.unity.meta

    ..A..H.       214  2018-04-12 15:42  RubicCube\Assets\Assets\Scenes.meta

     文件       3622  2018-04-14 12:08  RubicCube\Assets\Assets\scripts\MainController.cs

    ..A..H.       285  2018-04-13 20:57  RubicCube\Assets\Assets\scripts\MainController.cs.meta

     文件       1366  2018-01-15 10:25  RubicCube\Assets\Assets\scripts\MapTexture.js

    ..A..H.       285  2018-04-12 15:44  RubicCube\Assets\Assets\scripts\MapTexture.js.meta

     文件       3538  2018-04-14 11:36  RubicCube\Assets\Assets\scripts\Player.cs

    ..A..H.       285  2018-04-12 15:46  RubicCube\Assets\Assets\scripts\Player.cs.meta

    ..A..H.       214  2018-04-12 15:42  RubicCube\Assets\Assets\scripts.meta

     文件       5811  2018-01-15 10:25  RubicCube\Assets\Assets\Textures\example.PNG

    ..A..H.      1690  2018-04-12 15:43  RubicCube\Assets\Assets\Textures\example.PNG.meta

     文件       5542  2018-04-14 16:42  RubicCube\Assets\Assets\Textures\m_example.PNG

    ..A..H.      1690  2018-04-14 16:44  RubicCube\Assets\Assets\Textures\m_example.PNG.meta

    ..A..H.       214  2018-04-12 15:43  RubicCube\Assets\Assets\Textures.meta

    ..A..H.       214  2018-04-12 15:42  RubicCube\Assets\Assets.meta

............此处省略1248个文件信息

评论

共有 条评论