Exemplo n.º 1
0
    //Initialize Objective References
    void InitializeObjectiveReferences()
    {
        int totalNumberOfObjectives = 2;

        objectives = new ObjectiveReference[totalNumberOfObjectives];
        //Set objective references
        for (int i = 0; i < totalNumberOfObjectives; i++)
        {
            objectives[i] = new ObjectiveReference(transform.Find("Objective " + (i + 1)));
            objectives [i].Reset();
        }
        //Set the button reference.
        continueToNextLevel = transform.Find("Level Continue").Find("Button").GetComponent <Button> ();
        continueToNextLevel.interactable = false;

        //Set initial values.
        switch (CurrentLevelVariableManagement.GetMainGameData().currentLevel)
        {
        case 0:
            objectives [0].icon.sprite      = ResourceDatabase.GetItemByParameter("Subsidiary Reactor Core").itemIcon;
            objectives [0].description.text = "Subsidiary Reactor Core";

            objectives [1].icon.sprite      = ResourceDatabase.GetItemByParameter("Wooden Pickaxe").itemIcon;
            objectives [1].description.text = "Pickaxe";
            break;

        default:
            Debug.LogError("The current level has not been added in ObjectiveManager!");
            break;
        }
    }
Exemplo n.º 2
0
 public override void NPCActionAfterSpeaking()
 {
     //When the NPC has finished speaking to the player.
     if (talkedToPlayer == false)
     {
         talkedToPlayer = true;
         playerInventory.AssignNewItemToBestSlot(new ResourceReferenceWithStack(ResourceDatabase.GetItemByParameter("Wooden Pickaxe"), 1));
     }
 }
Exemplo n.º 3
0
    //Initialize Purchase Panel Manager.
    void InitializePurchasePanelManager()
    {
        Transform purchasePanelsTransform = transform;

        purchasePanels = new PurchasePanelReference[purchasePanelsTransform.childCount];
        for (int i = 0; i < purchasePanelsTransform.childCount; i++)
        {
            //Define purchase panel.
            purchasePanels[i] = purchasePanelsTransform.GetChild(i).GetComponent <PurchasePanelReference> ();

            //Initialize purchase panel.
            purchasePanels [i].DefinePanelItem(
                new ResourceReferenceWithStack(ResourceDatabase.GetItemByParameter("Wooden Sword"), 1), //Item
                25                                                                                      //Cost
                );
        }
    }
Exemplo n.º 4
0
    public override void NPCActionAfterSpeaking()
    {
        if (gavePlayerInstructions == false)
        {
            playerInventory.AssignNewItemToBestSlot(new ResourceReferenceWithStack(ResourceDatabase.GetItemByParameter("Wooden Hatchet"), 1));
            gavePlayerInstructions = true;
        }

        if (tookApples && completedStoryRole == false)
        {
            string[] newDialogue = new string[] {
                "If you walk over the hills, you should see a small town.",
                "Use some of the money I gave you to buy some new stuff!"
            };
            GetComponent <NPCPanelController> ().SetCharacterDialogue(newDialogue);
            completedStoryRole = true;
        }
    }
Exemplo n.º 5
0
    protected override void MakeReferences()
    {
        DropReferenceClass woodDrop   = new DropReferenceClass(ResourceDatabase.GetItemByParameter("Wood"), 1, 1, 1);
        DropReferenceClass appleDrop  = new DropReferenceClass(ResourceDatabase.GetItemByParameter("Apple"), 1, 2, 2);
        DropReferenceClass sproutDrop = new DropReferenceClass(ResourceDatabase.GetItemByParameter("Sprout"), 1, 1, 4);

        drops = new DropReferenceClass[] { woodDrop, appleDrop, sproutDrop };

        top      = transform.Find("Top").GetComponent <SpriteRenderer> ();
        segment1 = transform.Find("Segment 1").GetComponent <SpriteRenderer> ();
        segment2 = transform.Find("Segment 2").GetComponent <SpriteRenderer> ();
        segment3 = transform.Find("Segment 3").GetComponent <SpriteRenderer> ();
        segment4 = transform.Find("Segment 4").GetComponent <SpriteRenderer> ();
        segment5 = transform.Find("Segment 5").GetComponent <SpriteRenderer> ();

        currentlyActiveSegments = Random.Range(1, 6);

        spriteToUseForTreeTop = Random.Range(0, treeTypes [treeType].topTreeSprite.Length);

        UpdateTree();
    }
Exemplo n.º 6
0
    protected override void MakeReferences()
    {
        base.MakeReferences();

        experienceToDrop = 1;

        attachedSpriteRenderer = GetComponent <SpriteRenderer> ();

        if (possibleImages.Length != 0)
        {
            attachedSpriteRenderer.sprite = possibleImages [Random.Range(0, possibleImages.Length)];
        }
        else
        {
            Debug.LogError("No attached image sprites on " + gameObject.name + " (OreScript)");
            Destroy(gameObject);
        }

        DropReferenceClass oreDrop = new DropReferenceClass(ResourceDatabase.GetItemByParameter(ResourceReference.ItemType.Ore, typeOfOre), 1, 1, 1);

        drops = new DropReferenceClass[] { oreDrop };
    }
