Пример #1
0
    public void StartMeleeAttack(Attack attack)
    {
        cc.FreezeVelocity();


        if (attack.name == "Jab 1")
        {
            // light
            anim.SetInteger("jab", 1);
            hitbox = new MeleeHitbox(attack);
        }
        else if (attack.name == "Jab 2")
        {
            //mid
            anim.SetInteger("jab", 1);
        }



        //hitbox_Middle.Activate();

        if (attack.xDisplacement + comboCount != 0)
        {
            //rb.AddForce(new Vector2(rb.velocity.x + attack.xDisplacement * spell.direction, rb.velocity.y), ForceMode2D.Impulse);
            //rb.velocity = new Vector2((rb.velocity.x + attack.xDisplacement + comboCount) * (cc.m_FacingRight? 1 : -1), rb.velocity.y);
            rb.velocity = new Vector2((rb.velocity.x + attack.xDisplacement + comboCount) * (cc.m_FacingRight ? 1 : -1), rb.velocity.y);
            print("force applied");
        }
    }
Пример #2
0
 void Start()
 {
     meleeHitbox     = GetComponentInChildren <MeleeHitbox>();
     audioSource     = GetComponent <AudioSource>();
     playerStatus    = GetComponent <PlayerStatusManager>();
     movementManager = GetComponent <MovementManager>();
     animator        = GetComponent <Animator>();
 }
Пример #3
0
    protected void SetupHitbox()
    {
        // Instantiate melee prefab
        MeleeHitbox hitbox = user.GetComponentInChildren <MeleeHitbox>(true);

        hitbox.Reset(); // TODO: fix this this is bad
        hitbox.AddEnterListener(HitCharacter);
        hitbox.AddEnterListener(HitAttachableHitbox);
        hitbox.AddEnterListener(HitDetachableHitbox);
        meleeHitboxScene = hitbox;
    }
Пример #4
0
    protected void AggroState()
    {
        Destination = player.transform.position;
        MeleeHitbox.SetActive(true);

        if (timer <= Time.time)
        {
            CreateFireball();
            ResetTimer();
        }
        if (!playerIsInRange)
        {
            state = IDLE_STATE;
            SetIdleTimer();
        }
    }
Пример #5
0
    public void OnHit(MeleeHitbox hitbox, Collider2D other)
    {
        if (!player.IsLocalPlayer || State != WeaponState.Active)
        {
            return;
        }

        var hurtBox = other.gameObject.GetComponent <HurtBox>();

        if (!hurtBox || hurtBox.Player == player || playersHit.Contains(hurtBox.Player))
        {
            return;
        }

        playersHit.Add(hurtBox.Player);
        hurtBox.Hit(hitbox);
    }
Пример #6
0
 public void Hit(MeleeHitbox hitbox)
 {
     Player.Damage(Mathf.RoundToInt(multiplier * hitbox.Damage));
     Player.Knockback(hitbox.transform.up * hitbox.Knockback);
 }