Exemplo n.º 1
0
        protected virtual void OnUpdate()
        {
            if (charging && !animation.GetCurrentFrameFlags().HasFlag(FrameFlags.CHARGING_BLOCKED))
            {
                attackCharge += Time.deltaTime * attackChargeSpeed;
                if (attackCharge >= MaxAttackCharge)
                {
                    attackCharge = MaxAttackCharge;
                    charging     = false;
                }
            }

            if (animation != null)
            {
                animation.Advance(Time.deltaTime);
            }

            if (IsDead)
            {
                float timeDead = Time.time - timeOfDeath;
                rb.isKinematic = true;
                if (timeDead > 10f)
                {
                    Destroy(gameObject);
                }
            }

            if (moving)
            {
                UpdateLiquid();
            }
        }