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(); }
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; }
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; }
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)); } } }