Пример #1
0
    void Awake()
    {
        playerInstance = GameObject.Find("Player").GetComponent <Player>();

        gameControlInstance       = gc.GetComponent <GameControl> ();
        gameControlGUIInstance    = gc.GetComponent <GameControlGUI> ();
        shopControlInstance       = gc.GetComponent <ShopControl> ();
        shopControlGUIInstance    = gc.GetComponent <ShopControlGUI> ();
        clickControlInstance      = gc.GetComponent <ClickControl> ();
        gridControlInstance       = gc.GetComponent <GridControl>();
        optionControlInstance     = gc.GetComponent <OptionControl>();
        dragControlInstance       = gc.GetComponent <DragControl>();
        eventGUIInstance          = gc.GetComponent <EventGUI>();
        enemyLibraryInstance      = gc.GetComponent <EnemyLibrary>();
        cardLibraryInstance       = gc.GetComponent <CardLibrary>();
        goalLibraryInstance       = gc.GetComponent <GoalLibrary>();
        guiStyleLibraryInstance   = gc.GetComponent <GUIStyleLibrary>();
        mainMenuInstance          = gc.GetComponent <MainMenu>();
        encyclopediaMenuInstance  = gc.GetComponent <EncyclopediaMenu>();
        godChoiceMenuInstance     = gc.GetComponent <GodChoiceMenu>();
        customizeMenuInstance     = gc.GetComponent <CustomizeMenu>();
        gridCursorControlInstance = gc.GetComponent <GridCursorControl>();
        menuControlInstance       = gc.GetComponent <MenuControl>();
        tutorialInstance          = gc.GetComponent <Tutorial>();
        deckAnimateInstance       = deck.GetComponent <DeckAnimate>();

        shopAndGoalParentCanvasInstance = goalandshopparent
                                          .GetComponent <ShopAndGoalParentCanvas>();
        shopGridCanvasInstance = shopgrid
                                 .GetComponent <ShopGridCanvas>();
        gridCursorControlGUIInstance = gridcursorcontrolgui
                                       .GetComponent <GridCursorControlGUI>();
    }
Пример #2
0
    public LibraryCard PullCardFromPack(ShopControl.Gods god, Card.Rarity rarity)
    {
        List<LibraryCard> tempList = new List<LibraryCard> ();

        List<LibraryCard> allCards = CardLibrary.Lib.Values.ToList<LibraryCard>();

        if(SaveDataControl.UnlockedGods.Contains(god)) {
            // => this goal isn't from the pantheon.
            foreach(LibraryCard LC in allCards) {
                if((LC.God == god && LC.ThisRarity == rarity)) {
                    tempList.Add(LC);
                }
            }
        }
        else {
            // => this goal is from the pantheon and the card reward is random.
            foreach(LibraryCard LC in allCards) {
                if(LC.ThisRarity == Card.Rarity.Silver | LC.ThisRarity == Card.Rarity.Bronze) {
                    tempList.Add(LC);
                }
            }
        }

        if(tempList.Count==0) {
            Debug.Log("templist is 0! picked god is " + god.ToString() + "and the rarity is " + rarity.ToString());
            return null;
        }

        int randomNumber = Random.Range (0, tempList.Count-1);
        Debug.Log("templist index is " + randomNumber);
        return tempList[randomNumber];
    }
Пример #3
0
    // Start is called before the first frame update
    void Start()
    {
        audioSrc  = GetComponent <AudioSource>();
        popEffect = Resources.Load <AudioClip>("Pop");

        autoClicker100Cookies.SetActive(false);
        shop123 = GameObject.FindWithTag("Player").GetComponent <ShopControl>();
    }
Пример #4
0
 public void addSidewalk(int i, int j)
 {
     sidewalks.Add(new Node(i, j));
     sidewalkInfo.addStructure(i, j);
     grid[i, j] = 1;
     metrics.setNumSidewalks(metrics.getNumSidewalks() + 1);
     metrics.setNumPoints(metrics.getNumPoints() + 100);
     ShopControl.addToCurrency(5);
 }
Пример #5
0
 public void addBuilding(int i, int j)
 {
     buildings.Add(new Node(i, j));
     buildingInfo.addStructure(i, j);
     grid[i, j] = 2;
     metrics.setNumBuildings(metrics.getNumBuildings() + 1);
     metrics.setNumPoints(metrics.getNumPoints() + 300);
     ShopControl.addToCurrency(10);
 }
Пример #6
0
    // Start is called before the first frame update
    void Start()
    {
        cookieMultiplier = 1;

        Shop = GameObject.FindGameObjectWithTag("Player").GetComponent <ShopControl>();

        audioSrc    = GetComponent <AudioSource>();
        clickEffect = Resources.Load <AudioClip>("Click Effect");
    }
