Remove() public method

public Remove ( float amount ) : void
amount float
return void
Exemplo n.º 1
0
    private void Collect()
    {
        if (audioElement != null && Time.timeScale > 0)
        {
            audioElement.Play(harvestSound);
        }
        float collect = collectionAmount * Time.deltaTime;

        // Make sure that the harvester cannot collect more than it can carry
        if (currentLoad + collect > capacity)
        {
            collect = capacity - currentLoad;
        }

        if (resourceDeposit.isEmpty())
        {
            Arms[] arms = GetComponentsInChildren <Arms>();
            foreach (Arms arm in arms)
            {
                arm.renderer.enabled = false;
            }
            DecideWhatToDo();
        }
        else
        {
            resourceDeposit.Remove(collect);
        }

        currentLoad += collect;
    }
Exemplo n.º 2
0
    /// <summary>
    /// Build a turret on a selected Node
    /// </summary>
    /// <param name="node"></param>
    void BuildTurret(TurretBlueprint blueprint)
    {
        //Checks if the player has enough money to build a turret
        if (PlayerStats.Money < blueprint.cost || resource.GetAmount() < 1)
        {
            return;
        }

        //Deduct the cost
        PlayerStats.Money -= blueprint.cost;

        //Deduct one turret token for each turret bought
        resource.Remove(1);

        //Create new turret at the location of the current Node with no rotation
        GameObject _turret = (GameObject)Instantiate(blueprint.prefab, GetBuildPosition(), Quaternion.identity);

        //Set the Node turret equal to the just created turret object
        turret = _turret;

        turretBlueprint = blueprint;

        //Create a buildeffect object that can be destroyed again after 5 seconds
        GameObject effect = (GameObject)Instantiate(buildManager.buildEffect, GetBuildPosition(), Quaternion.identity);

        Destroy(effect, 5f);
    }
Exemplo n.º 3
0
    private void Collect()
    {
        float collect = collAmt * Time.deltaTime;

        if (currLoad + collect > capacity)
        {
            collect = capacity - currLoad;
        }
        resDeposit.Remove(collect);
        currLoad += collect;
    }
    private void Collect()
    {
        float collect = collectionAmount * Time.deltaTime;

        //make sure that the harvester cannot collect more than it can carry
        if (currentLoad + collect > capacity)
        {
            collect = capacity - currentLoad;
        }
        resourceDeposit.Remove(collect);
        currentLoad += collect;
    }
Exemplo n.º 5
0
 public void TryRemoveMaterials(int value, out bool flag)
 {
     if (_materials.IsEnough(value))
     {
         _materials.Remove(value);
         flag = true;
     }
     else
     {
         flag = false;
     }
 }
Exemplo n.º 6
0
 public void TryRemoveCredits(int value, out bool flag)
 {
     if (_credits.IsEnough(value))
     {
         _credits.Remove(value);
         flag = true;
     }
     else
     {
         flag = false;
     }
 }
Exemplo n.º 7
0
    private void Collect()
    {
        currentLoad    += collectionAmount * Time.deltaTime;
        currentDeposit += collectionAmount * Time.deltaTime;
        int deposit = Mathf.FloorToInt(currentDeposit);

        if (deposit >= 1)
        {
            currentDeposit -= deposit;
            resourceDeposit.Remove(deposit);
        }
    }
Exemplo n.º 8
0
    public void BuildUnit(int index)
    {
        var tile = Map.getEmptyTile();

        if (tile != null)
        {
            var unit = UnitPrefabs[index];
            if (GoldResource.Remove(unit.Cost))
            {
                TurnManager.CurrentPlayer.AddUnit(unit);
                tile.Place(Instantiate(unit, tile.transform.position, Quaternion.identity));
            }
        }
    }
Exemplo n.º 9
0
        public IActionResult DeleteIdea(int ideaId)
        {
            string key = HttpContext.Session.GetString("login");

            if (!string.IsNullOrEmpty(key))
            {
                Idea idea = resource.GetIdeaData(ideaId);
                resource.Remove(idea);
                return(RedirectToAction("BrightIdeas"));
            }
            else
            {
                return(Content("Access Denied"));
            }
        }
Exemplo n.º 10
0
    private void Collect()
    {
        if (audioElement != null)
        {
            audioElement.Play(harvestSound);
        }
        float collect = collectionAmount * Time.deltaTime;

        //make sure that the harvester cannot collect more than it can carry
        if (currentLoad + collect > capacity)
        {
            collect = capacity - currentLoad;
        }
        resourceDeposit.Remove(collect);
        currentLoad += collect;
    }
Exemplo n.º 11
0
    private void Collect()
    {
        if (audioElement != null && Time.timeScale > 0)
        {
            audioElement.Play(harvestSound);
        }
        float collect = collectionAmount * Time.deltaTime;

        //make sure that the harvester cannot collect more than it can carry
        if (currentLoad + collect > capacity)
        {
            collect = capacity - currentLoad;
        }
        if (resourceDeposit.isEmpty())
        {
            EnableArms(false);
            DecideWhatToDo();
        }
        else
        {
            resourceDeposit.Remove(collect);
        }
        currentLoad += collect;
    }