예제 #1
0
    public void AttackCheck(int attackCount)
    {
        int dir = player.isLeft ? -1 : 1;

        hitbox.mask.useTriggers = false;
        hitbox.SetAct(Act.ATTACK);
        hitbox.SetOffset(new Vector2(ATTACK[0].x * dir, ATTACK[0].y));
        hitbox.SetSize(ATTACK[1]);
        hitbox.StartCheckingCollision();
        hitbox.CheckCollision();
        hitbox.StopCheckingCollision();
    }
예제 #2
0
    private void AttackCheck()
    {
        int dir = character.isLeft ? -1 : 1;

        hitbox.mask.useTriggers = false;
        hitbox.SetAct(Act.ATTACK);
        hitbox.SetOffset(new Vector2(Guard.ATTACK[0].x * dir, Guard.ATTACK[0].y));
        hitbox.SetSize(Guard.ATTACK[1]);
        hitbox.StartCheckingCollision();
        hitbox.CheckCollision();
        hitbox.StopCheckingCollision();
        didAttack = true;
    }
예제 #3
0
    private void ShoveCheck()
    {
        int dir = character.isLeft ? -1 : 1;

        hitbox.mask.useTriggers = false;
        hitbox.SetAct(Act.SHOVE);
        hitbox.SetOffset(new Vector2(Ranger.SHOVE[0].x * dir, Ranger.SHOVE[0].y));
        hitbox.SetSize(Ranger.SHOVE[1]);
        hitbox.StartCheckingCollision();
        hitbox.CheckCollision();
        hitbox.StopCheckingCollision();
        didShove = true;
    }
예제 #4
0
        public void Update()
        {
            var hits = _hitbox.CheckCollision();

            foreach (var hit in hits)
            {
                if (!_hits.Contains(hit) && !_exclude(hit))
                {
                    _hits.Add(hit);
                    hit.target.TakeDamage(2f);                     // TODO based on attack
                    Debug.Log(string.Format("Hit {0}, {1}", hit.target, hit.target.health));
                }
            }
        }