Exemplo n.º 1
0
    public void Initialize(GameController gameController, ResourceGeneration pollutionPerTick, ResourceGeneration wastePerTick, ResourceGeneration materialsPerTick, ResourceGeneration moneyPerTickIncinerate, ResourceGeneration moneyPerTickStore, ResourceGeneration moneyPerTickRecycle)
    {
        this.pollutionPerTick = pollutionPerTick;
        this.wastePerTick     = wastePerTick;
        this.materialsPerTick = materialsPerTick;

        moneyPerTick = moneyPerTickStore;

        this.gameController = gameController;

        maxPollution = pollutionPerTick.Amount;
        maxWaste     = wastePerTick.Amount;
        maxMaterials = materialsPerTick.Amount;

        maxMoneyIncinerate = moneyPerTickIncinerate.Amount;
        maxMoneyStore      = moneyPerTickStore.Amount;
        maxMoneyRecycle    = moneyPerTickRecycle.Amount;

        this.moneyPerTickIncinerate = moneyPerTickIncinerate;
        this.moneyPerTickStore      = moneyPerTickStore;
        this.moneyPerTickRecycle    = moneyPerTickRecycle;

        pollutionGenerator.Initialize(gameController, moneyPerTick, materialsPerTick, wastePerTick, pollutionPerTick);
        CalculateValues(effectiveness);
    }
Exemplo n.º 2
0
    public void Initialize(Resource materials, GameController gameController, ResourceGeneration materialsPerTick, ResourceGeneration moneyPerTick)
    {
        this.materials        = materials;
        this.materialsPerTick = materialsPerTick;
        this.moneyPerTick     = moneyPerTick;
        materialUser.Initialize(gameController, moneyPerTick, materialsPerTick);

        maxMaterials = materialsPerTick.Amount;
        maxMoney     = moneyPerTick.Amount;
    }
Exemplo n.º 3
0
    public void DrawMap()
    {
        List <Vector3> treePoints = ResourceGeneration.GenerateResourcePoints(treeDistance, meshFilter.sharedMesh.vertices, meshFilter.gameObject, Vector3.zero, heightMapSettings);

        foreach (Vector3 location in treePoints)
        {
            GameObject treeAsset   = FindObjectOfType <TerrainGenerator>().resourcePool.tree;
            GameObject createdTree = Object.Instantiate(treeAsset, location, treeAsset.transform.rotation, meshFilter.gameObject.transform) as GameObject;
            createdTrees.Add(createdTree);
        }
    }
Exemplo n.º 4
0
 private void GenerateResource(ResourceGeneration generation)
 {
     if (generation.RemoveResource)
     {
         generation.Resource.ReduceAmount(generation.Amount);
     }
     else
     {
         generation.Resource.AddAmount(generation.Amount);
     }
 }
Exemplo n.º 5
0
        public ReturnMessageModel CreateResourceCopies(ResourceGenerationModel rgModel)
        {
            try
            {
                using (PointOfSaleEntities context = new PointOfSaleEntities())
                {
                    var gRow = new ResourceGeneration();
                    gRow.ResourceId          = rgModel.ResourceId;
                    gRow.Remarks             = rgModel.Remarks;
                    gRow.GenerationCopyCount = rgModel.GenerationCopyCount;
                    gRow.GenerationDate      = CommonService.GetEnglishDate(rgModel.GenerationDateNepali);
                    context.ResourceGenerations.Add(gRow);
                    context.SaveChanges();

                    //for Resoruce copies

                    for (int i = 0; i < rgModel.GenerationCopyCount; i++)
                    {
                        var rRow = new ResourceCopy();
                        rRow.GenerationId       = gRow.GenerationId;
                        rRow.ResourceId         = rgModel.ResourceId;
                        rRow.ResourceCopyCount  = i + 1;
                        rRow.ResourceCopyNumber = rgModel.ResourceName + "-" + rgModel.ResourceId.ToString() + ":" + gRow.GenerationId.ToString() + ":" + i.ToString();
                        rRow.Remarks            = rgModel.Remarks;
                        rRow.IsAvailable        = rgModel.IsAvailable;
                        rRow.PublishedDate      = CommonService.GetEnglishDate(rgModel.GenerationDateNepali);
                        rRow.Edition            = "new edition";
                        context.ResourceCopies.Add(rRow);
                    }
                    context.SaveChanges();
                    rModel.Msg     = "SUceess";
                    rModel.Success = true;
                    return(rModel);
                }
            }
            catch (Exception ex)
            {
                rModel.Msg     = "fail";
                rModel.Success = false;
                return(rModel);
            }
        }
