Esempio n. 1
0
    public void setHero2D(bool b)
    {
        if (b)
        {
            if (facingRight)
            {
                Hero2D.SetActive(true);
            }
            else
            {
                Hero2DInverse.SetActive(true);
            }

            HeroTiltedRight.SetActive(false);
            HeroTiltedLeft.SetActive(false);
            HeroTiltedRightBackwards.SetActive(false);
            HeroTiltedLeftBackwards.SetActive(false);

            InvertedDragonTiltedLeft.SetActive(false);
            InvertedDragonTiltedRight.SetActive(false);
            InvertedDragonTiltedLeftBackwards.SetActive(false);
            InvertedDragonTiltedRightBackwards.SetActive(false);
        }
        else
        {
            GameObject.FindGameObjectWithTag("Player").transform.position = original3DPosition;

            Hero2D.SetActive(false);
            Hero2DInverse.SetActive(false);
            if (facingRight)
            {
                setHeroDirection(0);
            }
            else
            {
                setHeroDirection(2);
            }
        }
    }
Esempio n. 2
0
    /**
     * @params: dir
     *  0 = tilted right (or left in inverse)
     *  1 = tilted left
     *  2 = tilted right (from camera perspective) backwards
     *  3 = tilted left (from camera perspective) backwards
     **/
    public void setHeroDirection(int dir)
    {
        Hero2D.SetActive(false);
        Hero2DInverse.SetActive(false);

        if (GameObject.FindGameObjectWithTag("Player").
            GetComponent <GameLogic> ().Camera3D.GetComponent <PlayerTracker> ().dir == 1)
        {
            if (dir == 0)
            {
                tiltedtoCamIn3D = true;
                facingBackwards = false;
                HeroTiltedRight.SetActive(true);
                HeroTiltedLeft.SetActive(false);
                HeroTiltedRightBackwards.SetActive(false);
                HeroTiltedLeftBackwards.SetActive(false);
            }
            else if (dir == 1)
            {
                tiltedtoCamIn3D = false;
                facingBackwards = false;
                HeroTiltedRight.SetActive(false);
                HeroTiltedLeft.SetActive(true);
                HeroTiltedRightBackwards.SetActive(false);
                HeroTiltedLeftBackwards.SetActive(false);
            }
            else if (dir == 2)
            {
                facingBackwards = true;
                tiltedtoCamIn3D = true;
                HeroTiltedRight.SetActive(false);
                HeroTiltedLeft.SetActive(false);
                HeroTiltedRightBackwards.SetActive(true);
                HeroTiltedLeftBackwards.SetActive(false);
            }
            else if (dir == 3)
            {
                facingBackwards = true;
                tiltedtoCamIn3D = false;
                HeroTiltedRight.SetActive(false);
                HeroTiltedLeft.SetActive(false);
                HeroTiltedRightBackwards.SetActive(false);
                HeroTiltedLeftBackwards.SetActive(true);
            }
        }
        else if (GameObject.FindGameObjectWithTag("Player").
                 GetComponent <GameLogic> ().Camera3D.GetComponent <PlayerTracker> ().dir == -1)
        {
            if (dir == 0)
            {
                tiltedtoCamIn3D = true;
                facingBackwards = false;

                InvertedDragonTiltedLeft.SetActive(false);
                InvertedDragonTiltedRight.SetActive(false);
                InvertedDragonTiltedLeftBackwards.SetActive(true);
                InvertedDragonTiltedRightBackwards.SetActive(false);

                HeroTiltedRight.SetActive(false);
                HeroTiltedLeft.SetActive(false);
                HeroTiltedRightBackwards.SetActive(false);
                HeroTiltedLeftBackwards.SetActive(false);
            }
            else if (dir == 1)
            {
                tiltedtoCamIn3D = false;
                facingBackwards = false;

                InvertedDragonTiltedLeft.SetActive(false);
                InvertedDragonTiltedRight.SetActive(false);
                InvertedDragonTiltedLeftBackwards.SetActive(false);
                InvertedDragonTiltedRightBackwards.SetActive(true);

                HeroTiltedRight.SetActive(false);
                HeroTiltedLeft.SetActive(false);
                HeroTiltedRightBackwards.SetActive(false);
                HeroTiltedLeftBackwards.SetActive(false);
            }
            else if (dir == 2)
            {
                facingBackwards = true;
                tiltedtoCamIn3D = true;

                InvertedDragonTiltedLeft.SetActive(true);
                InvertedDragonTiltedRight.SetActive(false);
                InvertedDragonTiltedLeftBackwards.SetActive(false);
                InvertedDragonTiltedRightBackwards.SetActive(false);

                HeroTiltedRight.SetActive(false);
                HeroTiltedLeft.SetActive(false);
                HeroTiltedRightBackwards.SetActive(false);
                HeroTiltedLeftBackwards.SetActive(false);
            }
            else if (dir == 3)
            {
                facingBackwards = true;
                tiltedtoCamIn3D = false;

                InvertedDragonTiltedLeft.SetActive(false);
                InvertedDragonTiltedRight.SetActive(true);
                InvertedDragonTiltedLeftBackwards.SetActive(false);
                InvertedDragonTiltedRightBackwards.SetActive(false);

                HeroTiltedRight.SetActive(false);
                HeroTiltedLeft.SetActive(false);
                HeroTiltedRightBackwards.SetActive(false);
                HeroTiltedLeftBackwards.SetActive(false);
            }
        }
    }