Ejemplo n.º 1
0
    void buildTower()
    {
        if (towerCooldown <= 0)
        {
            Transform tra = GetComponent <Transform>();
            float     x   = transform.position.x;
            float     y   = transform.position.y;
            tra.transform.position.Set(x, y, 0);

            TowerCode tc = tower.GetComponent <TowerCode>();
            tc.color = color;
            tc.col   = c;
            tc.setColor();
            Instantiate(tower, this.transform.position, this.transform.rotation);
            towerCooldown = towerPlaceCooldown;
        }
        else
        {
            towerCooldown -= Time.deltaTime;
        }
    }
    void placeTower()
    {
        if (Input.GetButton("Fire3") && buildCoolDown <= 0)
        {
            Transform t = GetComponent <Transform>();
            float     x = rb.transform.position.x;
            float     y = rb.transform.position.y;
            t.transform.position.Set(x, y, 0);

            TowerCode tc = tower.GetComponent <TowerCode>();
            tc.color = color;
            tc.col   = c;
            tc.setColor();
            Instantiate(tower, this.transform.position, this.transform.rotation);
            buildCoolDown = BuildCoolDown;
        }
        else
        {
            buildCoolDown -= Time.deltaTime;
        }
    }