isShortcutKey() public static method

public static isShortcutKey ( KeyCode, code, bool restricted = false ) : bool
code KeyCode,
restricted bool
return bool
Beispiel #1
0
 //TODO refactor interactions out of medium
 private void manageMoleculeConcentrationWithKey(String molecule)
 {
     if (GameStateController.isShortcutKey(GameStateController.keyPrefix + molecule + _shortkeyPlusSuffix))
     {
         if (_enableSequential)
         {
             ReactionEngine.getMoleculeFromName(molecule, _molecules).addConcentration(10f);
         }
         else
         {
             ReactionEngine.getMoleculeFromName(molecule, _molecules).addNewConcentration(100f);
         }
     }
     if (GameStateController.isShortcutKey(GameStateController.keyPrefix + molecule + _shortkeyMinusSuffix))
     {
         if (_enableSequential)
         {
             ReactionEngine.getMoleculeFromName(molecule, _molecules).addConcentration(-10f);
         }
         else
         {
             ReactionEngine.getMoleculeFromName(molecule, _molecules).addNewConcentration(-100f);
         }
     }
 }
Beispiel #2
0
    void Update()
    {
        if (!_pause)
        {
            _lifeManager.regen(Time.deltaTime);
            _energy = _medium.getEnergy() / _maxMediumEnergy;

            if (GameStateController.isShortcutKey(_keyLife, true))
            {
                _lifeManager.addVariation(1f);
            }
            if (GameStateController.isShortcutKey(_keyEnergy, true))
            {
                setEnergy(1f);
            }

            // dammage in case of low energy
            if (_energy <= 0.05f)
            {
                _lifeManager.addVariation(-Time.deltaTime * _lowEnergyDpt);
            }


            // Life animation when life is reducing
            if (_lifeManager.getVariation() < 0)
            {
                if (lifeAnimation.isPlaying == false)
                {
                    lifeAnimation.Play();
                }
            }

            // Energy animation when energy is reducing
            if (_energy < _energyBefore)
            {
                DisplayEnergyAnimation();
            }
            _energyBefore = _energy;


            _lifeManager.applyVariation();
            if (_lifeManager.getLife() == 0f && (_isAlive))
            {
                _isAlive = false;

                RedMetricsManager.get().sendEvent(TrackingEvent.DEATH, null, getLastCheckpointName());
                StartCoroutine(RespawnCoroutine());
            }
        }
    }
Beispiel #3
0
 // light on/off for the black light
 public void switchLight()
 {
     if (GameStateController.isShortcutKey(GameStateController.keyPrefix + _blackLightOn, true) &&
         !isActive
         )
     {
         createBlackLight();
         if (!_shaderChanged)
         {
             setDiffuseTransparentPlane();
         }
         isActive = true;
     }
     if (GameStateController.isShortcutKey(GameStateController.keyPrefix + _blackLightOff, true) &&
         isActive
         )
     {
         leaveBlackLight();
         isActive = false;
     }
 }