示例#1
0
        public override void Use(Player player)
        {
            if (CurrentItem != null)
            {
                if (PhotoAnimatonRunning)
                {
                    return;
                }
                if (player.Inventory.Count >= player.Inventory.Capacity)
                {
                    return;
                }

                player.Inventory.Pickup(CurrentItem);
                CurrentItem = null;
                return;
            }

            var texture = TakePhoto(player.Camera);
            var photo   = Instantiate(PhotoPrefab).GetComponent <PhotoItem>();

            photo.Image = texture;

            photo.transform.SetParent(transform, false);
            photo.transform.position = PhotoPrefab.transform.position;
            photo.transform.rotation = PhotoPrefab.transform.rotation;

            PhotoAnimatonRunning = true;

            StartCoroutine(Animator.Animate(
                               () => Animator.MoveToLocal(photo.transform, Vector3.forward * -.3f, 1f, Easing.Linear),
                               () => Animator.Action(() => PhotoAnimatonRunning = false)));

            CurrentItem = photo;
        }
示例#2
0
 IEnumerator Animation(bool enabled) =>
 Animator.Animate(
     () => Animator.MoveToLocal(Lamp.transform, new Vector3(0, .007f, 0), .2f, Easing.Linear),
     () => Animator.Action(() => ToggleLights(enabled)),
     () => Animator.Wait(.05f),
     () => Animator.MoveToLocal(Lamp.transform, Vector3.zero, .2f, Easing.Linear));