Ejemplo n.º 1
0
    void UpdatePosition()
    {
        if (CurrentRoom == null)
        {
            return;
        }
        Vector3 targerPosition = CurrentRoom.GetRoomCenter();

        transform.position = Vector3.MoveTowards(transform.position, targerPosition, Time.deltaTime * MovementSpeedOnRoomChange);
    }
Ejemplo n.º 2
0
    void UpdatePosition()
    {
        if (currentRoom == null)
        {
            return;
        }
        Vector3 targetPosition = currentRoom.GetRoomCenter();

        targetPosition.z   = transform.position.z;
        transform.position = Vector3.MoveTowards(transform.position, targetPosition,
                                                 Time.deltaTime * cameraSpeed);
    }
Ejemplo n.º 3
0
    //Target is rooms, used to position cam over room
    private Vector3 GetCameraTargetPosition()
    {
        if (CurrentRoom == null)
        {
            return(Vector3.zero);
        }

        Vector3 targetPosition = CurrentRoom.GetRoomCenter();

        targetPosition.z = transform.position.z;

        return(targetPosition);
    }
    void UpdatePosition()
    //This should set m_IsUpdatingPosition to true, then to false when it has changed scenes
    //Yeah this is the change scenes thing. It will get its variables from another script that will call upon it.
    {
        if (CurrentRoom == null)
        {
            return;
        }
        if (m_IsUpdatingPosition == true)
        {
            //Debug.Log("UpdatePosition is being called");
            Vector3 targetPosition = new Vector3();
            if (RoomTransition == null)
            {
                //Debug.Log("Room transition was null, getting center of this room");
                targetPosition = CurrentRoom.GetRoomCenter();
                //Debug.Log("Seems like RoomTransition was null!");
            }
            if (RoomTransition != null)
            {
                //  Debug.Log("Room transition wasnt null, getting transition target");
                targetPosition = RoomTransition.GetCameraTransitionTarget();//Here it should get the center of the roomtransition collider
                //Debug.Log("Target is set to RoomTransition coordinates: " + targetPosition.x +" and "+ targetPosition.y);
            }
            targetPosition.z   = transform.position.z;
            transform.position = Vector3.MoveTowards(transform.position, targetPosition, Time.deltaTime * MovementSpeedOnRoomChange);
            maxPosition        = CurrentRoom.maxCameraPosition;
            minPosition        = CurrentRoom.minCameraPosition;

            //  Debug.Log("transform position is: " + transform.position + " and target position is: " + targetPosition);

            while (transform.position != targetPosition)
            {
                //if it does not freeze the character, the code things that you are already at the targetposition
                // Debug.Log("Code freezes character");
                freezeCharacter.SetFrozen(true, true, false);
                return;
            }
            //  Debug.Log("It is here it is set to false");
            m_IsUpdatingPosition = false;
            RoomTransition       = null;
            freezeCharacter.SetFrozen(false, false, false);
        }
    }