private void scrollCamera(float amount)
    {
        if (currentContent.scrollable)
        {
            float targetPosY   = camera.transform.localPosition.y + amount;
            float actualAmount = amount;
            if (amount > 0f)
            {
                float targetTop  = targetPosY + CAMERA_VISION_VERTICAL / 2f;
                float contentTop = currentContent.getTop();
                if (targetTop > contentTop)
                {
                    actualAmount -= targetTop - contentTop;
                }
            }
            else if (amount < 0f)
            {
                float targetBottom  = targetPosY - CAMERA_VISION_VERTICAL / 2f;
                float contentBottom = currentContent.getBottom();
                if (targetBottom < contentBottom)
                {
                    actualAmount += contentBottom - targetBottom;
                }
            }

            Vector3 cameraTargetPosition = camera.gameObject.transform.localPosition + new Vector3(0f, actualAmount, 0f);
            Misc.AnimateMovementTo("tv-content-camera", camera.gameObject, cameraTargetPosition);
        }
    }
 public void run(bool reverse)
 {
     for (int i = 0; i < slideInObjectDefinitions.Length; i++)
     {
         SlideInOtherObjectDefinition slideInObjectDefinition = slideInObjectDefinitions[i];
         if (!slideInObjectDefinition.enabled)
         {
             continue;
         }
         if (slideInObjectDefinition.instantiatedObject == null)
         {
             slideInObjectDefinition.instantiatedObject = Instantiate(slideInObjectDefinition.gameObjectToSlideIn, null);
             slideInObjectDefinition.instantiatedObject.transform.localPosition = slideInObjectDefinition.startSlidePosition;
             slideInObjectDefinition.instantiatedObject.GetComponent <BagContentPropertiesReference>().reference = GetComponent <BagContentProperties>();
         }
         slideInObjectDefinition.pills = GetComponent <BagContentProperties>();
         float time = slideInObjectDefinition.animationTime > 0 ? slideInObjectDefinition.animationTime : Misc.DEFAULT_ANIMATION_TIME;
         if (!reverse)
         {
             slideInObjectDefinition.instantiatedObject.SetActive(true);
             Misc.AnimateMovementTo("position_other_inspect_item_" + i, slideInObjectDefinition.instantiatedObject, slideInObjectDefinition.endSlidePosition, time);
         }
         else if (slideInObjectDefinition.animateReverse)
         {
             Misc.AnimateMovementTo("position_other_inspect_item_end_" + i, slideInObjectDefinition.instantiatedObject, slideInObjectDefinition.startSlidePosition, time);
             if (slideInObjectDefinition.hideAfterReverse)
             {
                 Misc.SetActiveAfterDelay("position_other_inspect_item_end_hide_" + i, slideInObjectDefinition.instantiatedObject, false, false, time);
             }
         }
     }
 }
Esempio n. 3
0
 public void acceptItem()
 {
     inspectDone();
     Misc.AnimateMovementTo("ok_move_" + id, this.gameObject, InspectUI.instance.objectOk.transform.localPosition);
     Misc.AnimateScaleTo("ok_scale_" + id, this.gameObject, Vector3.zero);
     BagHandler.instance.bagInspectItemEnded();
 }
    public void showPassport(bool show = true)
    {
        showingPassport = show;
        float passportMovementY = 2.61f;

        if (show && passport == null)
        {
            passport        = Instantiate(passportPrefab);
            passport.person = this;
            passport.setFavoriteColor(chosenFavoriteColor);
            Vector3    passportTargetPosition = new Vector3(passport.transform.localPosition.x - PASSPORT_OFFSET_X * (passport.id % 6), passport.transform.localPosition.y + passportMovementY, passport.transform.localPosition.z);
            Quaternion passportTargetRotation = passport.transform.localRotation;
            Misc.AnimateMovementTo("person_passport_show_" + id, passport.gameObject, passportTargetPosition);
            passport.originalPosition = passportTargetPosition;
            passport.originalRotation = passportTargetRotation;
            if (!(Game.instance.cameraXPos == 1 && !Game.instance.zoomedOutState))
            {
                passport.startInactive = true;
            }
        }
        else
        {
            Vector3 passportTargetPosition = new Vector3(passport.transform.localPosition.x, passport.transform.localPosition.y - passportMovementY, passport.transform.localPosition.z);
            Misc.AnimateMovementTo("person_passport_hide_" + id, passport.gameObject, passportTargetPosition);
            Misc.SetActiveAfterDelay("person_passport_active_" + id, passport.gameObject, false, true);
        }
    }
Esempio n. 5
0
    private void animateOutUiObj(InspectUIButtonParent obj, Vector3 offset, string animateKey)
    {
        Vector3 throwAwayTargetPosition = obj.child.getTargetPosition() + offset;

        Misc.AnimateMovementTo(animateKey, obj.gameObject, throwAwayTargetPosition);
        currentUiDelays.Add(animateKey, StartCoroutine(setActiveUIButtonAfterDelay(obj.gameObject, false, animateKey)));
    }
