Unity UFPS 教學.CG數位學習網

CG 數位學習網 > UFPS 教學



開啟 [ UFPS > Base > Content > Levels ] 資料夾,這些是 UFPS 提供的展示場景。

 

UFPS 提供許多展示場景,建議開啟 DemoScene3.unity 場景,按下 Play 試玩遊戲,實際體驗 UFPS 的主要功能。

 

遊戲角色的操作方法

功能 按鈕
移動 WASD 或方向鍵
蹲下 C
跳躍 空白鍵
奔跑 Shift + 移動
射擊 滑鼠左鍵
瞄準 滑鼠右鍵
補充彈藥 R
使用物品 F
顯示介面 G
顯示選單 ENTER
離開遊戲 ESC

 

製作遊戲場景

Make sure your scene has some kind of floor in it, for example a huge box with collision. An easy way of achieving this is going to the Unity main menu, choosing GameObject > Create Other > Cube and setting the position of the cube transform to (0, 0, 0) and its scale to (1000, 1, 1000).
In the Project view, browse to the Content/Prefabs/Players folder (or type player in the search box) and drag one of the example player prefabs into your scene hierarchy. Make sure it is positioned slightly above the floor.

注意!若您使用全新的場景,請關閉或刪除 Main Camera 攝影機,否則將會出現錯誤訊息。

重要觀念

您需要瞭解 UFPS 的重要觀念,包括 FP components(元件)、States(狀態)、Events(事件)。

FP components

An FP script is a Unity component designed to be part of a local, First Person player. These all have names beginning with "vp_FP" and include the Player, the Controller, the Camera, its Weapons and their Shooters.

States(狀態)

A State is a list of settings for a specific component during a specific activity. For example: the camera "Crouch" state has values in it defining a lower Y-position for the camera. The controller's "Crouch" state makes it slow down. States are saved in small scripts called Presets.

Events(事件)

事件用於設定 FP components 的通訊,例如:當 Character controller(角色控制器)偵測因掉落到地面而產生的衝擊,it sends the force of impact to the Player Event Handler, which in turn broadcasts it to the camera and weapon components (making them shake).

TIP: If you are planning to do even just a little scripting with this system, it is a good idea to first have a glance at the Event System chapter, and you will have more AHA! moments and fewer headaches.

 

 

 

 

 

 



~ CG 數位學習網版權所有 ~