Exemplo n.º 1
0
    // TODO: pool action fields
    private void SpawnActionFields()
    {
        BoardGenerator board = GameController.Instance.board;

        for (int i = 0; i < BoardGenerator.GridSize; ++i)
        {
            for (int j = 0; j < BoardGenerator.GridSize; ++j)
            {
                FieldScript targetField = board.GetField(i, j);
                if (CheckMovement(targetField))
                {
                    GameObject  go;
                    ActionField af;
                    if (!targetField.occupied)
                    {
                        go = Instantiate(moveFieldPrefab);
                        af = go.GetComponent <MoveField>();
                    }
                    else
                    {
                        go = Instantiate(attackFieldPrefab);
                        af = go.GetComponent <AttackField>();
                    }

                    af.Set(this, targetField);
                    actionFields.Add(af);
                }
            }
        }
    }