public Vector3 GetFloorPoint(Vector3 _startingPoint) { var rayStart = _startingPoint; var rayDir = Vector2.down; float rayDist = 20.0f; Vector2 floorPosition = Vector2.zero; RaycastHit2D hit = Physics2D.Raycast(rayStart, rayDir, rayDist, floorLayer); //1 << LayerMask.NameToLayer("Enemy")); if (hit) { floorPosition = hit.point; } FloorPointEvent OnFloorPointEvent = new FloorPointEvent { description = "Unit " + gameObject.name + " Health Event.", floorPoint = floorPosition }; OnFloorPointEvent.FireEvent(); return(floorPosition); }
private void OnEnable() { FloorPointEvent.RegisterListener(OnFloorPointEvent); }
private void OnFloorPointEvent(FloorPointEvent e) { //Debug.Log("PlayerMovement sees floor point at: " + e.floorPoint); floorPoint = e.floorPoint; }