Ejemplo n.º 1
0
    //Locates the next number on the config list
    //Creates a prefab tile of that value, in the position from the array
    public void SetUpTiles()
    {
        int zeroadj = 1;

        for (int i = 0; i < 9; ++i)
        {
            int tileVal = config[i];
            if (tileVal > 0)
            {
                GameObject newTile       = Instantiate(prefabTiles[tileVal - zeroadj], availableTilePos[i], Quaternion.identity) as GameObject;
                TileScript newTileScript = newTile.GetComponent <TileScript>();
                newTileScript.Init(this.gameObject);
                myTiles.Add(newTile);
            }
        }
    }
//Start
    // Use this for initialization
    void Start()
    {
        gameState         = GameState.Overworld;
        randomEcountersOn = true;//Depending on the area. Maybe a scene database indicating whether true or false?.

        //Initialization of Objects
        cam_T = GameObject.FindGameObjectWithTag("CamTarget").GetComponent <Transform>();

        playerController = GameObject.FindGameObjectWithTag("Player").GetComponent <OWPlayerController>();
        battleUI         = GameObject.FindGameObjectWithTag("UI").GetComponent <BattleUI>();

        soundPlayer = gameObject.GetComponent <SoundPlayer>();
        tileScript  = GameObject.FindGameObjectWithTag("TileManager").GetComponent <TileScript>();
        tileScript.Init();
        battlefield = GameObject.FindGameObjectWithTag("Battlefield").GetComponent <Transform>();

        //Databases.
        charStats  = GetComponent <CharacterStats>();
        attackInfo = GetComponent <AttackInfoManager>();
        //General Info

        //Placeholder Character Creation
        charStats.CreateCharacterStats("Player", 0, 1, 10, 12, 5, 3, 2, 4);     //PLACHEOLDER;
        charStats.SetTileOccupied("Player", 0, new Vector2(3, 4), tileScript.yTiles);

        charStats.CreateCharacterStats("Enemy", 0, 4, 70, 12, 5, 3, 2, 4);     //PLACHEOLDER;
        charStats.SetTileOccupied("Enemy", 0, new Vector2(2, 2), tileScript.yTiles);

        //Create a cursor for Formation Movement
        GameObject objCursor;

        objCursor             = Instantiate(cursor);
        selectedTileIndicator = objCursor.GetComponent <Transform>();
        selectedTileIndicator.gameObject.SetActive(false);

        //For Movement Limit calculations
        tileVectorSize.x  = tileScript.xTiles;
        tileVectorSize.y  = tileScript.yTiles;
        tileAmount        = tileScript.tileAmount - 1;
        selectionLimit[0] = new Vector2(tileVectorSize.x / 2, 0);
        selectionLimit[1] = new Vector2(tileVectorSize.x, tileVectorSize.y);
        selectionLimit[2] = new Vector2(0, 0);
        selectionLimit[3] = new Vector2(tileVectorSize.x / 2, tileVectorSize.y);

        //MoveFormation(0, charControl[0].tile); //PLACEHOLDER
        battleUI.Init();
    }
Ejemplo n.º 3
0
    // Use this for initialization
    private void Start()
    {
        int        i, j;
        GameObject tileObject = Resources.Load("InGame/Tile", typeof(GameObject)) as GameObject;

        for (i = 0; i < MAX_ROW_COUNT; i++)
        {
            for (j = 0; j < MAX_COL_COUNT; j++)
            {
                GameObject tileObjectClone = (GameObject)Instantiate(tileObject);
                tileObjectClone.name = "Tile(" + i + "," + j + ")";
                TileScript tileScript = tileObjectClone.GetComponent <TileScript>();
                tileScript.Init(i, j, new TileStatus());

                mTiles[i, j] = tileScript;
            }
        }

        BlownUpStatus[,] blownUpStatusTemp = new BlownUpStatus[MAX_ROW_COUNT, MAX_COL_COUNT];
        BlownUpStatus.Construct(blownUpStatusTemp);

        while (CheckBlowUpTiles(blownUpStatusTemp))
        {
            for (i = 0; i < MAX_ROW_COUNT; i++)
            {
                for (j = 0; j < MAX_COL_COUNT; j++)
                {
                    mTiles[i, j].SetTile(new TileStatus());
                }
            }
        }

        mClickedTile       = null;
        mIsSwapEnable      = false;
        mIsReSwapNeeded    = false;
        mIsEnemyActionDone = false;
        mIsBlownThisTurn   = false;
        mTurn           = 0;
        mBlownTileCount = 0;
        mBaseMP         = 0;

        InGameUIManager.Instance.UpdateHP(UserManager.Instance.HP);
        InGameUIManager.Instance.UpdateMP(UserManager.Instance.MP);
        InGameUIManager.Instance.UpdateTurn(mTurn);
    }