Tools-Unity Basic Learning Summary 2

Presented in the last article: Tool-Unity Basic Learning Summary 1

30. Character scene control and production

            1. Mouse to specify the corresponding direction;
            2. The effect of forming an aperture;
            3. The corresponding character face faces the corresponding direction and moves in the direction specified by the mouse;
            4. There are animations in the process of moving: walking, running, standing;


31. Character scene control and production



32. In the character scene, when encountering high or low terrain, the character keeps walking



33. Who is the main character with the camera?


34. The rotation of the field of view, the effect of zooming in and zooming out; and distance limitation



35. Right-click to view the horizontal field of view



36. Slide the mouse up and down to control the up and down view


37. Looking at the game development process of RPG role-playing in the big picture

NPG + Mission System
   1. Simple UI design
   2. Program Control
      a. UI cannot move with the protagonist
         UICamera.hoveredObject == null
        Script BarNPC
           1. When the mouse clicks on the grandfather, play the UI
           2. If you don't need it, just click Close
           3. Add OK button;
           4. Three methods: OnAcceptButton, OnOkButton, OnCancelButton
           5. Two methods: display task progress, display task information
           6. Click on the OK button (get coins)
           7. Mouse pointer, different charts are displayed on different objects when the mouse moves (create class 1. Different chart declarations; 2. cursorMode mouse pointer)
           8. Add different function buttons in the lower right corner
           9. Settings corresponding to different function buttons
           10. Read text file (textAsset) textAsset type, read information, use dictionary class (system.collections.generic)
           11. Backpack UI design, and corresponding script control, backpack
           12. Drag and drop items, listen to drag events (OnDragDropRealse method), pay attention to spaces and grids that already have objects
           13. How many items can be viewed in Inventory? (Create class, InventoryItemGrid) setId, get item information, update item information, clear item information stored in the grid
           14. Pick up items (randomly generate IDs, judge whether there are items in the inventory, traverse and combine foreach, if they do not exist, look for squares)
           15. Exchange between items (1. Drag and drop the corresponding information; 2. If there is a corresponding item, exchange the corresponding information; 3. Pay attention to zero processing)
           16. Backpack setting and hiding
           17. Adding and subtracting items
           18. When we add the mouse to an item, we can know the information of an item.
           19. Select different objects to display in the front left (display avatar)
           20. Set name, level and health bar
           21. Set a small map in the upper right corner
           22. Production of charts in maps
           23. Zoom in and out of character objects in the minimap
           24. When the character collides with the object, it cannot pass
           25. When walking towards the enemy, you are automatically attacked
           26. Add special effects to attacks
           27. Automatic generation of wild wolves, randomly generated
           28. The protagonist adds special effects skill system

不同脚本的使用作用

38. Unity 中GUI函数中的rec()方法


39. 通过c#脚本来控制,显示的按钮

using UnityEngine;
using System.Collections;

public class PressAnyKey1 : MonoBehaviour {

    // Use this for initialization
    private bool IsAnyKeyDown = false; //  1.通过声明变量,目的用于判断,是否按下任何键;
    private GameObject ContainerButton; / /2. 声明游戏物体变量,目的在于,收集查询到组件名字


    void Start () {

         // 在游戏组件中查找对应的组件名字为:“ContainerButton”
        ContainerButton = this.transform.parent.Find("ContainerButton").gameObject;
    }

    // Update is called once per frame
    void Update () {

        if(IsAnyKeyDown == false ){
            if(Input.anyKey){
                ShowButton();

            }

        }

    }

    void ShowButton() { //  自己写了一个方法,来统一管理ShowButton
        ContainerButton.SetActive(true); //  将组件的值设定为:true
        this.gameObject.SetActive(false);//  自己的组件值设定为:false// PressAnyKeyDown
        IsAnyKeyDown = true;    //  如果按下键,则IsAnyKeyDown = true;
    }
}

40. C# 程序 打砖块 实例




Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=324422377&siteId=291194637