Ejemplo n.º 1
0
    // Update is called once per frame
    void Update()
    {
        if (_playerLaserPos == null)
        {
            return;
        }

        if (_laserTimer.GetTimer() == 0.0f)
        {
            GetComponent <Animator>().SetTrigger("LaserOff");
        }

        _laserPosition   = _playerLaserPos.position;
        _laserPosition.y = _playerLaserPos.position.y + 5.7f;

        transform.position = _laserPosition;
    }
Ejemplo n.º 2
0
    // Update is called once per frame
    protected void Update()
    {
        _generateTimer += Time.deltaTime;

        if (Input.GetKeyDown(KeyCode.Z))
        {
            if (_activatedLaser == null && _laserTimer.GetTimer() > 0.0f)
            {
                _activatedLaser = Instantiate(laser, transform.position + (Vector3.up * 5.0f), Quaternion.identity);
            }
            else if (_activatedLaser != null)
            {
                _activatedLaser.GetComponent <Animator>().SetTrigger("LaserOff");
            }
        }



        if (Input.GetKey(KeyCode.Space) && _generateTimer > shotDelay && _activatedLaser == null)
        {
            _generateTimer = 0.0f;
            Shot();
        }
    }