Esempio n. 6
0
    public void inspect()
    {
        PubSub.subscribe("inspect_rotate", this);
        PubSub.subscribe("inspect_action", this);
        locationInBag = this.transform.localPosition;
        rotationInBag = this.transform.localRotation;
        parentBag     = this.transform.parent;

        // Turn off casting shadows
        enableShadows(false); // TODO - When action is taken, don't forget to enable shadows again

        // Target object position
        Vector3 targetPosition = Game.instance.gameCamera.transform.position + Game.instance.gameCamera.transform.rotation * (Vector3.forward * 18f);

        this.transform.parent = null;
        Misc.AnimateMovementTo("content-zoom-" + id, this.gameObject, targetPosition);

        // Special method to run when starting inspection on this object
        ActionOnInspect[] actionOnInspects = GetComponents <ActionOnInspect>();
        foreach (ActionOnInspect actionOnInspect in actionOnInspects)
        {
            Debug.Log(actionOnInspect);
            if (actionOnInspect != null)
            {
                actionOnInspect.run();
            }
        }

        inspecting = true;
        BagContentProperties.currentInspectedItem = this;
    }
Esempio n. 7
0
 public void throwAway()
 {
     inspectDone();
     Misc.AnimateMovementTo("throw_away_move_" + id, this.gameObject, InspectUI.instance.throwAway.transform.localPosition);
     Misc.AnimateScaleTo("throw_away_scale_" + id, this.gameObject, Vector3.zero);
     BagHandler.instance.bagInspectItemEnded();
 }
    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;
    }
Esempio n. 9
0
 public void sendItemToManualInspect(bool sameTray = true)
 {
     inspectDone();
     // TODO - Animate to the clicked icon... right now it only looks correct for the big, single button (use the bool in arguments)
     Misc.AnimateMovementTo("manual_inspect_move_" + id, this.gameObject, InspectUI.instance.manualInspect.transform.localPosition);
     Misc.AnimateScaleTo("manual_inspect_scale_" + id, this.gameObject, Vector3.zero);
     BagHandler.instance.bagInspectItemEnded(!sameTray);
 }
Esempio n. 10
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));
    }
Esempio n. 11
0
    public void callPolice()
    {
        Person        reportPerson = currentInspectedItem.person;
        BagProperties inspectedBag = currentInspectedItem.parentBag.GetComponentInParent <BagProperties>();

        inspectDone();
        Misc.AnimateMovementTo("call_police_move_" + id, this.gameObject, InspectUI.instance.callPolice.transform.localPosition);
        Misc.AnimateScaleTo("call_police_scale_" + id, this.gameObject, Vector3.zero);
        BagHandler.instance.bagInspectItemEnded();

        StartCoroutine(reportPersonAfterDelay(reportPerson, inspectedBag));
    }
 public void run(bool reverse)
 {
     for (int i = 0; i < moveDefinitions.Length; i++)
     {
         MoveDefinition moveDefinition = moveDefinitions[i];
         float          time           = moveDefinition.animationTime > 0 ? moveDefinition.animationTime : Misc.DEFAULT_ANIMATION_TIME;
         if (!reverse)
         {
             Misc.AnimateMovementTo("move_inspect_item_" + i, moveDefinition.gameObject, moveDefinition.startInspectPosition, time, true);
         }
         else if (moveDefinition.animateReverse)
         {
             Misc.AnimateMovementTo("move_inspect_item_end_" + i, moveDefinition.gameObject, moveDefinition.endInspectPosition, time, true);
         }
     }
 }
Esempio n. 13
0
    private void animateInUiObj(InspectUIButtonParent obj, Vector3 offset, string animateKey)
    {
        // Safety check - are we currently animating the UI?
        bool animatingUiInProgress = Misc.IsMovementAnimationActive("inspect_police");

        if (animatingUiInProgress)
        {
            // UI is animating, and a will be hidden after a delay, cancel these delays
            cancelUiDelay();
        }

        Vector3 currentButtonTargetPosition = obj.child.getTargetPosition();

        obj.gameObject.SetActive(true);
        obj.transform.position = currentButtonTargetPosition + offset;
        Debug.Log(animateKey + ": " + obj.transform.position + " - " + currentButtonTargetPosition);
        Misc.AnimateMovementTo(animateKey, obj.gameObject, currentButtonTargetPosition);
    }
Esempio n. 14
0
    private IEnumerator delayedPutBackToTarget(float delay, float time)
    {
        yield return(new WaitForSeconds(delay));

        Misc.AnimateMovementTo("put_back_move_" + id, this.gameObject, locationInBag, time, straightMotion: true);
    }
 void changeState()
 {
     pressed = !pressed;
     Misc.AnimateMovementTo("xray-button-press-" + buttonType, this.gameObject, new Vector3(pressed ? xPressed : xUnpressed, this.transform.localPosition.y, this.transform.localPosition.z));
 }