Example #1
0
    private void Update()
    {
        if (_enemyRend.isVisible)
        {
            Physics.Linecast(gameObject.transform.position, _enemy.position, out _hit);

            if (_hit.collider.gameObject.tag == "Enemy")
            {
                _lookTime += GetDeltaTime.DeltaTime();

                if (_lookTime > 1.0f)
                {
                    _fearTrigger.LookEnemyTime(_lookTime);
                }

                if (!_plusTime)
                {
                    _plusTime = true;
                }
            }
            else
            {
                if (_plusTime)
                {
                    _plusTime = false;
                    _lookTime = 0.0f;
                }
            }
        }
    }
 private void OnTriggerStay(Collider other)
 {
     if (other.gameObject.tag == "EnemyFearArea")
     {
         _keepTime += GetDeltaTime.DeltaTime();
         if (_keepTime > 2.0f)
         {
             _enemyRangeSubject.OnNext(_keepTime);
         }
     }
 }
Example #3
0
    private void Update()
    {
        //左
        if (Input.GetKey(KeyCode.A))
        {
            _playerTransform.position += _playerTransform.right * _speed * -1 * Time.unscaledDeltaTime;
        }
        //右
        if (Input.GetKey(KeyCode.D))
        {
            _playerTransform.position += _playerTransform.right * _speed * Time.unscaledDeltaTime;
        }
        //前
        if (Input.GetKey(KeyCode.W))
        {
            _playerTransform.position += _playerTransform.forward * _speed * Time.unscaledDeltaTime;
        }
        //後
        if (Input.GetKey(KeyCode.S))
        {
            _playerTransform.position += _playerTransform.forward * _speed * -1 * Time.unscaledDeltaTime;
        }

        //走り
        if (_possibleRun)
        {
            if (Input.GetKeyDown(KeyCode.LeftShift))
            {
                _running = true;
                _speed  *= _speedMas;
            }

            if (Input.GetKey(KeyCode.LeftShift))
            {
                _time += GetDeltaTime.DeltaTime();
                if (_time > 2.0f)
                {
                    _fearTrigger.RunTime(_time);
                }
            }

            if (Input.GetKeyUp(KeyCode.LeftShift))
            {
                _running = false;
                _speed  /= _speedMas;
                _time    = 0.0f;
            }
        }

        //アイテム捨て
        if (Input.GetKeyDown(KeyCode.Q))
        {
            _itemManager.DisposeItem();
        }

        //ポーズ
        if (Input.GetKeyDown(KeyCode.Escape))
        {
            _pauseManager.OpenPause();
        }
    }
Example #4
0
    private void Update()
    {
        //左
        if (Input.GetKey(KeyCode.A))
        {
            _playerTransform.position += _playerTransform.right * _speed * -1 * Time.unscaledDeltaTime;
        }
        //右
        if (Input.GetKey(KeyCode.D))
        {
            _playerTransform.position += _playerTransform.right * _speed * Time.unscaledDeltaTime;
        }
        //前
        if (Input.GetKey(KeyCode.W))
        {
            _playerTransform.position += _playerTransform.forward * _speed * Time.unscaledDeltaTime;
        }
        //後
        if (Input.GetKey(KeyCode.S))
        {
            _playerTransform.position += _playerTransform.forward * _speed * -1 * Time.unscaledDeltaTime;
        }

        //走り
        if (_possibleRun)
        {
            if (Input.GetKeyDown(KeyCode.LeftShift))
            {
                _speed *= 1.9f;
            }

            if (Input.GetKey(KeyCode.LeftShift))
            {
                _time += GetDeltaTime.DeltaTime();
                if (_time > 2.0f)
                {
                    _fearTrigger.RunTime(_time);
                }
            }

            if (Input.GetKeyUp(KeyCode.LeftShift))
            {
                _speed /= 1.9f;
                _time   = 0.0f;
            }
        }

        //しゃがみ
        if (Input.GetKey(KeyCode.Space))
        {
            if (_fovController.localPosition.y > 1.0f)
            {
                _fovController.localPosition -= _squatSpeed;
            }
        }
        else
        {
            if (_fovController.localPosition.y < 2.0f)
            {
                _fovController.localPosition += _squatSpeed;
            }
        }

        //アイテム捨て
        if (Input.GetKeyDown(KeyCode.Q))
        {
            _itemManager.DisposeItem();
        }

        //ポーズ
        if (Input.GetKeyDown(KeyCode.Escape))
        {
            _pauseManager.OpenPause();
        }
    }