Example #1
0
    public void CheckDestroy()
    {
        PlayerBoardPiece player = board.GetPlayerBoardPiece();

        /* Ressurect this if we want to have true fog of war reveal rather than vision
         * if (Mathf.Abs(player.x - x) < 3)
         *  Destroy(gameObject);
         * else if (Mathf.Abs(player.y - y) < 3)
         *  Destroy(gameObject);
         */
        if (Mathf.Abs(player.x - x) < 3)
        {
            spr.enabled = false;
        }
        else
        {
            spr.enabled = true;
        }

        if (Mathf.Abs(player.y - y) < 3)
        {
            spr.enabled = false;
        }
        else
        {
            spr.enabled = true;
        }
    }
Example #2
0
    private BoardPiece createPlayer(int rowNum, int colCount, List <int> prams)
    {
        //TOD PARAMs
        PlayerBoardPiece newPlayer = Instantiate(ResourceLoader.instance.playerBoardPieceFab)
                                     .GetComponent <PlayerBoardPiece>();

        newPlayer.SetBoard(curBoard);
        curBoard.AddPiece(newPlayer, colCount, rowNum);
        return(newPlayer);
    }
Example #3
0
    void Start()
    {
        if (levelLoader == null)
        {
            Debug.LogError("You didn't add a level loader component to the BoardManager. Hope you enjoy blank levels!");
        }
        if (levelList == null || levelList.Count == 0)
        {
            Debug.LogError("No levels provided in the levelList");
        }

        tileSize = ResourceLoader.instance.defaultBlockFab.GetComponent <SpriteRenderer>().size.x;
        loadlevel(PermanentStatManager.instance.currentLevel);

        boardTitleText = GameObject.Find("BoardTitle").GetComponent <Text>();

        List <PlayerBoardPiece> playas = new List <PlayerBoardPiece>();

        foreach (Board board in activeBoards)
        {
            PlayerBoardPiece pbp = board.GetPlayerBoardPiece();
            if (pbp != null)
            {
                playas.Add(pbp);
            }
            if (board.boardTitle != null && board.boardTitle.Length > 0)
            {
                boardTitleText.text = board.boardTitle;

                // Generate tutorial if board matches exact title. WARNING: Fragile! Make sure level title matches these strings exactly!
                if (board.boardTitle.Trim().Equals("Tutorial 1/3: Getting Hitched"))
                {
                    SetTutorialText("-Bump into the girl to start a new life\r\n\r\n-WASD/arrows to move\r\n\r\n-You will die after a certain amount of years pass, plan your life carefully!");
                }
                else if (board.boardTitle.Trim().Equals("Tutorial 2/3: Cheating Death"))
                {
                    SetTutorialText("-You must juggle multiple aspects of your life to succeed\r\n\r\n-Extend your lifespan by collecting pills in the HEALTH board\r\n\r\n-Pills are more effective later in life, so try to save them for your later years");
                }
                else if (board.boardTitle.Trim().Equals("Tutorial 3/3: I Don't Want No Scrubs"))
                {
                    SetTutorialText("-Some girls have higher standards and you'll need an education to even get near them\r\n\r\n-Collect money in the WEALTH board\r\n\r\n-Purchase 3 books in the KNOWLEDGE board to unlock a zone (books cost $100 each)");
                }
                else if (board.boardTitle.Trim().Equals("So you want to play a game"))
                {
                    //SetTutorialText("-Some girls have higher standards and you'll need an education to even get near them\r\n\r\n-Collect money in the WEALTH board (bigger stacks are worth more)\r\n\r\n-Purchase 3 books in the KNOWLEDGE board to unlock a zone\r\n\r\n-Books cost $100 each");
                }
            }
        }

        // Need to create board before player.
        PlayerController.instance.Init(playas);
    }
Example #4
0
    public void PruneFog()
    {
        PlayerBoardPiece player = GetPlayerBoardPiece();

        if (player != null)
        {
            foreach (BoardPiece piece in boardPieces)
            {
                /* Ressurect this if we want to have true fog of war reveal rather than vision
                 * if (Mathf.Abs(player.x - x) < 3)
                 * {
                 *  Destroy(gameObject);
                 * }
                 * else if (Mathf.Abs(player.y - y) < 3)
                 * {
                 *  Destroy(gameObject);
                 * }
                 */

                SpriteRenderer fogSprite = piece.GetFogSprite();
                if (fogSprite == null)
                {
                    continue;
                }

                if (Mathf.Abs(player.x - piece.x) < 3)
                {
                    fogSprite.enabled = false;
                }
                else
                {
                    fogSprite.enabled = true;
                }

                if (Mathf.Abs(player.y - piece.y) < 3)
                {
                    fogSprite.enabled = false;
                }
                else
                {
                    fogSprite.enabled = true;
                }
            }
        }
        else
        {
            Debug.LogError("No player found for some reason...");
        }
    }
Example #5
0
    private PlayerBoardPiece CreatePlayer()
    {
        PlayerBoardPiece newPlayer = Instantiate(ResourceLoader.instance.playerBoardPieceFab).GetComponent <PlayerBoardPiece>();

        return(newPlayer);
    }