Exemple #1
0
 /// <summary> Adds water. </summary>
 /// <param name="surface">Water settings.</param>
 public void AddWater(Surface surface)
 {
     lock (Water)
     {
         Water.Add(surface);
     }
 }
Exemple #2
0
        public void WaterHoldIceShouldNotifySpecialPropertyChanged()
        {
            Water water = new Water();

            Assert.PropertyChanged(water, "Special", () =>
            {
                water.Add();
            });
        }
Exemple #3
0
        public override void Tick(float time)
        {
            base.Tick(time);
            _waterResource.Add(PowerIncreaseRate * time);

            bool startElecState  = HasPower;
            bool startWaterState = HasWaterSupply;

            #region Electricity
            float request_electricity  = ElectricityDrain * time;
            float recieved_electricity = 0;

            if (CurrentResources.ContainsKey(typeof(Electricity)))
            {
                List <ResourceData> electricity = CurrentResources[typeof(Electricity)];
                foreach (ResourceData rData in electricity)
                {
                    recieved_electricity = rData.resource.Recieve(request_electricity);
                    if (request_electricity == recieved_electricity)
                    {
                        break;
                    }
                }
            }

            if (recieved_electricity != request_electricity)
            {
                //Track how long we have not had the power we requested. If its above the acceptable value we dont consider this house to have power.
                ResourceMissingTimes[0] += time;
                if (ResourceMissingTimes[0] > timeoutTime)
                {
                    HasPower = false;
                }
            }
            else
            {
                //We got the power we requested.
                ResourceMissingTimes[0] = 0;
                HasPower = true;
            }

            if (startElecState != HasPower)
            {
                Game.CurrentSession.TaskManager.Tasks.Enqueue(electricityWarningTask);
            }
            #endregion
        }
Exemple #4
0
        public override void Bind(Entity entity, Main main, bool creating = false)
        {
            Transform transform = entity.GetOrCreate <Transform>("Transform");
            Water     water     = entity.GetOrCreate <Water>("Water");

            this.SetMain(entity, main);

            water.Add(new TwoWayBinding <Vector3>(water.Position, transform.Position));
            entity.Add("Color", water.Color);
            entity.Add("UnderwaterColor", water.UnderwaterColor);
            entity.Add("Fresnel", water.Fresnel);
            entity.Add("Speed", water.Speed);
            entity.Add("RippleDensity", water.RippleDensity);
            entity.Add("EnableReflection", water.EnableReflection);
            entity.Add("Distortion", water.Distortion);
            entity.Add("Brightness", water.Brightness);
            entity.Add("Clearness", water.Clearness);
            entity.Add("Depth", water.Depth);
            entity.Add("Refraction", water.Refraction);
            entity.Add("Scale", water.Scale);
            entity.Add("Big", water.CannotSuspendByDistance);
        }