Пример #7
0
    public Goal(string Name, string minidescription, string description, 
	            ShopControl.Gods god, int[] goalScore, bool higherScoreIsGood)
    {
        MiniDescription = minidescription;
        Description = description;
        God = god;
        GoalScore = goalScore;
        HigherScoreIsGood = higherScoreIsGood;
    }
Пример #8
0
 void Awake()
 {
     instance = this;
     for (int i = 0; i < listItem.Count; i++)
     {
         listItem [i].id = i;
         listItem [i].SetUnlocked();
         listItem [i].bt.image.sprite = GameDefine.instance.listTeamFlagItemSpr [i];
     }
 }
Пример #9
0
 public static void Initialize(GameControl gc, Player pl)
 {
     gameControl     = gc;
     shopControl     = gc.gameObject.GetComponent <ShopControl>();
     clickControl    = gc.gameObject.GetComponent <ClickControl>();
     gridControl     = gc.gameObject.GetComponent <GridControl>();
     shopControlGUI  = gc.gameObject.GetComponent <ShopControlGUI>();
     obstacleLibrary = gc.gameObject.GetComponent <ObstacleLibrary>();
     enemyLibrary    = gc.gameObject.GetComponent <EnemyLibrary>();
     player          = pl;
 }
Пример #10
0
    // Start is called before the first frame update
    void Start()
    {
        Shop1 = GameObject.FindGameObjectWithTag("Player").GetComponent <ShopControl>();

        m_TextComponent = GetComponent <TMP_Text>();

        InvokeRepeating("AutoClicker1Enabled", 0f, 1.0f);

        InvokeRepeating("AutoClicker2Enabled", 0f, 1.0f);

        InvokeRepeating("AutoClicker3Enabled", 0f, 1.0f);
    }
Пример #11
0
    public void DisplayItem()
    {
        shopControl         = this.gameObject.transform.parent.parent.GetComponent <ShopControl>();
        currentSelectedItem = shopControl.currentSelectedItem.item;



        // Get each Image gameobject so later we can look at their child's Text ****************
        if (currentSelectedItem != null)
        {
            int numChildren = this.gameObject.transform.childCount;
            ImageGameObjects = new GameObject[numChildren];

            for (int i = 0; i < numChildren; i++)
            {
                ImageGameObjects[i] = this.gameObject.transform.GetChild(i).gameObject;
                // Debug.Log(ImageGameObjects[i]);
            }
            // ************* Setup complete ***************************

            // Set the name HARD CODED OUT OF ITS MIND - ASK HENRY FOR MAINTENCE
            textBox      = ImageGameObjects[0].transform.GetChild(1).GetComponent <Text>();       // gets the second gameobject which is text of the three gameobjects we saved
            textBox.text = currentSelectedItem.itemName;

            textBox      = ImageGameObjects[1].transform.GetChild(1).GetComponent <Text>();       // gets the second gameobject which is text of the three gameobjects we saved
            textBox.text = currentSelectedItem.description;

            textBox      = ImageGameObjects[2].transform.GetChild(1).GetComponent <Text>();       // gets the second gameobject which is text of the three gameobjects we saved
            textBox.text = "" + currentSelectedItem.goldCost + "g";
        }
        else
        {
            int numChildren = this.gameObject.transform.childCount;
            ImageGameObjects = new GameObject[numChildren];

            for (int i = 0; i < numChildren; i++)
            {
                ImageGameObjects[i] = this.gameObject.transform.GetChild(i).gameObject;
                // Debug.Log(ImageGameObjects[i]);
            }
            // ************* Setup complete ***************************

            // Set the name HARD CODED OUT OF ITS MIND - ASK HENRY FOR MAINTENCE
            textBox      = ImageGameObjects[0].transform.GetChild(1).GetComponent <Text>();       // gets the second gameobject which is text of the three gameobjects we saved
            textBox.text = "";

            textBox      = ImageGameObjects[1].transform.GetChild(1).GetComponent <Text>();       // gets the second gameobject which is text of the three gameobjects we saved
            textBox.text = "";

            textBox      = ImageGameObjects[2].transform.GetChild(1).GetComponent <Text>();       // gets the second gameobject which is text of the three gameobjects we saved
            textBox.text = "";
        }
    }
Пример #12
0
    private bool _canBuy = true; //si estamos en el medio de la oleada, no podemos comprar por ejemplo.

    private void Awake()
    {
        _shopMng    = transform.parent.GetComponent <ShopsManager>();
        _view       = GetComponent <ShopView>();
        _controller = new ShopControl(this);

        _itemScroller           = GetComponentInChildren <ShopItemScroller>();
        _itemScroller.shopModel = this;
        _itemScroller.shopMng   = _shopMng;
        _itemScroller.UpdateIcons();
        _audioControl = GetComponent <ShopAudioController>();
    }
