コード例 #1
0
    void Start()
    {
        SheetAssigner SA = FindObjectOfType <SheetAssigner>();

        moveJump = new Vector3(SA.gutterSizeX, SA.gutterSizeY, 0);
        Debug.Log(moveJump.x + ", " + moveJump.y);
    }
コード例 #2
0
    void Start()
    {
        SheetAssigner SA       = FindObjectOfType <SheetAssigner>();
        Vector2       tempJump = SA.roomDimensions + SA.gutterSize;

        moveJump = new Vector3(tempJump.x, tempJump.y, 0); //distance b/w rooms: to be used for movement
    }
コード例 #3
0
    public GameObject enter; //added
    void Start()
    {
        player = GameObject.FindGameObjectWithTag("Player");      //added
        enter  = GameObject.FindGameObjectWithTag("DoorTrigger"); //added
        SheetAssigner SA       = FindObjectOfType <SheetAssigner>();
        Vector2       tempJump = SA.roomDimensions + SA.gutterSize;

        moveJump = new Vector3(tempJump.x, tempJump.y, 0);         //distance b/w rooms: to be used for movement
    }
コード例 #4
0
    void Start()
    {
        isEnabled  = true;
        mainCamera = GameObject.Find("MainCamera");
        player     = GameObject.Find("Player");
        SheetAssigner SA       = FindObjectOfType <SheetAssigner>();
        Vector2       tempJump = SA.roomDimensions + SA.gutterSize;

        moveJump = new Vector3(tempJump.x, tempJump.y, 0); //distance b/w rooms: to be used for movement
    }
コード例 #5
0
    private void Start()
    {
        SheetAssigner SA       = FindObjectOfType <SheetAssigner>();
        Vector2       tempJump = SA.roomDimensions + SA.gutterSize;

        moveJump = new Vector3(tempJump.x, tempJump.y, 0); //distance b/w rooms: to be used for movement
        minX     = transform.position.x - SA.roomDimensions.x / 4 + 0.45f;
        maxX     = transform.position.x + SA.roomDimensions.x / 4 - 0.45f;
        minY     = transform.position.y - SA.roomDimensions.y / 4 + 0.3f;
        maxY     = transform.position.y + SA.roomDimensions.y / 4 - 0.3f;
    }
コード例 #6
0
    void Start()
    {
        SheetAssigner SA       = FindObjectOfType <SheetAssigner>(); //Find SheetAssigner that holds overall room information.
        Vector2       tempJump = SA.roomDimensions + SA.gutterSize;  //This makes sense; because all rooms are evenly spread out the room dimension + gutter should be just enough offset to move the camera one room in one of four directions.

        moveJump          = new Vector3(tempJump.x, tempJump.y, 0);  //distance b/w rooms: to be used for movement
        horMove           = 0.0f;
        vertMove          = 0.0f;
        movePosition      = transform.position;
        remainingMovement = Vector3.zero;
    }
コード例 #7
0
    public int dir = 0;                    //The door direction, meaning which side the door is on (UDLR)

    void OnTriggerEnter2D(Collider2D coll) //Detect when the player collides with the door.
    {
        if (coll.gameObject.tag != "Player")
        {
            return;
        }

        /*
         * switch (dir){
         *  case 1:
         *      Debug.Log("Top Door");
         *      break;
         *  case 2:
         *      Debug.Log("Bottom Door");
         *      break;
         *  case 3:
         *      Debug.Log("Left Door");
         *      break;
         *  case 4:
         *      Debug.Log("Right Door");
         *      break;
         *  default:
         *      Debug.Log("ERROR, door type not found");
         *      return;
         * }
         */
        GameObject.FindWithTag("MainCamera").GetComponent <CameraMovement>().MoveCameraOneRoom(dir); //Move the camera.

        SheetAssigner SA = FindObjectOfType <SheetAssigner>();                                       //Find SheetAssigner that holds overall room information.
        float         posOrNeg;
        Vector2       playerMove = Vector2.zero;

        //16*3 might overshoot a bit, but the overshoot amount should feel fairly trivial, but it's better than undershooting.
        //This is subject to change with the new graphics as they are in different dimensions.
        if (dir == 1 || dir == 2)
        {
            playerMove.y = SA.gutterSize.y + 16 * 3;//Move by 3 units further than it should be to ensure that the player will not collide with the door collider in the next room.
        }
        else
        {
            playerMove.x = SA.gutterSize.x + 16 * 3;
        }
        if (dir == 1 || dir == 4)
        {
            posOrNeg = 1.0f;
        }
        else
        {
            posOrNeg = -1.0f;
        }
        playerMove *= posOrNeg;
        GameObject.FindWithTag("Player").GetComponent <PlayerClass>().TeleportByAmount(playerMove);//This isn't named/set up correctly right now.
    }
コード例 #8
0
    // Use this for initialization
    void Start()
    {
        this.gameObject.tag = "ClosedDoor";
        this.gameObject.GetComponent <BoxCollider2D>().isTrigger = false;


        SheetAssigner SA       = FindObjectOfType <SheetAssigner>();
        Vector2       tempJump = SA.roomDimensions + SA.gutterSize;

        moveJump = new Vector3(tempJump.x, tempJump.y, 0); //distance b/w rooms: to be used for movement

        playerMoveJump = new Vector3(tempJump.x - (14 * 16), tempJump.y - (6 * 16), 0);
    }
コード例 #9
0
ファイル: RoomTp.cs プロジェクト: Kyeiv/IsaacLikeGame2D
    private IEnumerator OnTriggerEnter2D(Collider2D other)
    {
        //  if (other == other.gameObject.GetComponent<PolygonCollider2D>())
        //   {
        Debug.Log("COLLIDED" + Time.time);
            if (other.gameObject.CompareTag("Player"))
            {

                other.attachedRigidbody.constraints = RigidbodyConstraints2D.FreezePosition | RigidbodyConstraints2D.FreezeRotation;

                ScreenFader sf = GameObject.FindGameObjectWithTag("Fader").GetComponent<ScreenFader>();

                yield return StartCoroutine(sf.FadeToBlack());

                other.gameObject.transform.position += new Vector3(shift.x, shift.y, 0f);

                Camera mycam = GameObject.FindGameObjectWithTag("MainCamera").GetComponent<Camera>();

                SheetAssigner SA = FindObjectOfType<SheetAssigner>();
                Vector2 tempJump = SA.roomDimensions + SA.gutterSize;
                Vector3 moveJump = new Vector3(tempJump.x, tempJump.y, 0); //distance b/w rooms: to be used for movement


                horMove = System.Math.Sign(shift.x);//capture input
                vertMove = System.Math.Sign(shift.y);
                Vector3 tempPos = mycam.transform.position;
                tempPos += Vector3.right * horMove * moveJump.x; //jump bnetween rooms 
                tempPos += Vector3.up * vertMove * moveJump.y;

                mycam.transform.position = new Vector3(tempPos.x, tempPos.y, mycam.transform.position.z);

                GameObject pos = GameObject.FindGameObjectWithTag("pos");
                RectTransform rect = pos.GetComponent<RectTransform>();
                // Vector3 rectPosition = rect.position;
                rect.position += new Vector3(shift.x / 4.2f, shift.y / 4.8f, 0f);

                yield return StartCoroutine(sf.FadeToClear());

            other.attachedRigidbody.constraints = RigidbodyConstraints2D.FreezeRotation;

            }
        }