Ejemplo n.º 1
0
        public List <SysChemicalItem> GetAvailableChemicalInStock(byte _RequisitionAt)
        {
            var FinalStock = DalChemicalStock.ItemWiseStockInSpecificChemicalStore(_RequisitionAt);

            var data = (from s in FinalStock
                        where s.ClosingQty > 0
                        join c in _context.Sys_ChemicalItem on s.ItemID equals c.ItemID into Chemicals
                        from c in Chemicals.DefaultIfEmpty()

                        join i in _context.Sys_ItemType on(c.ItemTypeID == null? null: c.ItemTypeID) equals i.ItemTypeID into ItemTypes
                        from i in ItemTypes.DefaultIfEmpty()


                        select new SysChemicalItem
            {
                ItemID = Convert.ToInt32(s.ItemID),
                ItemName = c == null ? null : c.ItemName,
                //ItemCategory = DalCommon.ReturnChemicalItemCategory(c.ItemCategory),
                //ItemTypeName = DalCommon.GetItemTypeName(Convert.ToByte(c.ItemTypeID)),
                ItemCategory = c.ItemCategory,
                ItemTypeName = (i == null? null: i.ItemTypeName),
                StockQty = s.ClosingQty
            }).ToList();

            foreach (var item in data)
            {
                item.ItemCategory = DalCommon.ReturnChemicalItemCategory(item.ItemCategory);
            }

            return(data);
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Moves the water in time. The surface area is needed because of gas exchange
        /// </summary>
        /// <param name="TimeStep"></param>
        /// <param name="SurfaceArea"></param>
        public virtual void MoveInTime(TimeSpan TimeStep, double SurfaceArea)
        {
            if (Log)
            {
                LogString.AppendLine("MovedInTime " + TimeStep);
            }

            double GasExchangeConstant = 0.16 / 86400; // [m/s] Gleeson et al p.4

            foreach (var c in Chemicals.ToList())
            {
                double FirstOrderDegradationRate = 0;
                if (c.Key.IsVolatile)
                {
                    FirstOrderDegradationRate += -GasExchangeConstant * SurfaceArea / Volume;
                }
                if (c.Key.IsFirstOrderDegradable)
                {
                    FirstOrderDegradationRate += -c.Key.FirstOrderDegradationRate;
                }
                Chemicals[c.Key] = Math.Exp(FirstOrderDegradationRate * TimeStep.TotalSeconds) * c.Value;
            }

            WaterAge        += TimeStep;
            RelativeTimeTag += TimeStep;
        }
Ejemplo n.º 3
0
 public void LoseHealth(float damage, Chemicals chemicals, Player playerAttacked)
 {
     //play sound effect
     int randClip = Random.Range(0, hurtAudio.Length) ;
     AudioSource.PlayClipAtPoint(hurtAudio[randClip],transform.position);;
     //implement damage formula
     float dmgToLoose = damage * (1 - enemyChemicals.getReaction (chemicals));
     this.health -= dmgToLoose;
     playerAttacked.stats.damageDone += dmgToLoose;
     for (int i=0; i<playerList.Length; ++i) {
         if (playerList[i].GetComponent<Player>() == playerAttacked)
             damageTaken[i] += damage;
     }
     Destroy(Instantiate (bloodPrefab, transform.position, transform.rotation) as GameObject, 15f);
     if(health < 0){
         ++playerAttacked.stats.killCount;
         GameObject.Find ("EnemyCounter").GetComponent<EnemyCounter>().decreaseEnemyCount();
         Destroy(gameObject);
     }
 }
Ejemplo n.º 4
0
        //after Save For Grid Data
        public List <PRDChemProdReqItem> GetTransactionItemList(long _TransactionID, string _IssueFrom)
        {
            using (var context = new BLC_DEVEntities())
            {
                var StockResult = (from p in context.INV_ChemStockSupplier
                                   where p.StoreID.ToString() == _IssueFrom
                                   group p by new
                {
                    //p.StoreID,
                    p.SupplierID,
                    p.PackSize,
                    p.ItemID,
                    p.SizeUnit,
                    p.UnitID
                } into g
                                   select new
                {
                    TransectionID = g.Max(p => p.TransectionID),
                    //StoreID = g.Where(p => p.TransectionID == g.Max(q => q.TransectionID)).Select(x => x.StoreID).FirstOrDefault(),
                    ItemID = g.Where(p => p.TransectionID == g.Max(q => q.TransectionID)).Select(x => x.ItemID).FirstOrDefault(),
                    SupplierID = g.Where(p => p.TransectionID == g.Max(q => q.TransectionID)).Select(x => x.SupplierID).FirstOrDefault(),
                    //UnitID = g.Where(p => p.TransectionID == g.Max(q => q.TransectionID)).Select(x => x.UnitID).FirstOrDefault(),
                    PackSize = g.Where(p => p.TransectionID == g.Max(q => q.TransectionID)).Select(x => x.PackSize).FirstOrDefault(),
                    SizeUnit = g.Where(p => p.TransectionID == g.Max(q => q.TransectionID)).Select(x => x.SizeUnit).FirstOrDefault(),
                    PackQty = g.Where(p => p.TransectionID == g.Max(q => q.TransectionID)).Select(x => x.PackClosingQty).FirstOrDefault(),
                    ClosingQty = g.Where(p => p.TransectionID == g.Max(q => q.TransectionID)).Select(x => x.ClosingQty).FirstOrDefault(),
                    StockUnit = g.Where(p => p.TransectionID == g.Max(q => q.TransectionID)).Select(x => x.UnitID).FirstOrDefault()
                });

                var Data = (from i in context.INV_StoreTransItem
                            where i.TransactionID == _TransactionID

                            // Stock Size
                            from s in StockResult.Where(x => x.ItemID == i.ItemID && x.PackSize == i.PackSize && x.SizeUnit == i.SizeUnit && x.SupplierID == i.SupplierID).DefaultIfEmpty()


                            join si in context.Sys_Size on(s == null ? null : s.PackSize) equals si.SizeID into StockSize
                            from si in StockSize.DefaultIfEmpty()

                            join siu in context.Sys_Unit on(s == null ? null : s.SizeUnit) equals siu.UnitID into StockSizeUnit
                            from siu in StockSizeUnit.DefaultIfEmpty()

                            join su in context.Sys_Unit on(s == null ? null : s.StockUnit) equals su.UnitID into StockUnit
                            from su in StockUnit.DefaultIfEmpty()
                            // Stock Size


                            join it in context.Sys_ChemicalItem on(i == null ? null : i.ItemID) equals it.ItemID into Chemicals
                            from it in Chemicals.DefaultIfEmpty()

                            join sup in context.Sys_Supplier on(i == null ? null : i.SupplierID) equals sup.SupplierID into Suppliers
                            from sup in Suppliers.DefaultIfEmpty()

                            join iu in context.Sys_Unit on(i == null ? null : i.TransactionUnit) equals iu.UnitID into IUnits
                            from iu in IUnits.DefaultIfEmpty()

                            join issuesize in context.Sys_Size on(i == null ? null : i.PackSize) equals issuesize.SizeID into IssueSizes
                            from issuesize in IssueSizes.DefaultIfEmpty()

                            join issuesizeunit in context.Sys_Unit on(i == null ? null : i.SizeUnit) equals issuesizeunit.UnitID into IssueSizeUnit
                            from issuesizeunit in IssueSizeUnit.DefaultIfEmpty()

                            orderby(it == null ? null : it.ItemName)

                            select new PRDChemProdReqItem
                {
                    TransItemID = i.TransItemID,
                    ItemID = i.ItemID,
                    ItemName = (it == null ? null : it.ItemName),
                    SupplierID = i.SupplierID,
                    SupplierName = (sup == null ? null : sup.SupplierName),

                    PackSize = (s == null ? 0 : s.PackSize),
                    PackSizeName = (si == null ? null : si.SizeName),
                    SizeUnit = (s == null ? 0 : s.SizeUnit),
                    SizeUnitName = (siu == null ? null : siu.UnitName),
                    PackQty = (s == null ? 0 : (Int32)(s.PackQty)),

                    StockQty = (s == null ? 0 : s.ClosingQty),
                    StockUnit = (s == null ? 0 : s.StockUnit),
                    StockUnitName = (su == null ? null : su.UnitName),

                    IssuePackSize = i.PackSize,
                    IssuePackSizeName = (issuesize == null ? null : issuesize.SizeName),
                    IssueSizeUnit = i.SizeUnit,
                    IssueSizeUnitName = (issuesizeunit == null ? null : issuesizeunit.UnitName),
                    IssuePackQty = i.PackQty,
                    IssueQty = i.TransactionQty,
                    IssueUnitName = (iu == null ? null : iu.UnitName)
                }).ToList();
                return(Data);
            }
        }
Ejemplo n.º 5
0
 public void SetChemicals(Chemicals theChemicals)
 {
     playerChemicals = theChemicals;
 }
Ejemplo n.º 6
0
    public void LoseHealth(float damage, Chemicals enemyChemicals)
    {
        //play sound effect
        int randClip = Random.Range(0, hurtAudio.Length) ;
        AudioSource.PlayClipAtPoint(hurtAudio[randClip], transform.position);

        //Damagae formula
        float dmgToLoose = damage * playerChemicals.getReaction (enemyChemicals);
        this.health -= dmgToLoose;
        stats.damageTaken += dmgToLoose;

        if(health <= 0)
        {
            alive = false;
            stats.chemicals = playerChemicals;
            gameOverDisplay.GetComponent<GameOverDisplay>().AddPlayerStats(stats);
            currentNode.walkable = true;
            currentNode.currentObject = null;
            gameObject.SetActive(false);
        }
    }
Ejemplo n.º 7
0
    public void GainHealth(float healPower, Chemicals pukeChemicals)
    {
        this.health += healPower/2 + healPower * playerChemicals.getReaction(pukeChemicals);

        if(this.health > this.maxHealth)
            this.health = this.maxHealth;
    }
Ejemplo n.º 8
0
 // Dot-product
 public float getReaction(Chemicals targetChemicals)
 {
     return (this.redion * targetChemicals.redion +
             this.greenium * targetChemicals.greenium +
             this.blurine * targetChemicals.blurine);
 }
Ejemplo n.º 9
0
 public void SetPukeChemicals(Chemicals c)
 {
     pukeChemicals = c;
 }
Ejemplo n.º 10
0
 public void SetChemicals(Chemicals theChemicals)
 {
     enemyChemicals = theChemicals;
 }
Ejemplo n.º 11
0
 void Start()
 {
     // needs to get the enemies movement direction
     moveDirection = Vector3.forward;
     health = maxHealth;
     attackCooldownTime = 3f;
     attackRange = 1f;
     enemyChemicals = new Chemicals();
     //GetComponentInChildren<Light>().color = new Color(enemyChemicals.Redion, enemyChemicals.Greenium, enemyChemicals.Blurine);
     GetComponentInChildren<ParticleSystem>().startColor = enemyChemicals.getChemicalsWithAlpha(0.15f);
     SetPlayerList ();
     findNewTarget();
 }