Esempio n. 1
0
    // Update is called once per frame
    void Update()
    {
        //Logic to control the player depth
        //If we're on an invisible platform, move to a physical platform, this comes in handy to make rotating possible
        //Try to move us to the closest platform to the camera, will help when rotating to feel more natural
        //If we changed anything, update our level data which pertains to our inviscubes
        FacingDirection tryRotateDirection;


        //Handle Player input for rotation command

        // DONT PUT FLOOR UNDER A WALL
        if ((Input.GetKeyDown(KeyCode.W) && Player.GetComponent <SpriteRenderer>().flipX) || (Input.GetKeyDown(KeyCode.S) && !Player.GetComponent <SpriteRenderer>().flipX))
        {
            tryRotateDirection = RotateDirectionLeft();
            if (fezMove.UpdateToFacingDirection(tryRotateDirection, degree + 90f, Level, WorldUnits))
            {
                facingDirection = tryRotateDirection;
                degree         += 90f;
            }
        }
        else if ((Input.GetKeyDown(KeyCode.W) && !Player.GetComponent <SpriteRenderer>().flipX) || (Input.GetKeyDown(KeyCode.S) && Player.GetComponent <SpriteRenderer>().flipX))
        {
            tryRotateDirection = RotateDirectionRight();
            if (fezMove.UpdateToFacingDirection(tryRotateDirection, degree - 90f, Level, WorldUnits))
            {
                facingDirection = tryRotateDirection;
                degree         -= 90f;
            }
        }
        seeThroughBuilding(Player.transform.position);
    }
    // Update is called once per frame
    void Update()
    {
        //Logic to control the player depth
        //If we're on an invisible platform, move to a physical platform, this comes in handy to make rotating possible
        //Try to move us to the closest platform to the camera, will help when rotating to feel more natural
        //If we changed anything, update our level data which pertains to our inviscubes
        if (!fezMove._jumping)
        {
            bool updateData = false;
            if (OnInvisiblePlatform())
            {
                if (MovePlayerDepthToClosestPlatform())
                {
                    updateData = true;
                }
            }
            if (MoveToClosestPlatformToCamera())
            {
                updateData = true;
            }
            if (updateData)
            {
                UpdateLevelData(false);
            }
        }


        //Handle Player input for rotation command
        if (Input.GetKeyDown(KeyCode.RightArrow))
        {
            //If we rotate while on an invisible platform we must move to a physical platform
            //If we don't, then we could be standing in mid air after the rotation
            if (OnInvisiblePlatform())
            {
                //MoveToClosestPlatform();
                MovePlayerDepthToClosestPlatform();
            }
            lastfacing      = facingDirection;
            facingDirection = RotateDirectionRight();
            degree         -= 90f;
            UpdateLevelData(false);
            fezMove.UpdateToFacingDirection(facingDirection, degree);
        }
        else if (Input.GetKeyDown(KeyCode.LeftArrow))
        {
            if (OnInvisiblePlatform())
            {
                //MoveToClosestPlatform();
                MovePlayerDepthToClosestPlatform();
            }
            lastfacing      = facingDirection;
            facingDirection = RotateDirectionLeft();
            degree         += 90f;
            UpdateLevelData(false);
            fezMove.UpdateToFacingDirection(facingDirection, degree);
        }
    }
Esempio n. 3
0
    // Update is called once per frame
    void Update()
    {
        fight_check = Combo.fightable;

        if (!fezMove._jumping)
        {
            bool updateData = false;
            if (OnInvisiblePlatform())
            {
                if (MovePlayerDepthToClosestPlatform())
                {
                    updateData = true;
                }
            }
            if (MoveToClosestPlatformToCamera())
            {
                updateData = true;
            }
            if (updateData)
            {
                UpdateLevelData(false);
            }
        }

        if (fight_check == 0)

        {
            /*
             * if (Input.GetKeyDown(KeyCode.RightArrow))
             * {
             *
             *  if (OnInvisiblePlatform())
             *  {
             *
             *      MovePlayerDepthToClosestPlatform();
             *
             *  }
             *
             *  lastfacing = facingDirection;
             *  facingDirection = RotateDirectionRight();
             *  degree -= 90f;
             *  UpdateLevelData(false);
             *  fezMove.UpdateToFacingDirection(facingDirection, degree);
             *
             * }
             * else if (Input.GetKeyDown(KeyCode.LeftArrow))
             * {
             *  if (OnInvisiblePlatform())
             *  {
             *      //MoveToClosestPlatform();
             *      MovePlayerDepthToClosestPlatform();
             *
             *  }
             *  lastfacing = facingDirection;
             *  facingDirection = RotateDirectionLeft();
             *  degree += 90f;
             *  UpdateLevelData(false);
             *  fezMove.UpdateToFacingDirection(facingDirection, degree);
             *
             * }
             *
             */
            //JoystickButton5 || JoystickButton14
            if (Input.GetKeyDown(KeyCode.JoystickButton5))
            {
                //If we rotate while on an invisible platform we must move to a physical platform
                //If we don't, then we could be standing in mid air after the rotation
                if (OnInvisiblePlatform())
                {
                    //MoveToClosestPlatform();
                    MovePlayerDepthToClosestPlatform();
                }
                lastfacing      = facingDirection;
                facingDirection = RotateDirectionRight();
                degree         -= 90f;
                UpdateLevelData(false);
                fezMove.UpdateToFacingDirection(facingDirection, degree);

                audio.Play();
            }
            //JoystickButton4 || JoystickButton13
            else if (Input.GetKeyDown(KeyCode.Joystick1Button4))
            {
                if (OnInvisiblePlatform())
                {
                    //MoveToClosestPlatform();
                    MovePlayerDepthToClosestPlatform();
                }
                lastfacing      = facingDirection;
                facingDirection = RotateDirectionLeft();
                degree         += 90f;
                UpdateLevelData(false);
                fezMove.UpdateToFacingDirection(facingDirection, degree);

                audio.Play();
            }
        }
    }