Exemplo n.º 7
0
 protected virtual void MakeReferences()
 {
     expDrop  = new DropReferenceClass(ResourceDatabase.GetItemByParameter("ExpNodule"), 1, 1, 1);
     coinDrop = new DropReferenceClass(ResourceDatabase.GetItemByParameter("Coin"), 1, 1, 1);
 }
Exemplo n.º 8
0
 public override void NPCActionBeforeSpeaking()
 {
     if (gavePlayerInstructions && tookApples == false)
     {
         SlotScript slotWithContent = playerInventory.CheckForCertainInventoryItem(new ResourceReferenceWithStack(ResourceDatabase.GetItemByParameter("Apple"), 6));
         if (slotWithContent != null)
         {
             slotWithContent.ModifyCurrentItemStack(-6);
             Debug.Log("Player had required items");
             string[] newDialogue = new string[] {
                 "Thank you, young one!",
                 "I appreciate your help.",
                 "Here is a bit of money as a reward."
             };
             GetComponent <NPCPanelController> ().SetCharacterDialogue(newDialogue);
             GiveMoneyToPlayer(50);
             tookApples = true;
         }
     }
 }
Exemplo n.º 9
0
    public static void InitializeDatabase()
    {
        /******************************************* ITEMS *******************************************/
        //Tools
        masterItemList.Add(new ResourceReference(ResourceReference.ItemType.GameTool, "Wooden Sword", "A weak sword, but useful for survival.", 0, "Weapons/Wooden/WoodenSword/"));
        masterItemList.Add(new ResourceReference(ResourceReference.ItemType.GameTool, "Wooden Hatchet", "A weak axe made for strong choppers.", 1, "Weapons/Wooden/WoodenHatchet/"));
        masterItemList.Add(new ResourceReference(ResourceReference.ItemType.GameTool, "Wooden Pickaxe", "A weak axe to gather ore and rock.", 2, "Weapons/Wooden/WoodenPickaxe/"));
        masterItemList.Add(new ResourceReference(ResourceReference.ItemType.GameTool, "Wooden Bow", "A weak bow, useful for long range attacks.", 3, "Weapons/Wooden/WoodenBow/"));
        masterItemList.Add(new ResourceReference(ResourceReference.ItemType.GameTool, "Diamond Sword", "A strong monster-chopping sword.", 4, "Weapons/Diamond/DiamondSword/"));
        masterItemList.Add(new ResourceReference(ResourceReference.ItemType.GameTool, "Spear", "A tough caveman implement", 5, "Weapons/Other/Spear/"));
        masterItemList.Add(new ResourceReference(ResourceReference.ItemType.GameTool, "Mace", "A weapon that strikes fear into the hearts of all", 6, "Weapons/Other/Mace/"));

        //Crafting materials
        masterItemList.Add(new ResourceReference(ResourceReference.ItemType.CraftingMaterial, "Wood", "A vital material for any player", 0, "Items/Wood/"));
        masterItemList.Add(new ResourceReference(ResourceReference.ItemType.CraftingMaterial, "Wood Plank", "A vital wood refinement", 1, "Items/Wood/"));

        //Ores
        masterItemList.Add(new ResourceReference(ResourceReference.ItemType.Ore, "Coal", "Useful for crafting arrow tips", 0, "Items/Ores/Coal/"));
        masterItemList.Add(new ResourceReference(ResourceReference.ItemType.Ore, "Diamond", "A tough material useful in epic battles", 1, "Items/Ores/Diamond/"));
        masterItemList.Add(new ResourceReference(ResourceReference.ItemType.Ore, "Emerald", "A pretty green gem", 2, "Items/Ores/Emerald/"));
        masterItemList.Add(new ResourceReference(ResourceReference.ItemType.Ore, "Gold", "A weak but easily enchantable item.", 3, "Items/Ores/Gold/"));
        masterItemList.Add(new ResourceReference(ResourceReference.ItemType.Ore, "Ruby", "A nice red gem", 4, "Items/Ores/Ruby/"));
        masterItemList.Add(new ResourceReference(ResourceReference.ItemType.Ore, "Silver", "A good material for strong weapons", 5, "Items/Ores/Silver/"));
        masterItemList.Add(new ResourceReference(ResourceReference.ItemType.Ore, "Iron", "A dull yet tough metal.", 6, "Items/Ores/Iron/"));

        //Food
        masterItemList.Add(new ResourceReference(ResourceReference.ItemType.Food, "Apple", "A yummy snack.", 0, "Items/Food/Apple/"));
        masterItemList.Add(new ResourceReference(ResourceReference.ItemType.Food, "Sprout", "The start of a new beginning", 1, "Items/Food/Sprout/"));

        //Ship Parts
        masterItemList.Add(new ResourceReference(ResourceReference.ItemType.ShipPart, "Subsidiary Reactor Core", "A required part of the time machine", 0, "Items/ShipParts/"));

        //Other
        masterItemList.Add(new ResourceReference(ResourceReference.ItemType.Other, "ExpNodule", "", 0, "Items/Other/ExpNodule/"));
        masterItemList.Add(new ResourceReference(ResourceReference.ItemType.Other, "Fire", "A life changing implement of cavemen", 1, "Items/Other/Fire/"));
        masterItemList.Add(new ResourceReference(ResourceReference.ItemType.Other, "Coin", "", 2, "Items/Other/Coin/"));

        /******************************************* RACES *******************************************/
        //Gatherer
        ResourceReferenceWithStack[] maceFighterInitialItems = new ResourceReferenceWithStack[] {
            new ResourceReferenceWithStack(ResourceDatabase.GetItemByParameter("Mace"), 1)
        };
        gameProfessions.Add(new Profession("Professions/Mace Fighter/", "Mace Fighter", 0, maceFighterInitialItems));

        //Hunter
        ResourceReferenceWithStack[] spearFighterInitialItems = new ResourceReferenceWithStack[] {
            new ResourceReferenceWithStack(GetItemByParameter("Spear"), 1)
        };
        gameProfessions.Add(new Profession("Professions/Spear Fighter/", "Spear Fighter", 1, spearFighterInitialItems));

        /******************************************* COMBINATIONS *******************************************/
        //Wooden Sword
        masterItemCombinationList.Add(new ItemCombination(new ResourceReferenceWithStack[] {
            new ResourceReferenceWithStack(ResourceDatabase.GetItemByParameter("Wood"), 1),
            new ResourceReferenceWithStack(ResourceDatabase.GetItemByParameter("Wood"), 1)
        },
                                                          new ResourceReferenceWithStack(ResourceDatabase.GetItemByParameter("Wood Plank"), 1)));

        //Diamond Sword
        masterItemCombinationList.Add(new ItemCombination(new ResourceReferenceWithStack[] {
            new ResourceReferenceWithStack(ResourceDatabase.GetItemByParameter("Wood Plank"), 3),
            new ResourceReferenceWithStack(ResourceDatabase.GetItemByParameter("Diamond"), 2)
        },
                                                          new ResourceReferenceWithStack(ResourceDatabase.GetItemByParameter("Diamond Sword"), 1)));

        //Fire
        masterItemCombinationList.Add(new ItemCombination(new ResourceReferenceWithStack[] {
            new ResourceReferenceWithStack(ResourceDatabase.GetItemByParameter("Wood"), 5),
            new ResourceReferenceWithStack(ResourceDatabase.GetItemByParameter("Coal"), 2)
        },
                                                          new ResourceReferenceWithStack(ResourceDatabase.GetItemByParameter("Fire"), 1)));
    }
