예제 #1
0
    // Use this for initialization
    void Start()
    {
        QuestGenerator qg = QuestGenerator.Instance();

        Quest example;
        int   questType = Random.Range(0, 3);         // Example quest type

        if (questType == 0)
        {
            // Generate a knowledge quest
            example = qg.GetQuest("knowledge", 8);
        }
        else if (questType == 1)
        {
            // Generate a comfort quest
            example = qg.GetQuest("comfort", 8);
        }
        else
        {
            // Generate a justice quest
            example = qg.GetQuest("justice", 8);
        }

        // Render the quest nodes to the UI
        QuestRender qr = GetComponent <QuestRender> ();

        qr.DisplayQuest(example);

        // Read the quest and display the step
        QuestReader qReader = GetComponent <QuestReader> ();

        qReader.ReadQuest(example);
    }
예제 #2
0
    // Initializes the game
    void InitGame()
    {
        // Create the map
        map        = Instantiate(map, new Vector3(5.5f, 5.5f, 0), Quaternion.identity) as GameObject;
        mapManager = map.GetComponent <MapManager>();
        World.map  = mapManager;
        mapManager.SetupScene();

        //Set up the Quest generator
        questGen        = Instantiate(questGen) as GameObject;
        questGenManager = questGen.GetComponent <QuestGenerator>();
        questGenManager.Setup();
        questGenManager.setMap(mapManager);

        // Where are we on the map?
        Vector2 townCenter = mapManager.townCenter;
        Vector3 tile       = new Vector3(4, 4, 0); // Place on the road, where there are no objects

        // Create the player
        player        = Instantiate(player, new Vector3(tile.x, tile.y, 10f), Quaternion.identity) as GameObject;
        playerManager = player.GetComponent <Player>();
        playerManager.PlaceAt((int)townCenter.x, (int)townCenter.y, (int)tile.x, (int)tile.y);

        // Draw our area on the map
        mapManager.GetReferences();
        mapManager.Draw(playerManager.mapX, playerManager.mapY);

        World.player       = playerManager;
        World.textbox      = textManager;
        World.inventoryBox = inventoryManager;
    }
예제 #3
0
    /// <summary>
    /// Generates all quests for the game using <see cref="QuestGenerator.GenerateAllQuests"/>
    /// </summary>
    /// <param name="world"></param>
    /// <returns></returns>
    public List <Quest> GenerateQuests(World world)
    {
        //Creates new instance of quest generator and use it to generate all the quests
        QuestGenerator questGen = new QuestGenerator(world);

        return(questGen.GenerateAllQuests());
    }
예제 #4
0
    public void Initialize(ItemData item)
    {
        QuestGenerator qg = QuestGenerator.Instance();

        List <List <string> > patterns = new List <List <string> > ();

        patterns.Add(new List <string> {
        });
        patterns.Add(new List <string> {
            "kill", "loot"
        });


        foreach (string act in patterns[Random.Range(0, patterns.Count)])
        {
            if (act == "goto")
            {
                subActions.Add(new Goto(qg.GetLocation()));
            }
            else if (act == "loot")
            {
                subActions.Add(new Loot(item));
            }
            else if (act == "kill")
            {
                subActions.Add(new Kill(qg.GetEnemy(item)));
            }
        }
    }
예제 #5
0
    public static QuestGenerator Instance()
    {
        if (instance == null)
        {
            instance = new QuestGenerator();
        }

        return(instance);
    }
예제 #6
0
    public void GenerateQuests()
    {
        var            curDay = StaticData.maxDays - DaysLeft;
        QuestGenerator QG     = new QuestGenerator(curDay, (int)GlobalReputation, RandomSeed);

        if (AvailableQuests == null)
        {
            AvailableQuests = new List <IQuest>();
        }

        for (int i = 0; i < QueueLength; i++)
        {
            AvailableQuests.Add(QG.GenerateMultiQuest());
        }
    }
예제 #7
0
    // Start is called before the first frame update
    void Start()
    {
        var testPart = new Part();

        var testBody = new Body();
        // testBody.Slots[0].AssignedPart = testPart;


        var testParty = new Party();

        testParty.Bodies.Add(testBody);
        var qg = new QuestGenerator();

        var test = qg.GenerateQuest(10);

        Debug.Log(test.Description);
        var result = test.GetResult(testParty);

        Debug.Log(result.Gold.ToString());
    }
예제 #8
0
    public void Initialize(ItemData item, EnemyData enemy)
    {
        QuestGenerator qg = QuestGenerator.Instance();

        List <List <string> > patterns = new List <List <string> > ();

        patterns.Add(new List <string> {
            "goto"
        });
        patterns.Add(new List <string> {
        });

        foreach (string act in patterns[Random.Range(0, patterns.Count)])
        {
            if (act == "goto")
            {
                subActions.Add(new Goto(enemy.location));
            }
        }
    }
