コード例 #1
0
ファイル: PushPullObject.cs プロジェクト: aksheus/Project-RED
    private void EvaluateTransitionComplete(WorldChanger.WorldState currentState)
    {
        //  Reset the layer if object is always transferrable type
        if (interactType == InteractableType.AlwaysTransferable)
        {
            //Debug.Log("transition complete");
            Layers.ChangeLayers(gameObject, originalLayer);

            //Debug.Log("Revert layer");
        }
    }
コード例 #2
0
    public void BroadcastTransitionCompleteEvent()
    {
        if (OnWorldChangeComplete != null)
        {
            OnWorldChangeComplete(CurrentWorldState);
        }

        isCurrentlyTransitioning = false;

        //  Update the layer
        Layers.ChangeLayers(playerController.gameObject, originalLayer);
    }
コード例 #3
0
    public void SwitchWorld(int worldID)
    {
        //  Get the current world camera
        Camera currentCamera = GetCurrentWorldCamera();

        isCurrentlyTransitioning = true;

        //  Update the layer
        Layers.ChangeLayers(playerController.gameObject, Layers.ViewAlways);

        //  Cache the player's position in normalized screen space coordinates.
        Vector2 transitionCenter = currentCamera.WorldToViewportPoint(playerController.transform.position);

        //  Determine which world ID to switch to and check if world is already active.
        if (worldID == 1)
        {
            //  Update world state
            CurrentWorldState = WorldState.Present;

            //  Update the parallax cameras
            UpdateParallaxes(CurrentWorldState);

            //  Perform transition
            cameraTransition.DoTransition(CameraTransitionEffects.SmoothCircle, currentCamera, PresentCamera, transitionDuration, new object[] { false, transitionEdgeSmoothness, transitionCenter });
        }
        else if (worldID == 2)
        {
            //  Update world state
            CurrentWorldState = WorldState.Past;

            //  Update the parallax cameras
            UpdateParallaxes(CurrentWorldState);

            //  Perform transition
            cameraTransition.DoTransition(CameraTransitionEffects.SmoothCircle, currentCamera, PastCamera, transitionDuration, new object[] { false, transitionEdgeSmoothness, transitionCenter });
        }
        else if (worldID == 3)
        {
            //  Update world state
            CurrentWorldState = WorldState.Future;

            //  Update the parallax cameras
            UpdateParallaxes(CurrentWorldState);

            //  Perform transition
            cameraTransition.DoTransition(CameraTransitionEffects.SmoothCircle, currentCamera, FutureCamera, transitionDuration, new object[] { false, transitionEdgeSmoothness, transitionCenter });
        }
    }
コード例 #4
0
ファイル: PushPullObject.cs プロジェクト: aksheus/Project-RED
    private void EvaluateTransitionStart(WorldChanger.WorldState worldState)
    {
        //  If the interaction type of this object is non transferable then cancel the pushpull operation of the player
        if (interactType == InteractableType.NonTransferable && playerController.pushpullObject == this)
        {
            playerController.CancelPushingPulling();
        }

        if (interactType == InteractableType.Transferable)
        {
            currentWorldState = worldState;
        }

        //  If the object interation type is Always Transferable, evaluate
        if (interactType == InteractableType.AlwaysTransferable && CheckWorldCollisions(worldState))
        {
            //  if player is not currently pushing/pulling this object...
            if (playerController.pushpullObject != this)
            {
                //  Set layer to ViewAlways so it always displays
                Layers.ChangeLayers(gameObject, Layers.ViewAlways);

                //  Determine the new Z position of the object after world change
                switch (worldState)
                {
                case WorldChanger.WorldState.Present:
                    transform.position = new Vector3(transform.position.x, transform.position.y, 0);
                    currentWorldState  = WorldChanger.WorldState.Present;
                    break;

                case WorldChanger.WorldState.Past:
                    transform.position = new Vector3(transform.position.x, transform.position.y, 50);
                    currentWorldState  = WorldChanger.WorldState.Past;
                    break;

                case WorldChanger.WorldState.Future:
                    transform.position = new Vector3(transform.position.x, transform.position.y, 100);
                    currentWorldState  = WorldChanger.WorldState.Future;
                    break;
                }
            }
        }
    }
コード例 #5
0
ファイル: PushPullObject.cs プロジェクト: aksheus/Project-RED
    /*private void OnCollisionEnter(Collision collision)
     * {
     *  if (collision.collider.CompareTag(Tags.Player))
     *  {
     *      rigidBody.isKinematic = true;
     *  }
     * }
     *
     * private void OnCollisionExit(Collision collision)
     * {
     *  if (collision.collider.CompareTag(Tags.Player))
     *  {
     *      rigidBody.isKinematic = false;
     *  }
     * }*/

    public void OnPushPullEnd()
    {
        Layers.ChangeLayers(gameObject, originalLayer);
        //Debug.Log("ended pushpull");
        StopAllCoroutines();
    }