Ejemplo n.º 1
0
 public void OnPlayerCameToLayer(EventArgs args)
 {
     if (args is PlayerCameToLayerEA pctl)
     {
         if (pctl.GroundLayer.AreaType == GroundLayer.EAreaType.Surface)
         {
             if (_currentlyVisitedAreaType == GroundLayer.EAreaType.Underground)  //player came to surface
             {
                 ChangePowerFlowFactorsEA cpff = new ChangePowerFlowFactorsEA();
                 cpff.AddFactor(new PowerFlowFactor("Surface Charging", "Nearby star is charging your battery", _chargingPowerOnSurface));
                 _changePowerFlowFactors.Raise(cpff);
             }
         }
         else
         {
             if (_currentlyVisitedAreaType == GroundLayer.EAreaType.Surface)  //player came to underground
             {
                 ChangePowerFlowFactorsEA cpff = new ChangePowerFlowFactorsEA();
                 cpff.RemoveFactor("Surface Charging");
                 _changePowerFlowFactors.Raise(cpff);
             }
         }
         _currentlyVisitedAreaType = pctl.GroundLayer.AreaType;
     }
     else
     {
         throw new InvalidEventArgsException();
     }
 }
Ejemplo n.º 2
0
        private void ChangeTransparency(GroundLayer.EAreaType layerAreaType)
        {
            switch (layerAreaType)
            {
            case GroundLayer.EAreaType.Surface:
                if (_state != ECurrentState.ToTransparent && _changeTransparencyCoroutine != null)
                {
                    StopCoroutine(_changeTransparencyCoroutine);
                }
                _state = ECurrentState.ToTransparent;
                _changeTransparencyCoroutine = StartCoroutine(ToTransparent());
                break;

            case GroundLayer.EAreaType.Underground:
                if (_state != ECurrentState.ToOpaque && _changeTransparencyCoroutine != null)
                {
                    StopCoroutine(_changeTransparencyCoroutine);
                }
                _state = ECurrentState.ToOpaque;
                _changeTransparencyCoroutine = StartCoroutine(ToOpaque());
                break;

            default:
                _state = ECurrentState.Idle;
                break;
            }
        }