示例#1
0
        private void ChangeState(SceneryState newState)
        {
            switch (newState)
            {
            case SceneryState.READY_TO_ACTIVATE:
                ScriptControl(isEnabled: false);
                isPickedUp            = false;
                rigidBody.useGravity  = false;
                rigidBody.isKinematic = true;
                sphereColl.enabled    = false;
                sphereColl.material   = stickyPhysicMaterial;
                hasLanded             = false;
                SetVisible(isVisible: false);
                break;

            case SceneryState.SPAWN:
                LockRotation();
                ScriptControl(isEnabled: false);
                isPickedUp            = false;
                rigidBody.useGravity  = true;
                rigidBody.isKinematic = false;
                sphereColl.enabled    = true;
                sphereColl.material   = stickyPhysicMaterial;
                SetVisible(isVisible: true);
                hasLanded = false;
                break;

            case SceneryState.READY_FOR_PICKUP:
                LockRotation();
                ScriptControl(isEnabled: true);
                isPickedUp            = false;
                rigidBody.useGravity  = false;
                rigidBody.isKinematic = false;
                sphereColl.enabled    = true;
                sphereColl.material   = stickyPhysicMaterial;
                hasLanded             = true;
                if (animCurveScript != null)
                {
                    animCurveScript.SetOriginalPosition();
                }
                break;

            case SceneryState.MAGNETIC:
                LockRotation();
                ScriptControl(isEnabled: true);
                isPickedUp            = true;
                rigidBody.useGravity  = false;
                rigidBody.isKinematic = false;
                sphereColl.enabled    = false;
                sphereColl.material   = slipperyPhysicMaterial;
                break;

            case SceneryState.NONE:
                break;
            }
        }
示例#2
0
        private void changeState(SceneryState newState)
        {
            if (newState == internalState)
            {
                return;
            }
            switch (newState)
            {
            case SceneryState.READY_TO_ACTIVATE:
                base.gameObject.transform.parent     = originalParent;
                base.gameObject.transform.localScale = originalLocalScale;
                internalState = newState;
                scriptControl(isEnabled: false);
                isMagnetic            = false;
                rigidBody.drag        = 0f;
                rigidBody.useGravity  = false;
                rigidBody.isKinematic = true;
                sphereColl.enabled    = false;
                sphereColl.material   = stickyPhysicMaterial;
                base.gameObject.transform.position = originalPos;
                base.gameObject.transform.rotation = originalRot;
                hasLanded = false;
                setVisible(isVisible: true);
                setVisibleSpecialObjects(isVisible: true);
                if (InteractionObj != null)
                {
                    InteractionObj.SetActive(value: true);
                }
                break;

            case SceneryState.SPAWN:
                base.gameObject.transform.parent     = originalParent.parent;
                base.gameObject.transform.localScale = originalLossyScale;
                internalState = newState;
                lockRotation();
                scriptControl(isEnabled: false);
                isMagnetic = false;
                if (IsDivingCollectible)
                {
                    rigidBody.useGravity = false;
                    rigidBody.drag       = 5f;
                }
                else
                {
                    rigidBody.useGravity = true;
                    rigidBody.drag       = 0f;
                }
                rigidBody.isKinematic = false;
                sphereColl.enabled    = true;
                sphereColl.material   = stickyPhysicMaterial;
                hasLanded             = false;
                if (InteractionObj != null)
                {
                    InteractionObj.SetActive(value: false);
                }
                break;

            case SceneryState.READY_FOR_PICKUP:
                internalState = newState;
                lockRotation();
                scriptControl(isEnabled: true);
                isMagnetic            = false;
                rigidBody.drag        = 0f;
                rigidBody.useGravity  = false;
                rigidBody.isKinematic = false;
                sphereColl.enabled    = true;
                sphereColl.material   = stickyPhysicMaterial;
                hasLanded             = true;
                if (animCurveScript != null)
                {
                    animCurveScript.SetOriginalPosition();
                }
                if (InteractionObj != null)
                {
                    InteractionObj.SetActive(value: false);
                }
                break;

            case SceneryState.MAGNETIC:
                internalState = newState;
                lockRotation();
                scriptControl(animEnabled: false, rotateEnabled: false, triggerEnabled: true);
                isMagnetic            = true;
                rigidBody.drag        = 0f;
                rigidBody.useGravity  = false;
                rigidBody.isKinematic = true;
                sphereColl.enabled    = false;
                if (IsDivingCollectible)
                {
                    hasLanded = false;
                }
                if (InteractionObj != null)
                {
                    InteractionObj.SetActive(value: false);
                }
                break;

            case SceneryState.INVISIBLE:
                base.gameObject.transform.parent     = originalParent;
                base.gameObject.transform.localScale = originalLocalScale;
                internalState = newState;
                lockRotation();
                scriptControl(isEnabled: false);
                isMagnetic            = false;
                rigidBody.drag        = 0f;
                rigidBody.useGravity  = false;
                rigidBody.isKinematic = true;
                sphereColl.enabled    = false;
                sphereColl.material   = stickyPhysicMaterial;
                setVisible(isVisible: false);
                hasLanded = true;
                if (InteractionObj != null)
                {
                    InteractionObj.SetActive(value: false);
                }
                break;

            case SceneryState.NONE:
                break;
            }
        }