Exemplo n.º 6
0
    void GenerateResourceNodes()
    {
        if (hasResources)
        {
            return;
        }

        Vector3[] vertices           = meshFilter.mesh.vertices;
        Vector3   gameObjectPosition = meshObject.transform.position;

        ThreadedDataRequester.RequestData(() => ResourceGeneration.GenerateResourcePoints(20f, vertices, meshObject, gameObjectPosition, heightMapSettings), PlaceTrees);

        hasResources = true;

        /*for (int i = 0; i < chunkSize; i++)
         * {
         *  for (int j = 0; j < chunkSize; j++)
         *  {
         *      int index = i * chunkSize + j;
         *      // Debug.Log("Index (" + index + ") = " + vertices[index]); // TODO Figure out what to do with these vertex cords... they are in world space... grab a distance around them and see if slope (in all 8 directions) is crazy? probably.
         *  }
         * } */
    }
 public void RenewPollution(ResourceGeneration pollution)
 {
     this.pollution = pollution;
 }
    public void Initialize(GameController gameController, ResourceGeneration money, ResourceGeneration materials, ResourceGeneration waste, ResourceGeneration pollution)
    {
        wasteUser.Initialize(gameController, money, materials, waste);

        this.pollution = pollution;
    }
        public ReturnMessageModel CreateResourceGeneration(ResourceGenerationModel rgModel)
        {
            try
            {
                using (PointOfSaleEntities _context = new PointOfSaleEntities())
                {
                    var rtRow = _context.ResourceGenerations.Where(x => x.GenerationId == rgModel.GenerationId).FirstOrDefault();

                    if (rtRow == null)
                    {
                        rtRow = new ResourceGeneration();
                    }
                    rtRow.ResourceId = rgModel.ResourceId;
                    //rtRow.GenerationDate = rgModel.GenerationDate;
                    rtRow.GenerationCopyCount = rgModel.GenerationCopyCount;
                    rtRow.Remarks             = rgModel.Remarks;


                    if (rgModel.GenerationId == 0)
                    {
                        rtRow.GenerationDate = System.DateTime.Now;
                        _context.ResourceGenerations.Add(rtRow);
                        _context.SaveChanges();
                    }
                    else
                    {
                        _context.ResourceGenerations.Attach(rtRow);
                        _context.Entry(rtRow).State = EntityState.Modified;
                        _context.SaveChanges();
                    }


                    var gRow = _context.ResourceCopies.Where(x => x.ResourceCopyId == rgModel.ResourceCopyId).FirstOrDefault();
                    if (gRow == null)
                    {
                        gRow = new ResourceCopy();
                    }

                    for (int i = 1; i < rgModel.GenerationCopyCount; i++)
                    {
                        gRow.ResourceCopyId    = rgModel.ResourceCopyId;
                        gRow.ResourceId        = rgModel.ResourceId;
                        gRow.GenerationId      = rgModel.GenerationId;
                        gRow.ResourceCopyCount = i;
                        //gRow.ResourceCopyNumber = ResourceId.ToString() + rgModel.GenerationId + rgModel.ResourceCopyId;
                    }
                    //rtRow.GenerationId


                    rModel.Msg     = "Resource Type Saved Successfully";
                    rModel.Success = true;
                    return(rModel);
                }
            }
            catch (Exception ex)
            {
                rModel.Msg     = "Resource Type Saved Failed";
                rModel.Success = false;
                return(rModel);
            }
        }
Exemplo n.º 10
0
 public void RenewMoney(ResourceGeneration money)
 {
     this.money = money;
 }
Exemplo n.º 11
0
 public void Initialize(GameController gameController, ResourceGeneration money)
 {
     workerSpender.Initialize(gameController);
     this.money = money;
 }
Exemplo n.º 12
0
 public void RenewMaterials(ResourceGeneration materials)
 {
     this.materials = materials;
 }
Exemplo n.º 13
0
    public void Initialize(GameController gameController, ResourceGeneration money, ResourceGeneration materials)
    {
        moneyUser.Initialize(gameController, money);

        this.materials = materials;
    }
Exemplo n.º 14
0
 public void RenewWaste(ResourceGeneration waste)
 {
     this.waste = waste;
 }
Exemplo n.º 15
0
    public void Initialize(GameController gameController, ResourceGeneration money, ResourceGeneration materials, ResourceGeneration waste)
    {
        materialUser.Initialize(gameController, money, materials);

        this.waste = waste;
    }