public void SellTower()
    {
        PlayerCoins.AddCoins(tower.Stats.SellCost);
        AudioManager.Instance.PlayTowerSellAudio();
        Destroy(tower.gameObject);

        TouchInputManager.ButtonClicked = true;
    }
Beispiel #2
0
 void Start()
 {
     playerCoins  = GameObject.Find("Player").GetComponent <PlayerCoins>();
     playerAttack = GameObject.Find("Player").GetComponent <PlayerAttack>();
     playerLife   = GameObject.Find("Player").GetComponent <Life>();
     playerMove   = GameObject.Find("Player").GetComponent <InputsMove>();
     bossDoor     = GameObject.Find("Door").GetComponent <BossDoor>();
 }
Beispiel #3
0
 private void OnTriggerEnter2D(Collider2D collision)
 {
     if (collision.CompareTag("Player"))
     {
         player = collision.gameObject.GetComponent <PlayerCoins>();
     }
     player.coinCount += coinsCost;
     Destroy(gameObject);
 }
Beispiel #4
0
 private void OnTriggerEnter2D(Collider2D collision)
 {
     if (isOpened)
     {
         animator.SetTrigger("Trigger");
         isOpened          = false;
         player            = collision.gameObject.GetComponent <PlayerCoins>();
         player.coinCount += coinsCost;
     }
 }
Beispiel #5
0
    public void AddTower(Tower tower)
    {
        tower.transform.SetParent(towerPosition);
        tower.transform.localPosition = Vector3.zero;

        tower.IsActive = true;

        Tower = tower;

        tower.AudioManager.PlayBuyAudio();
        PlayerCoins.SpendCoins(tower.Stats.Cost);
    }
Beispiel #6
0
    public virtual void Die()
    {
        IsDead = true;

        PlayerCoins.AddCoins(coinsReward);
        animator.SetTrigger(EnemyAnimator.DEAD_TRIGGER);
        audioSource.Play();

        Movement.Disable();

        Invoke("Delete", 5);
    }
Beispiel #7
0
    void Update()
    {
        // Get the UI component to display coin number
        _coinCount = this.GetComponent(typeof(Text)) as Text;
        _temp      = GameObject.FindWithTag("Player");
        _coins     = _temp.GetComponent <PlayerCoins>();

        // Update UI with player's current coin count
        // If statement checks that the current object has a text field
        if (_coinCount != null)
        {
            _coinCount.text = "" + _coins.GetCoinCount();
        }
    }
    public void UpgradeTower()
    {
        PlayerCoins.SpendCoins(tower.Stats.UpgradeCost);
        tower.AudioManager.PlayUpgradeAudio();

        tower.Stats.AdvanceLevel();

        SetLevel();
        UpdateUpgradeButton();
        UpdateSellButton();

        tower.Previewable.SetSelectedPreviewable();

        TouchInputManager.ButtonClicked = true;
    }
 private void Start()
 {
     Instance = this;
 }
Beispiel #10
0
 // Start is called before the first frame update
 void Awake()
 {
     Instance     = this;
     currentCoins = initialCoins;
 }
    private void Awake()
    {
        _inventory      = GameObject.Find("Inventory").GetComponent <Inventory>();
        _equipmentPanel = GameObject.Find("EquipmentPanel").GetComponent <EquipmentPanel>();

        _shopInventory = GameObject.Find("ShopPanel").GetComponent <ShopInventory>();
        _playerCoins   = GameObject.Find("Coins").GetComponent <PlayerCoins>();

        _itemTooltip         = GameObject.Find("ItemTooltip").GetComponent <ItemTooltip>();
        _statTooltip         = GameObject.Find("StatTooltip").GetComponent <StatTooltip>();
        _draggedItem         = GameObject.Find("DraggedItem").GetComponent <Image>();
        _draggedItem.enabled = false;

        _statsPanel = GameObject.Find("Stats").GetComponent <StatPanel>();
        _statsPanel.SetStats(_health, _mana, _armor, _strength, _intelligence);
        GameController.maxHealth    = _health.Value;
        GameController.maxMana      = _mana.Value;
        GameController.armor        = _armor.Value;
        GameController.strength     = _strength.Value;
        GameController.intelligence = _intelligence.Value;
        _statsPanel.UpdateStatValues();

        //Setup Events:
        GameController.OnUseConsumableEvent += UseConsumable;
        //Right Click
        _inventory.OnRightClickEvent      += Equip;
        _inventory.OnRightClickEvent      += Sell;
        _inventory.OnRightClickEvent      += UseConsumable;
        _inventory.OnRightClickEvent      += HideTooltip;
        _equipmentPanel.OnRightClickEvent += Unequip;
        _shopInventory.OnRightClickEvent  += Buy;
        _shopInventory.OnRightClickEvent  += HideTooltip;
        //Pointer Enter
        _inventory.OnPointerEnterEvent      += ShowTooltip;
        _equipmentPanel.OnPointerEnterEvent += ShowTooltip;
        _shopInventory.OnPointerEnterEvent  += ShowTooltip;
        //Pointer Exit
        _inventory.OnPointerExitEvent      += HideTooltip;
        _equipmentPanel.OnPointerExitEvent += HideTooltip;
        _shopInventory.OnPointerExitEvent  += HideTooltip;
        //Begin Drag
        _inventory.OnBeginDragEvent      += BeginDrag;
        _inventory.OnBeginDragEvent      += HideTooltip;
        _equipmentPanel.OnBeginDragEvent += BeginDrag;
        _shopInventory.OnBeginDragEvent  += BeginDrag;
        //End Drag
        _inventory.OnEndDragEvent      += EndDrag;
        _equipmentPanel.OnEndDragEvent += EndDrag;
        _shopInventory.OnEndDragEvent  += EndDrag;
        //Drag
        _inventory.OnDragEvent      += Drag;
        _equipmentPanel.OnDragEvent += Drag;
        _shopInventory.OnDragEvent  += Drag;
        //Drop
        _inventory.OnDropEvent      += Drop;
        _inventory.OnDropEvent      += ShowTooltip;
        _equipmentPanel.OnDropEvent += Drop;
        _equipmentPanel.OnDropEvent += ShowTooltip;
        _shopInventory.OnDropEvent  += Drop;
        _shopInventory.OnDropEvent  += ShowTooltip;
    }