示例#1
0
        private void Update()
        {
            if (_gun == null)
            {
                throw new System.Exception("Gun null exception");
            }

            _gun.SetShootDirection(Vector3.forward);

            //_gun.Shoot();

#if UNITY_EDITOR
            if (Input.GetKeyDown(KeyCode.Space))
            {
                if (_gun.IsShooting == false)
                {
                    _gun.StartShoot();
                }
            }

            if (Input.GetKeyUp(KeyCode.Space))
            {
                if (_gun.IsShooting)
                {
                    _gun.StopShoot();
                }
            }
#endif
        }
示例#2
0
    private void Awake()
    {
        if (_gun == null)
        {
            throw new System.Exception("Enemy gun null exception");
        }

        _gun.SetShootDirection(Vector3.back);

        _transform = transform;
        SetDirection(Vector3.back);
    }