Ejemplo n.º 1
0
 public void startTreePlant(HelperPlantType type)
 {
     if (treeToUnlockFlower.ContainsKey(type) && !needToUnlock.ContainsKey(type))
     {
         needToUnlock[treeToUnlockFlower[type]] = true;
     }
 }
Ejemplo n.º 2
0
    public void finishTree(HelperPlantType treeType)
    {
        var value = Dialogues.FinishFirstTree;

        if (!hadDialog.ContainsKey(value))
        {
            hadDialog[value] = true;
            TutorialPanel.Instance.Init(value);
        }
    }
Ejemplo n.º 3
0
 public void canPurchasePlant(HelperPlantType type)
 {
     if (TutorialPanel.Instance.canGeneratePanel() && enoughResourceToStartDialog.ContainsKey(type))
     {
         var value = enoughResourceToStartDialog[type];
         if (!hadDialog.ContainsKey(value))
         {
             hadDialog[value] = true;
             TutorialPanel.Instance.Init(value);
         }
     }
 }
Ejemplo n.º 4
0
    public void UpdateInfo(HelperPlantType treeType)
    {
        if (!plantManager || !plantManager.plantName.ContainsKey(treeType))
        {
            return;
        }
        levelInfoText.text = "This is a " + plantManager.plantName[treeType];

        levelInfoText.text += "\n";

        levelInfoText.text += plantManager.levelDetail[treeType];
    }
Ejemplo n.º 5
0
 public bool IsPlantable(HelperPlantType type, Collider2D pos, bool isWaterPlant = false)
 {
     if (!ignoreResourcePlant)
     {
         var prodDictionary = helperPlantCost[type];
         foreach (var pair in prodDictionary)
         {
             if (currentResource[pair.Key] < pair.Value)
             {
                 return(false);
             }
         }
     }
     return(IsPositionValid(pos, isWaterPlant));
 }
Ejemplo n.º 6
0
 public bool IsPlantable(HelperPlantType type, bool ignoreSlot = false)
 {
     if (!ignoreResourcePlant)
     {
         var prodDictionary = helperPlantCost[type];
         foreach (var pair in prodDictionary)
         {
             if (currentResource[pair.Key] < pair.Value)
             {
                 return(false);
             }
         }
     }
     return(ignoreSlot || hasSlot());
 }
Ejemplo n.º 7
0
 public void startTreePlant(HelperPlantType type)
 {
     if (treeToUnlockFlower.ContainsKey(type))
     {
         UnlockPlant(treeToUnlockFlower[type]);
     }
     if (helperPlantProd.ContainsKey(type))
     {
         foreach (var product in helperPlantProd[type].Keys)
         {
             UnlockResource(product);
         }
     }
     TutorialManager.Instance.finishPlant(type);
 }
Ejemplo n.º 8
0
 public void finishPlant(HelperPlantType type)
 {
     if (finishPlantToStartDialog.ContainsKey(type))
     {
         var value = finishPlantToStartDialog[type];
         if (!hadDialog.ContainsKey(value))
         {
             hadDialog[value] = true;
             if (type == HelperPlantType.appleTree2 || type == HelperPlantType.appleTree4)
             {
                 StartCoroutine(waitShow(2, value));
             }
             else
             {
                 TutorialPanel.Instance.Init(value);
             }
         }
     }
 }
Ejemplo n.º 9
0
 public void finishTree(HelperPlantType treeType)
 {
     foreach (Transform slot in gardenSlots)
     {
         if (slot.GetComponent <GardenSlot>().tree.GetComponent <MainTree>().upgradeList[0] == treeType)
         {
             foreach (Transform child in slot.GetComponent <GardenSlot>().allInTreeNode)
             {
                 Destroy(child.gameObject);
             }
             //List<Transform> allPlants = new List<Transform>();
             foreach (Transform tt in PlantsManager.Instance.allInTreeGame)
             {
                 var go     = Instantiate(tt.gameObject);
                 var t      = go.transform;
                 var localP = t.localPosition;
                 t.SetParent(slot.GetComponent <GardenSlot>().allInTreeNode);
                 t.localPosition = localP;
                 foreach (Transform c in t)
                 {
                     foreach (Transform c2 in c)
                     {
                         foreach (Transform c3 in c2)
                         {
                             //foreach (Transform c4 in c)
                             {
                                 if (c3.GetComponent <HelperInsect>())
                                 {
                                     Destroy(c3.gameObject);
                                 }
                             }
                         }
                     }
                 }
                 t.GetComponent <HelperPlant>().MoveToGarden();
             }
         }
     }
 }
Ejemplo n.º 10
0
    public void showLevelInfo(HelperPlantType type)
    {
        levelInfoPanel.SetActive(true);

        levelInfoPanel.GetComponent <LevelInfo>().UpdateInfo(type);
    }
Ejemplo n.º 11
0
 // Start is called before the first frame update
 void Start()
 {
     finishedTreeType = tree.GetComponent <MainTree>().finishType;
 }
Ejemplo n.º 12
0
 public void UnlockPlant(HelperPlantType type)
 {
     isPlantUnlocked[type] = true;
     HUD.Instance.UpdatePlantButtons();
 }
Ejemplo n.º 13
0
    public void ReduceCostForType(HelperPlantType type)
    {
        ReduceResource(currentResource, helperPlantCost[type]);

        // PlantsManager.Instance.UpdateRate();
    }