예제 #1
0
    private void togglePassport()
    {
        // Only toggle if no animation is active
        string animationKey = "passport_animation_zoom_" + id;

        if (isZoomedIn)
        {
            Misc.AnimateMovementTo(animationKey, this.gameObject, originalPosition, Misc.DEFAULT_ANIMATION_TIME, true);
            Misc.AnimateRotationTo(animationKey, this.gameObject, originalRotation);

            ZoomedInPassport = null;
        }
        else
        {
            Vector3 cameraPosition = Game.instance.gameCamera.transform.position;
            Vector3 targetPosition = new Vector3(0, 0, 14.812f) + cameraPosition;
            Misc.AnimateMovementTo(animationKey, this.gameObject, targetPosition, Misc.DEFAULT_ANIMATION_TIME, true);
            Misc.AnimateRotationTo(animationKey, this.gameObject, Quaternion.identity);

            if (ZoomedInPassport != null)
            {
                ZoomedInPassport.togglePassport();
            }
            ZoomedInPassport = this;
        }
        isZoomedIn = !isZoomedIn;
    }
예제 #2
0
    public void animateToBag(float timeToDropPoint = TIME_ANIMATE_TO_DROP_POINT, float timeToTargetPos = TIME_TO_TARGET_POS)
    {
        transform.SetParent(parentBag);

        Misc.AnimateMovementTo("put_back_move_" + id, this.gameObject, locationInBag + new Vector3(0f, parentBag.GetComponentInParent <BagProperties>().halfBagHeight * 3f, 0f), timeToDropPoint);
        Misc.AnimateRotationTo("put_back_rotate_" + id, this.gameObject, rotationInBag, timeToDropPoint);
        Misc.AnimateScaleTo("put_back_scale_" + id, this.gameObject, Vector3.one, timeToDropPoint);

        StartCoroutine(delayedPutBackToTarget(timeToDropPoint, timeToTargetPos));
    }
    public void animateLidState(bool open = false, bool calculateSmartTime = true)
    {
        if (lidRotationObj)
        {
            float currentRotationProgress = lidRotationObj.transform.localRotation.eulerAngles.magnitude / lidRotationOpen.magnitude;
            float time = 0.5f * (open ? 1f - currentRotationProgress : currentRotationProgress);

            Quaternion toRotation = open ? Quaternion.Euler(lidRotationOpen) : Quaternion.identity;
            if (calculateSmartTime)
            {
                Misc.AnimateRotationTo(gameObject.name + "_" + id, lidRotationObj, toRotation, time);
            }
            else
            {
                Misc.AnimateRotationTo(gameObject.name + "_" + id, lidRotationObj, toRotation);
            }
        }
    }