示例#1
0
    void OnMouseDown()
    {
        // reap the money from towers that are marked and delete them

        int totalSellBackAmount = BaseCohesionManager.DeleteUnconnectedAttachments(true);

        SellingManager.Instance.SetVisibility(false);         //remove the window

        //do something with the sell back amount
        BlorbManager.Instance.Transaction(totalSellBackAmount, sellWindow.position);

        this.GetComponent <SpriteRenderer>().color = new Color(1f, 1f, 1f, 0.5f);

        //reconfigure placement spots if they are already there...
        if (GameObject.FindGameObjectsWithTag("Placement").Length > 0)
        {
            center.RecalculateAllPossiblePlacements();
        }
    }
示例#2
0
    public void takeDamage()
    {
        attackingEnemies.RemoveAll(e => (e.gameObject == null || !e.gameObject.activeSelf)); //remove all dead enemies

        float totalDamage = 0f;

        foreach (Enemy enemy in attackingEnemies)
        {
            totalDamage += enemy.HitDamage;
        }

        health -= totalDamage;

        healthbar.Set(health / 100f);

        if (health <= 0f)
        {
            CancelInvoke();
            //find all neighbors if possible (starting from center), skipping this particular attachment
            BaseCohesionManager.FindAllNeighbors(this.transform);
            BaseCohesionManager.DeleteUnconnectedAttachments(false); //delete all that were not found
            BaseCohesionManager.UnMarkAllAttachments();
        }
    }