Exemplo n.º 10
0
    //When a new item is added.
    public void OnNewItemAddedToPlayerInventory()
    {
        switch (CurrentLevelVariableManagement.GetMainGameData().currentLevel)
        {
        case 0:
            //Check to make sure the objective has not already been completed
            //Wooden Pickaxe Objective
            if (objectives [0].completed == false)
            {
                //Check whether the player has the hatchet.
                if (CurrentLevelVariableManagement.GetMainInventoryReference().GetComponent <InventoryFunctions> ().CheckForCertainInventoryItem(new ResourceReferenceWithStack(ResourceDatabase.GetItemByParameter("Wooden Pickaxe"), 1)) != null)
                {
                    OnObjectiveHasBeenCompleted(1);
                }
            }
//
//			//Wooden Sword Objective
//			if (objectives [3].completed == false) {
//				if (ModifiesSlotContent.DetermineWhetherPlayerHasCertainInventoryItem(new UISlotContentReference(ResourceDatabase.GetItemByParameter ("Wooden Pickaxe"), 1)) != null) {
//					OnObjectiveHasBeenCompleted(4);
//				}
//			}
            break;

        default:
            Debug.LogError("Objective Manager does not have a definition for this level!");
            break;
        }
    }
Exemplo n.º 11
0
    protected override void InitializeNPC()
    {
        //Find and hide the inventory.
        merchantInventory = CurrentLevelVariableManagement.GetLevelUIReference().transform.Find("Merchant Inventory").GetComponent <MerchantInventoryFunctions> ();

        //Define the UISlotContent items that will be added to the inventory.
        merchantItems     = new ResourceReferenceWithStackAndPrice[2];
        merchantItems [0] = new ResourceReferenceWithStackAndPrice(new ResourceReferenceWithStack(ResourceDatabase.GetItemByParameter("Wooden Hatchet"), 1), 10);
        merchantItems [1] = new ResourceReferenceWithStackAndPrice(new ResourceReferenceWithStack(ResourceDatabase.GetItemByParameter("Diamond Sword"), 2), 20);

        string[] dialogue = new string[] {
            "Purchase any item you like!",
            "Everything is cheap at Sluk's Hardware Store!"
        };
        GetComponent <NPCPanelController> ().SetCharacterDialogue(dialogue);
    }