Пример #13
0
    public void addCitizen(int i, int j)
    {
        metrics.setNumCitizens(metrics.getNumCitizens() + 1);
        metrics.setNumPoints(metrics.getNumPoints() + 500);
        ShopControl.addToCurrency(25);
        GameObject newCitizen = Instantiate(citizenPrefab, new Vector3(0.5f + i, heightOffset, 0.5f + j), Quaternion.identity);

        newCitizen.AddComponent <Citizen>();
        newCitizen.GetComponent <Citizen>().setup(this, structureControl, achievementControl, new Node(i, j));
        newCitizen.GetComponent <Renderer>().material.SetColor("_Color", citizenColor);
        citizens.Add(newCitizen);
    }
Пример #14
0
 public static void AddGodInOrderToUnlocked(ShopControl.Gods newGod)
 {
     if(!UnlockedGods.Contains(newGod)) {
         UnlockedGods.Add (newGod);
     }
     List<ShopControl.Gods> newList = new List<ShopControl.Gods>();
     for(int i = 0; i < ShopControl.AllGods.Count; i++) {
         if(UnlockedGods.Contains(ShopControl.AllGods[i])) {
             newList.Add(ShopControl.AllGods[i]);
         }
     }
     UnlockedGods = newList;
 }
Пример #15
0
 public void ResizeSearchRsltCtrl()
 {
     if (this.flpSearchRslt.Controls.Count > 0)
     {
         foreach (Control ctrl in this.flpSearchRslt.Controls)
         {
             if (ctrl.GetType().Equals(typeof(ShopControl)))
             {
                 ShopControl sc = ctrl as ShopControl;
                 sc.Width = this.flpSearchRslt.Width - 25;
             }
         }
     }
 }
Пример #16
0
    public void Start()
    {
        toggleShop.onClick.AddListener(delegate
        {
            //this.gameObject.SetActive(false);
            this.gameObject.SetActive(!this.gameObject.activeSelf);
            if (this.gameObject.activeSelf)
            {
                ShopScreen.displayWallet(ShopControl.shopConents.getCurrency());
            }
        });

        displayWallet(ShopControl.getCurrency());

        this.gameObject.SetActive(false);
    }
Пример #17
0
        private void CreateSearchRsltCtrl(ShopSearchRslt aSsr)
        {
            if (aSsr != null)
            {
                this.SetSearchRsltInfo(aSsr.start, aSsr.display, aSsr.total);

                foreach (ShopItem itm in aSsr.items)
                {
                    ShopControl sc = new ShopControl();

                    sc.Width = this.flpSearchRslt.Width - 25;
                    sc.SetValue(itm);

                    this.flpSearchRslt.Controls.Add(sc);
                }
            }
        }
Пример #18
0
    public void BuyPlant()
    {
        shopcontrol   = transform.parent.gameObject.GetComponent <ShopControl>();
        itemInstance  = shopcontrol.currentSelectedItem;
        goalInventory = shopcontrol.goalInventory;


        // calculates if the cost of this plant is higher than the amount the player has
        if (itemInstance != null && goalInventory != null)
        {
            if (itemInstance.item.goldCost <= GameObject.Find("GameManager").GetComponent <PlayerData>().gold)
            {
                // Debug.Log(itemInstance.item);
                if (goalInventory.FindItem(itemInstance))
                {
                    // Debug.Log(itemInstance.item);
                    GameObject.Find("GameManager").GetComponent <PlayerData>().gold -= itemInstance.item.goldCost;
                    goalInventory.IncreaseQuantityItem(1, itemInstance);
                }
                // check if the user ran out of room or add new plant to inventory
                // DOESN'T CHECK IF USER RAN OUT OF ROOM YET
                else
                {
                    // goalInventory.InsertItem(itemInstance);
                    goalInventory.IncreaseQuantityItem(1, itemInstance);
                    GameObject.Find("GameManager").GetComponent <PlayerData>().gold -= itemInstance.item.goldCost;
                }
            }
            else
            {
                Debug.Log("Not enough golds");
            }
        }
        else
        {
            Debug.Log("You didn't select an item to buy yet");
        }
    }
Пример #19
0
 private void Start()
 {
     shopControl = FindObjectOfType <ShopControl>();
     LoadBaitsInfo();
     SetCurrViewingBait(1);
 }
Пример #20
0
    //overload: no targeting squares or displayname
    public LibraryCard(string cardname, string iconpath, ShopControl.Gods god, Card.Rarity rarity, 
	                   string tooltip, string displaytext, string minidisplaytext, Card.CardActionTypes cardAction)
        : this(cardname, cardname, iconpath, god, rarity, tooltip, displaytext, minidisplaytext, cardAction, GridControl.TargetTypes.none, 0, 0, GridControl.TargetTypes.none, 0, 0)
    {
    }
