public override bool Hit(GridHit hit) { // Determine which side the hitter is closer on, vertical or horizontal Vector2 diff = hit.hitPosition - (Vector2)transform.position; bool isHori = Mathf.Abs(diff.x) > Mathf.Abs(diff.y); slideDirection = hit.direction.ToDirection2D(isHori).ToQuadDirection2D(); return(false); }
public override bool Hit(GridHit hit) { if (!hit.moverObj.CompareTag("Player")) { return(false); } // Only let the player pass if they are a circle return(ChangeShapeSkill.instance.GetCurrentState().TypeOfShape == ShapeData.ShapeType.CIRCLE); }
public override bool Hit(GridHit hit) { // Don't let things that are not the player through if (!hit.moverObj.CompareTag("Player")) { return(false); } // Only let the player through if the player's current color is the needed color return(ChangeColorSkill.Instance.GetTargetColor() == colorToPassThroughWall.color); }
public override bool Hit(GridHit hit) { Vector2 diff = hit.hitPosition - (Vector2)transform.position; // Scale the difference by the mover's size. The bigger magnitude of the result (x or y) is closer Vector2 distComparisonV = diff / transform.lossyScale; bool isHori = Mathf.Abs(distComparisonV.x) > Mathf.Abs(distComparisonV.y); gridMover.speed = hit.speed; QuadDirection2D dir = hit.direction.ToDirection2D(isHori).ToQuadDirection2D(); return(gridMover.Move(dir)); }
/// <summary> /// /// </summary> /// <param name="hit"></param> /// <returns>If the mover can move after hitting this.</returns> public abstract bool Hit(GridHit hit);