예제 #9
0
    public void Initialize(EnemyData enemy)
    {
        QuestGenerator qg = QuestGenerator.Instance();

        List <List <string> > patterns = new List <List <string> > ();

        patterns.Add(new List <string> {
            "listen"
        });
        patterns.Add(new List <string> {
        });

        foreach (string act in patterns[Random.Range(0, patterns.Count)])
        {
            if (act == "listen")
            {
                subActions.Add(new Listen(enemy));
            }
        }
    }
예제 #10
0
    public void Initialize(LocationData about)
    {
        QuestGenerator qg = QuestGenerator.Instance();

        List <List <string> > patterns = new List <List <string> > ();

        patterns.Add(new List <string> {
            "kill", "loot", "use"
        });
        patterns.Add(new List <string> {
            "get", "use"
        });
        patterns.Add(new List <string> {
            "listen"
        });

        List <string> pattern = patterns [Random.Range(0, patterns.Count)];

        this.subActions = qg.assignActions(pattern);
    }
예제 #11
0
        private void OnQuestEventTimerComplete()
        {
            m_QuestEventTimeTracker.OnTimerCompleted -= OnQuestEventTimerComplete;

            QuestEventData eventData  = m_QuestEventDataList[m_CurrentQuestEventData];
            bool           spawnQuest = UnityEngine.Random.Range(0, 101) < eventData.chance;

            if (spawnQuest)
            {
                for (int i = 0; i < eventData.questCount; i++)
                {
                    QuestInstance   quest   = QuestGenerator.GenerateQuest(1, m_QuestMakeupRandom.GetRandomValue());
                    FactionInstance faction = ServiceLocator.AllegianceService.Factions.GetRandom();
                    ServiceLocator.QuestService.RegisterQuest(quest, faction);
                }
                m_CurrentQuestEventData = -1;
            }

            StartNextQuestEvent();
        }
예제 #12
0
        public static void InitializeServices(GameSetupData data)
        {
            //Factions and heroes
            for (int i = 0; i < data.factionCount; i++)
            {
                FactionInstance faction = FactionGenerator.GenerateFaction();
                foreach (HeroType heroType in Enum.GetValues(typeof(HeroType)))
                {
                    HeroInstance hero = HeroGenerator.GenerateHero(1, heroType);
                    ServiceLocator.AllegianceService.SetHeroAllegiance(hero, faction);
                }

                /*for (int h = 0; h < Random.Range(data.heroesPerFactionMin, data.heroesPerFactionMax + 1); h++) {
                 *      HeroInstance hero = HeroGenerator.GenerateHero(1);
                 *      ServiceLocator.AllegianceService.SetHeroAllegiance(hero, faction);
                 * }*/

                for (int q = 0; q < data.startQuests; q++)
                {
                    QuestInstance quest = QuestGenerator.GenerateQuest(1, QuestMakeupType.SOLO);
                    ServiceLocator.QuestService.RegisterQuest(quest, faction);
                }
            }
        }
예제 #13
0
 public void GenerateQuests()
 {
     Quests         = QuestGenerator.GenerateQuests(DarkestDungeonManager.Campaign);
     AreQuestsReady = false;
 }
 private void Awake()
 {
     g = FindObjectOfType <QuestGenerator>();
 }
예제 #15
0
 public void Start()
 {
     qGenerator = GetComponent <QuestGenerator>();
 }
예제 #16
0
 public void SubscribeToEvent(QuestGenerator g)
 {
     generator = g;
 }
예제 #17
0
    // Initializes the game
    void InitGame()
    {
        // Create the map
        map = Instantiate(map, new Vector3(5.5f, 5.5f, 0), Quaternion.identity) as GameObject;
        mapManager = map.GetComponent<MapManager>();
        World.map = mapManager;
        mapManager.SetupScene();

		//Set up the Quest generator
        questGen = Instantiate(questGen) as GameObject;
        questGenManager = questGen.GetComponent<QuestGenerator>();
        questGenManager.Setup();
        questGenManager.setMap(mapManager);

        // Where are we on the map?
        Vector2 townCenter = mapManager.townCenter;
        Vector3 tile = new Vector3(4, 4, 0); // Place on the road, where there are no objects

        // Create the player
        player = Instantiate(player, new Vector3(tile.x, tile.y, 10f), Quaternion.identity) as GameObject;
        playerManager = player.GetComponent<Player>();
        playerManager.PlaceAt((int)townCenter.x, (int)townCenter.y, (int)tile.x, (int)tile.y);

        // Draw our area on the map
        mapManager.GetReferences();
        mapManager.Draw(playerManager.mapX, playerManager.mapY);

        World.player = playerManager;
        World.textbox = textManager;
        World.inventoryBox = inventoryManager;
    }