コード例 #1
0
    private void Spawn(Vector3 position)
    {
        float balance = wallet.GetResourceCount(ResourceType.Money);

        if (balance >= toSpawn.cost)
        {
            wallet.AddResources(ResourceType.Money, -toSpawn.cost);
            var created = Instantiate(toSpawn);
            created.transform.position = tileManager.CastWorldCoordsToTile(position);
            created.GetComponent <Building>().destinationStorage = wallet;
            created.GetComponent <Building>().inputStorage       = tileManager.GetResourceTileAtWorldCoords(position);
        }
    }
コード例 #2
0
 public void Update()
 {
     playerStorage.AddResources(ResourceType.Money,
                                moneyGenerationRate * Time.deltaTime * assignedPopulation);
 }