예제 #1
0
        public override void RessourceChecking(GameEntity gameEntity, Ressource ProductedRessource, List <RessourceConsumption> usedRessource)
        {
            bool canProduce = false;

            if (usedRessource != null)
            {
                foreach (var ress in usedRessource)
                {
                    if (ress.RessourceToUse.CheckRessource(gameEntity, ress.Amount))
                    {
                        canProduce = true;
                        ress.RessourceToUse.UseRessource(gameEntity, ress.Amount);
                    }
                    else
                    {
                        canProduce = false;
                        break;
                    }
                }
            }
            if (usedRessource.Count == 0)
            {
                canProduce = true;
            }
            if (canProduce)
            {
                ProductedRessource.AddRessource(gameEntity, ProductionAmount);
            }
        }
        public override void RessourceChecking(GameEntity gameEntity, Ressource ProductedRessource, List <RessourceConsumption> usedRessource)
        {
            bool canProduce = false;

            if (usedRessource != null)
            {
                foreach (var ress in usedRessource)
                {
                    if (ress.RessourceToUse.CheckRessource(gameEntity, ress.Amount))
                    {
                        ress.RessourceToUse.UseRessource(gameEntity, ress.Amount);
                        canProduce = true;
                    }
                    else
                    {
                        canProduce = false;
                        break;
                    }
                }
            }

            if (canProduce)
            {
                ProductedRessource.AddRessource(gameEntity, RetrievingAmount);
            }
            else
            {
                Debug.Log("No Enough Energy To Retrieve" + this.name);
            }
        }