1,为玩家添加Done Player Inventory脚本
public class DonePlayerInventory : MonoBehaviour
{
public bool hasKey; // Whether or not the player has the key.
}
玩家是否拥有钥匙
2,添加钥匙卡模型 modles->prop_keycard ,Transfom Position :-22,0.4,32
3,为钥匙卡添加旋转动画,将DoneKeyCardAnimator拖入钥匙卡的Contorller栏里
4,为钥匙卡添加触发器,Sphere Collider,勾选Is Trigger,Radius:0.9
5,为钥匙卡添加light组件提示玩家获取钥匙。Rendering->light,Range:2.3,color:0,159,255,255,光强Intensity:2.5
6,为钥匙卡添加脚本DoneKeyPickup实现玩家取钥匙的功能
using UnityEngine;
using System.Collections;
public class DoneKeyPickup : MonoBehaviour
{
public AudioClip keyGrab; // Audioclip to play when the key is picked up.
private GameObjec