Example #1
0
    // Start is called before the first frame update
    void Start()
    {
        CardDatabase.LoadAllCards();
        GearDatabase.LoadAllGear();

        allTemplates = new List <EncounterTemplate>(Resources.LoadAll <EncounterTemplate>("EncounterTemplates"));

        GameplayContext.InDebugMode = false;

        heightOfLevels = MaxNodesPerLevel * paddingWithinLevel;

        ClearLevel();

        if (GameplayContext.OverworldMap == null || GameplayContext.RequestReset)
        {
            GenerateMap();
            SetPlayerAt(allLevels[0][0]);
            GameplayContext.OverworldMap      = MapToAbstract();
            GameplayContext.CurrentDifficulty = 2; //only set the first time
            GameplayContext.RequestReset      = false;
        }
        else
        {
            AbstractToMap(GameplayContext.OverworldMap);
        }
    }
    void Start()
    {
        CardDatabase.LoadAllCards();
        GearDatabase.LoadAllGear();

        if (GameplayContext.CurrentInventory is null || GameplayContext.RequestReset)
        {
            playerInventory = new InventoryCollection();
            //two legs
            playerInventory.AddItem(GearDatabase.GetGearDataByID(0));
            playerInventory.AddItem(GearDatabase.GetGearDataByID(0));
            //two melee arm
            playerInventory.AddItem(GearDatabase.GetGearDataByID(1), 2);
            //two rifle arm
            playerInventory.AddItem(GearDatabase.GetGearDataByID(3), 2);
            GameplayContext.CurrentInventory = playerInventory;
            Debug.Log("made new inventory");
        }
Example #3
0
    // Start is called before the first frame update
    void Start()
    {
        FXHelper.Initialize();

        ColorUtility.TryParseHtmlString("#793434", out Color col);
        enemyHealthBar.Colour = col;

        stateStack = new Stack <GameState>();
        stateStack.Push(GameState.PlayerIdle);

        if (worldGrid == null)
        {
            worldGrid = GameObject.FindObjectOfType <HexGrid>();
        }
        worldGrid.GenerateMap(mapRadius);
        entFactory = EntityFactory.GetFactory;

        allEntities         = new List <Entity>();
        allEnemies          = new List <Entity>();
        enemiesWhoNeedTurns = new List <Entity>();
        entitiesToClean     = new List <Entity>();

        if (GameplayContext.ChosenTemplate != null)
        {
            GenerateEncounter(GameplayContext.ChosenTemplate);
        }
        else
        {
            GenerateEncounter(defaultEncounterTemplate);
        }

        GameplayContext.InitializeForEncounter(this, player, worldGrid, interfaceManager);

        if (GameplayContext.CurrentLoadout != null)
        {
            basicDeck = GameplayContext.CurrentLoadout.ToDeckTemplate();
        }
        else
        {
            //fudge a deck together so we can start on the combat scene without crashing
            CardDatabase.LoadAllCards();
            basicDeck = new DeckTemplate();
            basicDeck.AddCardID(CardDatabase.GetCardDataByName("Shoot").cardID, 6);
            basicDeck.AddCardID(CardDatabase.GetCardDataByName("Step").cardID, 4);
        }

        if (!GearDatabase.IsLoaded)
        {
            GearDatabase.LoadAllGear();
        }

        drawPile = basicDeck.ConvertToDeck();
        drawPile.PrintContents("drawpile");

        allExistingCards = new List <Card>();
        foreach (Card c in drawPile)
        {
            allExistingCards.Add(c);
        }

        discardPile = new Deck();
        playerHand  = new List <Card>();

        drawPile.Shuffle();

        energy = 5;

        if (!GameplayContext.InDebugMode)
        {
            GameObject endbutton = GameObject.Find("EndGameButton");
            endbutton.SetActive(false);
        }


        Invoke("StartNewTurn", 0.2f);
    }