コード例 #1
0
        private void OnTriggerEnter(Collider c)
        {
            if (isOpening)
            {
                return;
            }

            var inventory = c.GetComponent <PlayerInventory>();

            if (inventory == null)
            {
                return;
            }

            if (inventory.HasKey(keyID))
            {
                ScreenText.Log("Opened {0} door", Key.Name);

                inventory.RemoveKey(keyID);
                Open();
            }
            else
            {
                ScreenText.Log("{0} key required", Key.Name);
            }
        }
コード例 #2
0
        private void OnTriggerEnter(Collider c)
        {
            var inventory = c.GetComponent <PlayerInventory>();

            if (inventory == null)
            {
                return;
            }

            ScreenText.Log("Picked up {0} key", Key.Name);
            inventory.AddKey(keyID);
            UnityUtil.Destroy(gameObject);
        }
コード例 #3
0
 public static void Log(object obj)
 {
     ScreenText.Log(obj.ToString());
 }