Example #1
0
    protected override void AttackEffect()
    {
        if (basicCooldownCurrent <= 0)
        {
            basicCooldownCurrent = basicCooldown;

            if (direction > 0)
            {
                projBasicRight.Activate(0.2f);
            }
            else
            {
                projBasicLeft.Activate(0.2f);
            }
            physics.speed.x   += 6 * direction;
            animator.attacking = true;
            LockInput(0.2f);
        }
    }
Example #2
0
    protected void LateUpdate()
    {
        if (GameManager.o.pause)
        {
            return;
        }

        if (basicDelay > 0)
        {
            basicDelay -= Time.deltaTime;
            if (basicDelay <= 0)
            {
                animator.state = "basic";
                if (direction > 0)
                {
                    projBasicRight.Activate(0.3f);
                }
                else
                {
                    projBasicLeft.Activate(0.3f);
                }
                physics.SetSpeedX(10 * direction, 0.2f);
                physics.SetSpeedY(-0.01f, 0.2f);
                basicDuration = 0.2f;
            }
        }
        else if (basicDuration > 0)
        {
            basicDuration -= Time.deltaTime;
            physics.SetSpeedX(10 * direction, 0);
            if (basicDuration <= 0)
            {
                animator.state = "basic end";
                physics.SetSpeedX(0, 0);
            }
        }

        if (specialDelay > 0)
        {
            specialCooldownCurrent = specialCooldown;
            specialDelay          -= Time.deltaTime;
            if (specialDelay <= 0)
            {
                animator.state = "special";
                if (direction > 0)
                {
                    projSpecialRight.Activate(20);
                }
                else
                {
                    projSpecialLeft.Activate(20);
                }
                projSpecialLeft.damage  = 1;
                projSpecialRight.damage = 1;
                physics.SetSpeedX(4 * direction, 20);
                physics.SetSpeedY(-physics.gravity, 20);
                specialDuration = 0;
                LockInput(1);
            }
        }
        else if (specialDuration >= 0)
        {
            specialCooldownCurrent = specialCooldown;
            specialDuration       += Time.deltaTime;
            if (physics.collideBottom)
            {
                projSpecialLeft.Deactivate();
                projSpecialRight.Deactivate();
                animator.state = "special end";
                physics.SetSpeedX(0, 0.3f);
                physics.SetSpeedY(0, 0.3f);
                LockInput(0.3f);
                specialDuration = -1;
            }
            else if (specialDuration >= 0.7f)
            {
                projSpecialLeft.damage  = 2;
                projSpecialRight.damage = 2;
            }
        }
    }