Пример #21
0
    [SerializeField] List <Sprite> foodSprites; // level 1 ~

    private void Start()
    {
        shopControl = FindObjectOfType <ShopControl>();
        LoadFoodsInfo();
        SetCurrViewingFood(1);
    }
Пример #22
0
    //overload: no rangeMin (different displayname)
    public LibraryCard(string cardname, string displayname, string iconpath, ShopControl.Gods god, Card.Rarity rarity, 
	                   string tooltip, string displaytext, string minidisplaytext, Card.CardActionTypes cardAction,
	                   GridControl.TargetTypes rangeTargetType, int rangeArg, GridControl.TargetTypes aoeTargetType, int aoeRangeArg)
        : this(cardname, displayname, iconpath, god, rarity, tooltip, displaytext, minidisplaytext, cardAction, rangeTargetType, 1, rangeArg, aoeTargetType, 0, aoeRangeArg)
    {
    }
Пример #23
0
 public void loadShop()
 {
     ShopControl.loadShopScreen();
 }
Пример #24
0
    //normal
    public LibraryCard(string cardname, string displayname, string iconpath, ShopControl.Gods god, Card.Rarity rarity, 
	                   string tooltip, string displaytext, string minidisplaytext, Card.CardActionTypes cardAction,
	                   GridControl.TargetTypes rangeTargetType, int rangeMinArg, int rangeMaxArg, GridControl.TargetTypes aoeTargetType, int aoeMinArg, int aoeMaxArg)
    {
        CardName = cardname;
        DisplayName = displayname;
        IconPath = iconpath;
        God = god;

        ThisRarity = rarity;

        Tooltip = tooltip;

        DisplayText = displaytext;
        MiniDisplayText = minidisplaytext;

        CardAction = cardAction;
        RangeTargetType = rangeTargetType;
        rangeMin = rangeMinArg;
        rangeMax = rangeMaxArg;
        AoeTargetType = aoeTargetType;
        aoeMinRange = aoeMinArg;
        aoeMaxRange = aoeMaxArg;

        switch(rarity) {
        case Card.Rarity.Paper:
            Cost = 0;
            break;
        case Card.Rarity.Bronze:
            Cost = 2;
            break;
        case Card.Rarity.Silver:
            Cost = 4;
            break;
        case Card.Rarity.Gold:
            Cost = 6;
            break;
        case Card.Rarity.Platinum:
            Cost = 8;
            break;
        }
        UnlockCost = Cost;
    }
Пример #25
0
    void Awake()
    {
        playerInstance = GameObject.Find("Player").GetComponent<Player>();

        gameControlInstance = gc.GetComponent<GameControl> ();
        gameControlGUIInstance = gc.GetComponent<GameControlGUI> ();
        shopControlInstance = gc.GetComponent<ShopControl> ();
        shopControlGUIInstance = gc.GetComponent<ShopControlGUI> ();
        clickControlInstance = gc.GetComponent<ClickControl> ();
        gridControlInstance = gc.GetComponent<GridControl>();
        optionControlInstance = gc.GetComponent<OptionControl>();
        dragControlInstance = gc.GetComponent<DragControl>();
        eventGUIInstance = gc.GetComponent<EventGUI>();
        enemyLibraryInstance = gc.GetComponent<EnemyLibrary>();
        cardLibraryInstance = gc.GetComponent<CardLibrary>();
        goalLibraryInstance = gc.GetComponent<GoalLibrary>();
        guiStyleLibraryInstance = gc.GetComponent<GUIStyleLibrary>();
        mainMenuInstance = gc.GetComponent<MainMenu>();
        encyclopediaMenuInstance = gc.GetComponent<EncyclopediaMenu>();
        godChoiceMenuInstance = gc.GetComponent<GodChoiceMenu>();
        customizeMenuInstance = gc.GetComponent<CustomizeMenu>();
        gridCursorControlInstance = gc.GetComponent<GridCursorControl>();
        menuControlInstance = gc.GetComponent<MenuControl>();
        tutorialInstance = gc.GetComponent<Tutorial>();
        deckAnimateInstance = deck.GetComponent<DeckAnimate>();

        shopAndGoalParentCanvasInstance = goalandshopparent
                                          .GetComponent<ShopAndGoalParentCanvas>();
        shopGridCanvasInstance = shopgrid
                                 .GetComponent<ShopGridCanvas>();
        gridCursorControlGUIInstance = gridcursorcontrolgui
                                       .GetComponent<GridCursorControlGUI>();
    }