コード例 #1
0
    /// <summary>
    /// Initialize the 'Target Practice' quest and add it to the Quest Manager
    /// </summary>
    private void InitializeTargetPracticeQuest()
    {
        // OBJECTIVE 1 - TRAVEL TO MOON
        ObjectiveTarget moon           = moonTravelObjective.AddComponent <ObjectiveTarget>();
        Objective       firstObjective = firstQuest.GetObjectiveAtIndex(0);

        firstObjective.AssignTarget(moon);

        // OBJECTIVE 2 - DEFEAT RAIDERS
        SpawnPrefabsForObjective(firstQuest, 1, enemyShipPrefab, 5, moonSpawnPoint.position, 50);

        // OBJECTIVE 3 - TRAVEL TO EARTH
        ObjectiveTarget earth          = earthTravelObjective.AddComponent <ObjectiveTarget>();
        Objective       thirdObjective = firstQuest.GetObjectiveAtIndex(2);

        thirdObjective.AssignTarget(earth);
        // Setup spawn of enemies and friendlies so they only spawn when player reaches this objective
        thirdObjective.OnStarted += ThirdObjective_OnStarted;
        //TODO: unsubscribe to this!!!

        // OBJECTIVE 4 - AID IN THE FIGHT
        // AI only start battling when player approaches the area

        questManager.Add(firstQuest);
        questManager.SetActiveQuest(firstQuest);
    }