Пример #1
0
    // Update is called once per frame
    protected void Update()
    {
        transform.position = new Vector3(player.transform.position.x, player.transform.position.y, transform.position.z);


        _multiCollider.EnableCollider(false);
        if (!_multiCollider.GetActiveCollider().enabled)
        {
            meshFilter.mesh = null;
        }
        for (int i = 0; i < hitFrames.Length; ++i)
        {
            if (_animator.currAnim.currFrame == hitFrames[i])
            {
                //Range Check
                if (i < _multiCollider.colliders.Length)
                {
                    SwitchHitBox(i);
                }
            }
        }
        _animator.Update();
        if (_animator.currAnim.finished && !_audioSource.isPlaying)
        {
            Delete();
        }
    }
Пример #2
0
    // Update is called once per frame
    virtual protected void Update()
    {
        //TEST
        if (knockedback)
        {
            _renderer.color = Color.red;
        }
        else
        {
            _renderer.color = Color.white;
        }
        LinearKnockbackUpdate();
        //HP CHECK
        if (health <= 0)
        {
            health = 0;
            //playerState = PlayerState.DEAD;
        }
        if (health == 0)
        {
            Kill();
        }



        //Animator update just calls and updates the current animation, logic must be defined in child class for animation switches if applicable.
        animator.Update();
    }