예제 #1
0
        public override void Update(GameTime gameTime)
        {
            base.Update(gameTime);

            //Debug.Log(xPos + " : "  + yPos);

            if (localAtmosphere == null || localAtmosphere != ParentTileMap.GetAtmosphere(xPos, yPos))
            {
                localAtmosphere = ParentTileMap.GetAtmosphere(xPos, yPos);
                //Debug.Log("Local Atmosphere: " + localAtmosphere.xPos + ", " + localAtmosphere.yPos);
            }

            if (localAtmosphere.airPressure <= minAirPressure)
            {
                IsMachineOn = true;
                turnOnTime  = Time.gameTime;
            }
            if (localAtmosphere.airPressure >= turnOffPressure && Time.gameTime - turnOnTime >= stayOnDelay)
            {
                IsMachineOn = false;
            }

            if (IsMachineOn)
            {
                localAtmosphere.ChangePressure(airProduction);
            }
        }