Ejemplo n.º 1
0
    public void SelectNode(MapCube node)
    {
        selectedTurret = node;
        turrentToBuild = null;

        selectionUI.SetTarget(node);
    }
Ejemplo n.º 2
0
    public void SellTurret()
    {
        PlayerStats.Money += turrentBlueprint.GetSellAmount();

        Destroy(turrent);
        turrentBlueprint = null;
    }
Ejemplo n.º 3
0
    void BuildTurret(TurrentBlueprint blueprint)
    {
        if (PlayerStats.Money < blueprint.cost)
        {
            Debug.Log("Not enouth money!");
            return;
        }

        PlayerStats.Money -= blueprint.cost;

        turretBlueprint = blueprint;

        GameObject _turret = (GameObject)Instantiate(blueprint.prefab, GetBuildPosition(), Quaternion.identity);

        turret = _turret;

        GameObject effect = (GameObject)Instantiate(buildManager.buildEffect, GetBuildPosition(), Quaternion.identity);

        Destroy(effect, 5f);

        if (!turretBlueprint.upgradedPrefab)//fix for not having updated tower
        {
            isUpgraded = true;
        }
    }
Ejemplo n.º 4
0
 public void SelectNode(Node node)
 {
     if (selectedNode == node)
     {
         DeselectNode();
         return;
     }
     selectedNode   = node;
     turrentToBuild = null;
     //nodeUI.setTarget(node);
 }
Ejemplo n.º 5
0
    public void SellTurret()
    {
        PlayerStats.Money += turretBlueprint.GetSellAmount();

        GameObject destroyEffect = (GameObject)Instantiate(buildManager.destroyEffect, GetBuildPosition() + new Vector3(0, 3, 0), Quaternion.identity);

        Destroy(destroyEffect, 5f);
        Destroy(turret);

        turretBlueprint = null;
    }
Ejemplo n.º 6
0
    public void SelectNode(MapCube node)
    {
        if (selectedTurret == node)
        {
            DeselectNode();
            return;
        }

        selectedTurret = node;
        turrentToBuild = null;

        selectionUI.SetTarget(node);
    }
Ejemplo n.º 7
0
    private void OnMouseDown()
    {
        if (turrent != null)
        {
            buildManager.SelectNode(this);
            return;
        }

        if (!buildManager.CanBuild)
        {
            return;
        }

        buildManager.BuildTurrentOn(this);
        turrentBlueprint = turrent.GetComponent <Turret>().turrentBlueprint;
    }
Ejemplo n.º 8
0
    public void UpgradeTurret()
    {
        if (PlayerStats.Money < turrentBlueprint.upgradeCost)
        {
            Debug.Log("Not enough money to upgrade that!");
            return;
        }

        PlayerStats.Money -= turrentBlueprint.upgradeCost;
        Destroy(turrent);

        GameObject _turret = (GameObject)Instantiate(turrentBlueprint.upgradedPrefab, GetBuildPosition(), Quaternion.identity);

        turrent = _turret;
        turrent.GetComponent <Turret>().selfMapCube = this;
        turrentBlueprint = turrent.GetComponent <Turret>().turrentBlueprint;
        isUpgraded       = true;
    }
Ejemplo n.º 9
0
    void BuildTurret(TurrentBlueprint blueprint)
    {
        if (PlayerStats.Money < blueprint.cost)
        {
            Debug.Log("Not enougt money");
            return;
        }
        PlayerStats.Money -= blueprint.cost;
        turretBlueprint    = blueprint;
        GameObject effect = (GameObject)Instantiate(buildManager.buildEffect, GetBuildPosition() + new Vector3(0, 2, 0), Quaternion.identity);

        Destroy(effect, 5f);

        GameObject _turret = (GameObject)Instantiate(blueprint.prefab, GetBuildPosition(), Quaternion.identity);

        turret = _turret;

        Debug.Log("TuretBuild! ");
    }
Ejemplo n.º 10
0
 public void SelectTurrentToBuild(TurrentBlueprint turrent)
 {
     turrentToBuild = turrent;
     DeselectNode();
 }
Ejemplo n.º 11
0
 public void SelectTurrentBuild(TurrentBlueprint turrent)
 {
     turrentToBuild = turrent;
     selectedTurret = null;
 }
Ejemplo n.º 12
0
 public void SelectTurrentBuild(TurrentBlueprint turrent)
 {
     turrentToBuild = turrent;
 }
Ejemplo n.º 13
0
 public void SelectTurretToBuild(TurrentBlueprint turret)
 {
     turretToBuild = turret;
     selectedNode  = null;
     nodeUI.Hide();
 }